Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECharts VolkovLabs Plugin Geo Maps: "Cannot read properties of undefined (reading 'regions')" Error on Map Initialization #350

Closed
beyzacevik opened this issue Dec 4, 2024 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@beyzacevik
Copy link

beyzacevik commented Dec 4, 2024

I am using Geo Maps on Grafana to visualize data. With the below settings:

Renderer: SVG
Maps: JSON

After no changes to the code or environment, the map visualization using the VolkovLabs ECharts plugin fails with the error.

TypeError: Cannot read properties of undefined (reading 'regions').

This issue occurs when setting up a map visualization with GeoJSON data. The same code and plugin version worked correctly yesterday, but the error is now consistently reproducible. This behavior is unexpected, given that no updates or configuration changes have been made.

It does not work with the most simplified version code as below.


function loadItalyMap() {
  $.get(
    "path/to/italy_provinces.json",
    (geoJsonItaly) => {
      const options = {
        tooltip: {
          trigger: "item",
          formatter: "{b}", // Display province name
        },
        series: [
          {
            type: "map",
            map: "italy",
            label: {
              show: true, // Show province names
            },
            itemStyle: {
              emphasis: { areaColor: "#b0c4de" },
            },
            data: geoJsonItaly.features.map((feature) => ({
              name: feature.properties.prov_name,
              value: 1, // Dummy value
            })),
          },
        ],
      };

      context.panel.chart.setOption(options);
    }
  ).fail((_, textStatus, errorThrown) => {
    console.error("Error loading Italy GeoJSON:", textStatus, errorThrown);
  });
}

loadItalyMap();

Environment
Grafana Version: v11.3.0-pre (unknown-de)
VolkovLabs ECharts Plugin Version: 6.4.1

Can you please inform me why this could happen?

@beyzacevik
Copy link
Author

beyzacevik commented Dec 5, 2024

I updated the map with below constant:

'map: "italy"' to 'map: "Italy"' and it seems to be working.

Could you please provide detailed information on why this could possibly happen?

@mikhail-vl mikhail-vl self-assigned this Dec 6, 2024
@mikhail-vl mikhail-vl added the question Further information is requested label Dec 6, 2024
@mikhail-vl mikhail-vl moved this to Backlog in Business Suite Dec 8, 2024
@vitPinchuk
Copy link
Contributor

vitPinchuk commented Dec 18, 2024

@beyzacevik thanks for the open question

In this case, this is the context of working directly with the Apache ECharts library.
Most likely, this is due to how the country name is stored in the JSON

@github-project-automation github-project-automation bot moved this from Backlog to Done in Business Suite Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: Done
Development

No branches or pull requests

3 participants