
echarts不同点颜色设置
本文针对百度 echarts 点的不同颜色设置问题进行解答。
示例:(并非广告)
[echarts 示例](http://echarts.bdu.com/examples/editor.html?c=effectscatter-bmap)
如图所示,如何实现不同点的不同颜色,比如北京为红色,武汉为绿色?
解决方法:
查看 echarts api 文档。在 series 中,可以使用 itemstyle 设置点样式,其中 color 属性可以指定点的颜色。例如:
option = {
series: {
type: 'scatter',
itemStyle: {
// 普通样式
normal: {
// 点的颜色
color: 'red'
},
// 高亮样式
emphasis: {
// 高亮时点的颜色
color: 'blue'
}
},
label: {
// 普通样式
normal: {
show: true,
// 标签的文字
formatter: 'This is a normal label.'
},
// 高亮样式
emphasis: {
show: true,
// 高亮时标签的文字
formatter: 'This is a emphasis label.'
}
}
}
}
登录后复制
以上就是如何使用 Echarts 设置不同点颜色?的详细内容,更多请关注米云其它相关文章!
