可以在高宪章地图中包含地图线吗? [英] Is it possible to include maplines in highcharter maps?

查看:94
本文介绍了可以在高宪章地图中包含地图线吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在县集中使用一组borderColor和width值用于县,并在highcharter中使用另一组状态线来完成

I'd like to use one set of borderColor and width values for counties and another set for state lines in highcharter as done in this jsfiddle link.

series: [{
            mapData: countiesMap,
            data: data,
            joinBy: ['hc-key', 'code'],
            name: 'Unemployment rate',
            tooltip: {
                valueSuffix: '%'
            },
            borderWidth: 0.5,
            states: {
                hover: {
                    color: '#bada55'
                }
            }
        }, {
            type: 'mapline',
            name: 'State borders',
            data: [lines[0]],
            color: 'white'
        }, {
            type: 'mapline',
            name: 'Separator',
            data: [lines[1]],
            color: 'gray'
        }]

但是,我不了解数据结构,也看不到highcharter api如何做到这一点.这种地图可能吗?我的第一个直觉是在不填充状态边界的情况下添加多边形图层,但这似乎不是在highmaps/highcharts中使用的方法.

However, I don't understand the data structure and I don't see how the highcharter api allows this to be done. Is this kind of map possible? My first instinct was to add a polygon layer without fill for state borders but this doesn't seem to be the approach to use in highmaps/highcharts.

此处显示了我所追求的效果.大胆的州边界与较轻的县边界.抱歉,信誉不足,无法嵌入图像.

The effect I'm after is shown here. Bold state borders with lighter county borders. Sorry, not enough reputation to embed images.

推荐答案

基本上,这与Roco的回答是相同的,但是使用的是高级章程.

Basically this is same answer by Roco, but is using highcharter.

实时: http://rpubs.com/jbkunst/is可以在highcharter地图中包含地图行

代码:

library("highcharter")
library("viridisLite")
library("dplyr")

data(unemployment)
data(uscountygeojson)
data(usgeojson)
dclass <- data_frame(from = seq(0, 10, by = 2),
                     to = c(seq(2, 10, by = 2), 50),
                     color = substring(viridis(length(from), option = "C"), 0, 7))
dclass <- list.parse3(dclass)
highchart(type = "map") %>% 
  hc_add_series_map(uscountygeojson, unemployment, value = "value", joinBy = "code",
                    lineWidth = 0.5, color = hex_to_rgba("#000000", 0.75)) %>% 
  hc_add_series(data = uscountygeojson, type = "mapline",
                lineWidth = 2, color = hex_to_rgba("#000000", 0.75)) %>% 
  hc_colorAxis(dataClasses = dclass)

希望有帮助.

感谢您使用该软件包!

这篇关于可以在高宪章地图中包含地图线吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆