mirror of
https://github.com/tabler/tabler.git
synced 2025-12-22 01:44:25 +04:00
4.2 KiB
4.2 KiB
title, docs-libs, description, summary
| title | docs-libs | description | summary | |||
|---|---|---|---|---|---|---|
| Vector Maps |
|
Interactive guide to creating vector maps with jsVectorMap. | Vector maps are a great way to display geographical data in an interactive and visually appealing way. Learn how to create vector maps with jsVectorMap. |
Installation
To use vector maps in your project, you need to include the jsVectorMap library in your project. You can install it via npm or include it directly from a CDN. The following example demonstrates how to include the jsVectorMap library from a CDN:
<script src="{{ cdnUrl }}/dist/libs/jsvectormap/dist/js/jsvectormap.min.js"></script>
<script src="{{ cdnUrl }}/dist/libs/jsvectormap/dist/maps/js/jsvectormap-world.js"></script>
Sample demo
Integrating the vector map into your website is straightforward. Below is a sample implementation for a world map:
<div id="map-world" class="w-100 h-100"></div>
<script>
document.addEventListener("DOMContentLoaded", function () {
const map = new jsVectorMap({
selector: "#map-world",
map: "world",
});
});
</script>
Look at the example below to see how the vector map works with a world map.
{% capture html -%}
Markers
You can add markers to the map to highlight specific locations. Below is a sample implementation for a world map with markers:
{% capture html -%}