option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'line',
lineStyle: {
color: 'rgba(0,0,0,0.2)',
width: 2,
type: 'solid'
}
}
},
series: [
{
type: 'themeRiver',
emphasis: {
itemStyle: {
shadowBlur: 20,
shadowColor: 'rgba(0,0,0,0.8)'
}
},
data: [
['2015/11/08', 10, 'DQ'],
['2015/11/09', 15, 'DQ'],
['2015/11/10', 35, 'DQ'],
// More data...
['2015/11/08', 21, 'TY'],
['2015/11/09', 25, 'TY'],
['2015/11/10', 45, 'TY'],
// More data...
],
label: {
show: true
},
itemStyle: {
emphasis: {
shadowBlur: 20,
shadowColor: 'rgba(0,0,0,0.8)'
},
normal: {
shadowBlur: 10,
shadowColor: 'rgba(0,0,0,0.5)'
}
},
color: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452']
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
在这个例子中,type: 'themeRiver' 表示这是一个主题河流图。data 数组包含了主题河流图的数据,每个数据项是一个数组,表示时间、数值和主题。
其他一些常用的配置选项包括:
- label: 控制标签的显示,例如 { show: true } 表示显示标签。
- itemStyle: 控制图形样式,包括高亮时的样式和普通样式。
- emphasis: 高亮时的配置,可以设置阴影等效果。
- color: 主题河流图的颜色配置。
你可以根据实际需求调整这些配置选项,以满足你的图表设计需求。
转载请注明出处:http://www.zyzy.cn/article/detail/5449/ECharts