For AI agents: the complete documentation index is available at https://docs.dataplatform.ovh.net/llms.txt, the full documentation bundle is available at https://docs.dataplatform.ovh.net/llms-full.txt, and this page is available as Markdown at https://docs.dataplatform.ovh.net/sdk/app-charts-jvectormap.md.
  • 🇬🇧 English
  • JVectorMap

    Warning

    Rework pending, no delivery date. The Front App SDK (ReactJS) and the Front API SDK (NodeJS) are both being replaced. This page documents the current release, remains accurate, and is maintained until the replacement ships. Code written against it keeps working.

    Jvectormap is a library that allows you to use maps on your dashboards. In our standard implementation, we currently provide allow displaying a map, and with a scale on city name, display a number by city.

    Official library documentation : https://jvectormap.com/

    JVectorMap

    Info

    If you do not understand the objects referred to in this article, please check the Charts article for more details.


    Sample code in JSON

    The sample code below should be pasted in an Application dashboard to use the JVectorMap library.

    {
      "type": "chart",
      "col": 0,
      "row": 1,
      "sizeX": 12,
      "sizeY": 20,
      "title": "",
      "chart": {
        "dynamic-parameters": [
          "datepicker"
        ],
        "component": "jvectormap",
        "options": {
          "map": "fr_regions_mill"
        },
        "request": {
          "data": {
            "fields": {
              "qte": [
                "sum"
              ],
              "ca": [
                "sum"
              ]
            }
          },
          "scale": {
            "fields": [
              "city"
            ]
          }
        }
      }
    }

    Request

    There are two conditions that need to be respected in order to have a correct JVectorMap request.

    First condition

    The request must contain at least one data, it can be multiple like in the previous sample

    "data": {
      "fields": {
        "qte": [
          "sum"
        ],
        "ca": [
          "sum"
        ]
      }
    },

    That data will appear on each point of the map (marker)

    JVectorMap

    Second condition

    The request must contain at least one scale, it will be use to compute marker

    The value generated by the scale will be send through the google geocoding api : https://www.npmjs.com/package/geocoding

    If the value generate valid lat, lng coordinates, the marker will apear with the data associated

    "scale": {
      "fields": [
        "city"
      ]
    }

    Response

    A correct answer with my previous example look like that

    {
        "scales": {
            "city": "Bordeaux"
        },
        "data": {
            "qte": {
                "sum": [
                    {
                        "city": "Bordeaux",
                        "value": 18073
                    }
                ]
            },
            "ca": {
                "sum": [
                    {
                        "city": "Bordeaux",
                        "value": 190987.45
                    }
                ]
            }
        }
    },
    { .....

    That answer will display a marker on Bordeaux (looking the position of the city with google geocoding) and with 2 value : sum qte, and sum ca


    Options

    options.map : Allow the user to select a map

    List of all maps

    NameJSON Value
    Worlds, Continentscontinents_mill
    World, Countryworld_mill
    World, Countryworld_mill
    Africa, Countryafrica_mill
    Asia, Countryasia_mill
    Europe, Countryeurope_mill
    North America, Countrynorth_america_mill
    Oceania, Countryoceania_mill
    South America, Countrysouth_america_mill
    Argentinaar_mill
    Australiaau_mill
    Austriaat_mill
    Belgiumbe_mill
    Canadaca_lcc
    Chinacn_mill
    Colombiaco_mill
    Denmarkdk_mill
    France, Departmentsfr_mill
    France, Regionsfr_regions_mill
    France, Regions 2016fr_regions_2016_mill
    Germanyde_mill
    Indiain_mill
    Italy, Provincesit_mill
    Italy, Regionsit_regions_mill
    Netherlandsnl_mill
    New Zelandnz_mill
    Norwayno_mill
    Polandpl_mill
    Portugalpt_mill
    Russia, Federal districtsru_fd_mill
    Russiaru_mill
    South Africaza_mill
    South Koreakr_mill
    Spaines_mill
    Swedense_mill
    Switzerlandch_mill
    Thailandth_mill
    United Kingdom, Regionsuk_regions_mill
    United Kingdomuk_countries_mill
    USAus_aea
    Venezuelave_mill
    Venezuelave_mill
    USA, Chicagous-il-chicago_mill
    USA, New York Cityus-ny-newyork_mill

    Going further

    Of course that library give you a sample of usage. But jvectormap offer much more feature

    Looking the code in "forepaas/jvectormap/FpJvectormap.jsx" and the documentation to create your own chart component you can customize it.