1.0.0 • Published 3 years ago
@flowide/leaflet-spaghetti-plugin v1.0.0
Leaflet Spaghetti Plugin
Building
npm install
npm run build
Generate docs
npm run docs
Usage
All of the plugin's components are under L.Spaghetti
namespace.
Example
const map = L.map('map').setView([0, 0], 4);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
const hourms = 3600000;
const spaghetti = new L.Spaghetti.SpaghettiDiagram({
id:'12',
data:[
{
position:[0,0],
time:(new Date()).getTime() - 8 * hourms
},
{
position:[10,0],
time:(new Date()).getTime() - 6 * hourms,
},
{
position:[0,10],
time:(new Date()).getTime() - 3 * hourms
},
{
position:[10,10],
time:(new Date()).getTime() - 1 * hourms
}
]
}).addTo(map)
const slider = L.Spaghetti.createTimeRangeSlider();
slider.addTo(map);
slider.addChangeHandler((values) => {
spaghetti.TimeInterval = {minimum:values[0],maximum:values[1]}
});
1.0.0
3 years ago