echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Feature] Using scatter chart in map by region name instead of using coordinates

Open jgoncab-arte opened this issue 1 year ago • 2 comments

What problem does this feature solve?

Now if you want to use a scatter chart in a map you have to set the coordinates where each bubble is going to be drawn. In my case I only have access to the polygons of the map and I have to calculate a point inside on my own, which is not an easy task in some cases. I have to do it dynamically because maps are created by users.

What does the proposed API look like?

Just like the map series. Use the name of a region to select where do you want it to be drawn unless coordinates are given:

series: [
      {
        type: 'scatter',
        geoIndex: 0,
        coordinateSystem: 'geo',
        data: [
          { name: 'Alabama', value: 4822023 }
        ]
      }
    ]

In this example 'Alabama' references a region so the bubble should be drawn inside of the Alabama's polygon.

jgoncab-arte avatar Jun 26 '24 09:06 jgoncab-arte

see official example for geo pies, note how 'Maine' is referenced by name. You could do the same by making one-value pies to mimic scatter points. 📌 please close issue if problem solved.

helgasoft avatar Jun 26 '24 19:06 helgasoft

It could be a good workaround but obviously the best option is that I could do the same with the scatter points. There are a few official examples of a scatter chart in a map so I think it would be really helpful. If it is not going to be considered, I would rather use https://www.npmjs.com/package/polylabel/v/1.1.0 instead of the pie chart.

jgoncab-arte avatar Jun 27 '24 13:06 jgoncab-arte