npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

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

v0.2.12

Published

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 d

Downloads

3,513

Readme

@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>