英文:
Echarts change color for type: pie
问题
I use this kind of chart - https://echarts.apache.org/examples/en/editor.html?c=dataset-link
If I add to the first item for series color red (line:22), so the code looks like:
{
type: 'line',
color: 'red',
smooth: true,
seriesLayoutBy: 'row',
emphasis: { focus: 'series' }
},
It changes the color only in the chart but not in the pie, thank you for solution
我使用这种类型的图表 - https://echarts.apache.org/examples/en/editor.html?c=dataset-link
如果我在第一个系列的项目中添加红色(第22行),那么代码如下所示:
{
type: 'line',
color: 'red',
smooth: true,
seriesLayoutBy: 'row',
emphasis: { focus: 'series' }
},
这只会改变图表中的颜色,而不会影响饼图,感谢您的解决方案。
英文:
I use this kind of chart - https://echarts.apache.org/examples/en/editor.html?c=dataset-link
If I add to the first item for series color red (line:22), so the code looks like:
{
type: 'line',
color: 'red',
smooth: true,
seriesLayoutBy: 'row',
emphasis: { focus: 'series' }
},
It changes the color only in the chart but not in the pie, thank you for solution
答案1
得分: 1
改变全局颜色调色板,而不是为每个系列更改颜色。
以下是基于您提供的示例的示例:
option = {
...
//设置全局颜色调色板
color: ['#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae',
'#749f83', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3'],
series: [
...
]
}
英文:
Change the global color palette instead of changing colors for each series.
Here is an example based on the one you gave.
option = {
...
//Set the global color palette
color: ['#c23531','#2f4554','#61a0a8','#d48265','#91c7ae',
'#749f83','#ca8622','#bda29a','#6e7074','#546570','#c4ccd3'],
series : [
...
]
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论