Google Geocharts: Regions and Markers on same map?

2019-04-06 12:06发布

I'm experimenting with Google's GeoCharts. I have state data and city data that I want to display over the city data. This means I want to use the geochart regions and markers display mode at the same time. Can this be done, or faked? I can't seem to find a way but was wondering if anyone else has had success.

5条回答
Animai°情兽
2楼-- · 2019-04-06 12:27

with some CSS hacking you can use the markers mode and color the region you want. It's not easy, you would have to know wich 'child' path of the svg map you want to color and make advanced css rules.

For example:

#map_canvas path:nth-child(57) {
fill:#cccccc;
}

Check out the last example of this page, from my website: http://cmoreira.net/interactive-world-maps-demo/advanced-customization/

Hope it helps! Cheers

查看更多
爷的心禁止访问
3楼-- · 2019-04-06 12:39

or maybe put one chart with type "marker" over another of type "region" ? :)

查看更多
来,给爷笑一个
4楼-- · 2019-04-06 12:40

As stated in documentation mode parameter could be region or marker. So they could not be used together. I would recommend you to try jVectorMap library which supports such kind of behavior.

查看更多
姐就是有狂的资本
5楼-- · 2019-04-06 12:44

VectorWorkz GeoChart lets you define region color binding and marker binding within the same instance, take a look at the VectorWorkz online demo.

查看更多
兄弟一词,经得起流年.
6楼-- · 2019-04-06 12:47

I could do it by overlapping two charts one for region, one for markers (using absolute divs with z-index)

you need to use transparent color as style for the marker layer backgroundColor: 'transparent', datalessRegionColor: 'transparent', defaultColor: 'transparent' and put it on the top layer

查看更多
登录 后发表回答