question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple series of map is not displayed all together

See original GitHub issue

Version: 3.4.0

I have two series where each of them is showing different country (with different color). The issue is that I don’t seem to be able to show both series together. The second series is visible only if the first is switched off:

map-legend-issue

Here is the code:

option = {
    "color": [
        "#2196f3",
        "#e91e63"
    ],
    "legend": {
        "data": [
            "Category 1",
            "Category 2"
        ]
    },
    "geo": {
        "map": "world",
        "scaleLimit": {
            "min": 10
        },
        "center": [
            "5",
            "50"
        ]
    },
    "series": [
        {
            "map": "world",
            "name": "Category 1",
            "type": "map",
            "scaleLimit": {
                "min": 10
            },

            "center": [
                "5",
                "50"
            ],
            "data": [
                {
                    "name": "United Kingdom",
                    "category": "Category 1",
                    "itemStyle": {
                        "normal": {
                            "areaColor": "#2196f3"
                        },
                        "emphasis": {
                            "areaColor": "rgb(81, 173, 246)"
                        }
                    },
                    "value": "100"
                }
            ]
        },
        {
            "map": "world",
            "name": "Category 2",
            "type": "map",
            "scaleLimit": {
                "min": 10
            },
            "center": [
                "5",
                "50"
            ],
            "data": [
                {
                    "name": "Czech Republic",
                    "category": "Category 2",
                    "itemStyle": {
                        "normal": {
                            "areaColor": "#e91e63"
                        },
                        "emphasis": {
                            "areaColor": "rgb(238, 76, 131)"
                        }
                    },
                    "value": "5"
                }
            ]
        }
    ]
}

Seems previous series are overlaying following series? Although I’ve tried to set non active area color to transparent with no success. I’ve also tried to set zLevel, played with visualMap (which actually shows the country but doesn’t apply custom color… )

Any ideas? Or is this a bug?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
100pahcommented, Feb 7, 2017

@jarben Yes I can implement it using visualMap like this: (although the emphasis setting seems to be a little ugly)

option = {
    "color": [
        "#2196f3",
        "#e91e63"
    ],
    visualMap: {
        type: 'piecewise',
        dimension: 1,
        top: 0,
        left: 'center',
        orient: 'horizontal',
        categories: ['Category 1', 'Category 2'],
        hoverLink: false,
        inRange: {
            color: {
                "Category 1": "#2196f3",
                "Category 2": "#e91e63"
            }
        }
    },
    "series": [
        {
            "map": "world",
            "name": "Category 1",
            "type": "map",
            "scaleLimit": {
                "min": 10
            },
            "center": [
                "5",
                "50"
            ],
            "data": [
                {
                    "name": "United Kingdom",
                    "value": [6, "Category 1"],
                    "itemStyle": {
                        "emphasis": {
                            "areaColor": "rgb(81, 173, 246)"
                        }
                    },                    
                },
                {
                    "name": "Czech Republic",
                    "value": [5, "Category 2"],
                    "itemStyle": {
                        "emphasis": {
                            "areaColor": "rgb(238, 76, 131)"
                        }
                    }                    
                }                
            ]
        }
    ]
}
0reactions
AnrichVScommented, Mar 10, 2019

Thanks for these workarounds, I’m having the same issue. It would be awesome if the following was possible:

  • 2 or more series of type map (showing on the same map)
  • Each series with its own visualMap, so that each series can be mapped to different colors, and controlled independently
  • All of the series visible at the same time (if they overlap, for example US appears in more than one series, I don’t even expect colors to mix, the one added latest can take precedence. As long as all those that don’t overlap show at the same time).

I doubt I’ll have time to do this myself, but if I manage to I’ll make a pull request and comment it here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple series of map is not displayed all together #5006
Version: 3.4.0 I have two series where each of them is showing different country (with different color). The issue is that I don't...
Read more >
Map Chart - Multiple Series
Map Chart - Multiple Series ... For filled map we naturally can't show multiple series at once, here is one of the ways...
Read more >
Maps Cannot be Displayed in Tableau!! How do I Fix This?
There are several reasons why your Tableau map is not displaying – probably; You've assigned the wrong geographical role or Used the wrong ......
Read more >
Problem: Datasets do not line up when added to ArcMap
After adding several datasets to an ArcMap Data Frame, features in some layers do not align correctly with other layers. Cause. When adding...
Read more >
The aerial Bing map is not displayed in Civil 3D and ...
Either move all data to the correct range or create a custom coordinate system with the corresponding shift. For versions 2015 to 2018...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found