javascript - Echart图形不变色
问题描述
我正在尝试更改我的 eCharts 图表的颜色,但更改不适用。
这是我的代码:
this.option.series.push({
name: 'Real',
type: 'line',
symbol: 'triangle',
symbolSize: 10,
label: {
normal: {
show: true,
position: 'left'
}
},
lineStyle: {
color: 'transparent',
width: 2,
type: 'line'
},
itemStyle: {
color: 'green'
},
markLine: {
data: [
{
name: 'Limite',
yAxis: 500,
lineStyle:
{
color: 'red'
}
},
]
},
data: realData
});
当我尝试将此代码添加到 eCharts 片段(在此处的官方文档中)时,它可以工作,但不能在我的作品中使用。
我正在使用 Angular v8 和 echarts 3.8.5
解决方案
你想改变线条的颜色还是项目的颜色?
您可以查看此示例https://gallery.echartsjs.com/editor.html?c=xXbP45bsC
这里是一个系列的配置
{
name: '注册总量',
type: 'line',
// smooth: true, //是否平滑
showAllSymbol: true,
// symbol: 'image://./static/images/guang-circle.png',
symbol: 'circle',
symbolSize: 25,
lineStyle: {
normal: {
color: "#00ca95",
shadowColor: 'rgba(0, 0, 0, .3)',
shadowBlur: 0,
shadowOffsetY: 5,
shadowOffsetX: 5,
},
},
label: {
show: true,
position: 'top',
textStyle: {
color: '#00ca95',
}
},
itemStyle: {
color: "#00ca95",
borderColor: "#fff",
borderWidth: 3,
shadowColor: 'rgba(0, 0, 0, .3)',
shadowBlur: 0,
shadowOffsetY: 2,
shadowOffsetX: 2,
},
tooltip: {
show: false
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(0,202,149,0.3)'
},
{
offset: 1,
color: 'rgba(0,202,149,0)'
}
], false),
shadowColor: 'rgba(0,202,149, 0.9)',
shadowBlur: 20
}
},
data: [281.55, 398.35, 214.02, 179.55, 289.57, 356.14, ],
}
问候
推荐阅读
- javascript - 展开后的 GoJs 图正在改变滚动位置
- python - 我正在尝试通过 pyinstaller 将 .py 文件转换为 .exe 文件,但出现了此警告
- c++ - 在不使用 lib 函数的情况下将字符串复制到空字符串中
- windows-subsystem-for-linux - 无法在 ubuntu WSL 中运行 podman/docker hello-world,找不到 OCI
- anaconda - 无法在 Ubuntu 20.04 中打开 Anaconda 导航器(在加载应用程序时停止。但从不打开。)
- c - 为什么没有按照以下代码将结果存储到缓冲区中?
- angular - Flickity 在我使用 *NgFor 的那一刻停止工作
- visual-studio-code - 如何从状态栏中取消隐藏扩展?与代码
- javascript - Node JS通过管道重定向,chrome下载而不是播放
- reactjs - OpenID Connect + Django DRF + React:如何使用?