0.2.45 • Published 8 months ago

@kong-ui-public/analytics-geo-map v0.2.45

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

@kong-ui-public/analytics-geo-map

This Vue component provides a geographical map visualization based on maplibre-gl and displays country metrics using color-coded layers. It supports dynamic updates to country metrics and allows focusing on specific countries. Renders provided GeoJSON data into a choropleth style map.

Features

  • Interactive geographical map visualization using maplibre-gl.
  • Color-coded countries based on provided metrics.
  • Tooltips showing country names and their corresponding metrics.
  • Ability to focus on specific countries with customizable bounds.
  • Dynamic updates to country metrics and map features.

Requirements

  • vue must be initialized in the host application.
  • maplibre-gl must be added as a dependency in the host application. See here
  • GeoJSON Data provided must include property "iso_a2" for each country Feature in order for this component to function properly. See here for a useful tool for generating GeoJSON country vector maps.

Usage

Install

First, ensure you have maplibre-gl installed:

npm install maplibre-gl
npm install @kong-ui-public/analytics-geo-map

Props

countryMetrics

  • type: Object (Record<string, number>)
  • required: true
  • description: An object mapping country codes to metric values. These metrics determine the color of each country on the map.

geoJsonData

  • type: Object (MapFeatureCollection)
  • required: true
  • description: GeoJSON data for the map, defining the shapes and positions of countries.
  • See here

metricUnit

  • type: String (MetricUnits)
  • required: true
  • description: Unit of measurement for the metrics displayed in the tooltips.

metric

  • type: String (ExploreAggregations)
  • required: true
  • description: Metric aggregations for the data displayed on the map.

withLegend

  • type: Boolean
  • required: false
  • default: true
  • description: Whether to display a legend on the map.

showTooltipValue

  • type: Boolean
  • required: false
  • default: true
  • description: Display value in the tooltip.

fitToCountry

  • type: String (CountryISOA2)
  • required: false
  • default: null
  • description: Country code to zoom in on.

bounds

  • type: Object (LngLatBoundsLike)
  • required: false
  • default: null
  • description: Longitudinal/Latitudinal bounds to initially fit the map to.

Example

<template>
  <AnalyticsGeoMap
    :countryMetrics="countryMetrics"
    :geoJsonData="geoJsonData"
    :fitToCountry="'US'"
    metricUnit="%"
  />

  <!-- bounds to europe -->
  <AnalyticsGeoMap
    :countryMetrics="countryMetrics"
    :geoJsonData="geoJsonData"
    :bounds="[
      [-10, 35],
      [65, 72]
    ]"
    metricUnit="%"
  />
</template>

<script setup>
import { ref } from 'vue'
import AnalyticsGeoMap from '@kong-ui-public/analytics-geo-map'
import geoJsonData from './path-to-geojson-data.json'

const countryMetrics = ref({
  US: 75,
  CA: 50,
  MX: 25,
  // Other countries
})
</script>
0.2.45

8 months ago

0.2.44

8 months ago

0.2.43

8 months ago

0.2.41

8 months ago

0.2.40

8 months ago

0.2.42

8 months ago

0.2.39

8 months ago

0.2.38

8 months ago

0.2.37

8 months ago

0.2.36

8 months ago

0.2.27

9 months ago

0.2.26

9 months ago

0.2.25

9 months ago

0.2.24

9 months ago

0.2.23

9 months ago

0.2.22

9 months ago

0.2.21

9 months ago

0.2.20

9 months ago

0.2.19

9 months ago

0.2.30

8 months ago

0.2.35

8 months ago

0.2.34

8 months ago

0.2.33

8 months ago

0.2.32

8 months ago

0.2.31

8 months ago

0.2.29

8 months ago

0.2.28

8 months ago

0.2.18

9 months ago

0.2.17

9 months ago

0.2.16

9 months ago

0.2.15

9 months ago

0.2.14

9 months ago

0.2.13

9 months ago

0.2.12

9 months ago

0.2.11

9 months ago

0.2.10

9 months ago

0.2.9

9 months ago

0.2.8

9 months ago

0.2.7

9 months ago

0.2.6

9 months ago

0.2.3

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.2.2

9 months ago

0.2.1

9 months ago

0.2.0

10 months ago

0.1.27

10 months ago

0.1.25

10 months ago

0.1.26

10 months ago

0.1.24

10 months ago

0.1.23

10 months ago

0.1.22

10 months ago

0.1.21

10 months ago

0.1.20

10 months ago

0.1.19

10 months ago

0.1.18

10 months ago

0.1.17

10 months ago

0.1.16

10 months ago

0.1.15

11 months ago

0.1.14

11 months ago

0.1.13

11 months ago

0.1.12

11 months ago

0.1.11

11 months ago

0.1.10

11 months ago

0.1.9

11 months ago

0.1.8

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago