A lightweight JavaScript library for creating interactive maps and pretty data visualization.
Starting from v1.5.0 the addLine and removeLine are deprecated and will be removed soon, as an alternative please use addLines and removeLines.
const map = new jsVectorMap({})
// ❌ Avoid this in the future versions.
map.addLine()
// ✅ Use `addLines` method to add a line or multiple lines.
map.addLines({ from: 'Palestine', to: 'Ukraine' })
map.addLines([
{ from: 'United States', to: 'Egypt' },
{ from: 'Palestine', to: 'Ukraine' },
])
// ❌ Avoid this in the future versions.
map.removeLine('United States', 'Egypt')
// ✅ Use `removeLines` method to remove multiple lines or all lines.
map.removeLines()
map.removeLines([{ from: 'United States', to: 'Egypt' }])
The map container was an instance of a custom class in early versions, now it's just a DOM element.
const map = new jsVectorMap({
onLoaded: (map) => {
// ❌ Won't work anymore.
map.container.delegate(".jvm-region", "click", (event) => {
// ..
})
// ✅ You will need to define your own event listener, example
map.container.addEventListener('click', (event) => {
if (event.target.matches('.jvm-region')) {
// Do something
}
})
}
})