伪代码
`
myChart.setOption({
title: {
text: "",
},
tooltip: {
trigger: "axis",
},
legend: {
data: [
"DDM1-uA", //ddmLine1
"DDM2-uA", //ddmLine2
],
// bottom:0,
},
xAxis: {
name: "水平距离",
type: "value",
axisLabel: {
formatter: "{value}" + this.uom,
},
axisLine: {
onZero: false, //x轴是否要在0刻度线上
},
splitLine: { show: false }, //是否有单位分割线
},
yAxis: {
name: "偏离指针驱动电流",
type: "value",
min: -40,
max: 40,
axisLabel: {
formatter: "{value} μA",
},
minorTick: {
show: true, //y轴刻度线
},
minorSplitLine: {
show: true, //分割线
},
},
visualMap: [
{
type: "piecewise",
seriesIndex: "3",
show: true,
dimension: 0,
pieces: ddmArr1,
},
],
series: [
{
name: "DDM1-uA", //折线名称
data: xyForm(obj.ddmLine1), //绑定数据
type: "line", //折线类型
smooth: false, //光滑处理
showSymbol: false, //不显示点
color: "#FF0000",
itemStyle: {
normal: {
lineStyle: {
width: 1,
},
},
},
},
{
name: "DDM2-uA", //折线名称
data: xyForm(obj.ddmLine2), //绑定数据
type: "line", //折线类型
smooth: false, //光滑处理
showSymbol: false, //不显示点
color: "Magenta",
itemStyle: {
normal: {
lineStyle: {
width: 1,
},
},
},
},
],
});
`
两条线的data结构类似 [[0,1],[1,5],[4,9]]....
我用visualMap只能通过x轴的范围改变,假设我想改变 第二个点到五个点这段线的颜色(而不是第二个点到第五个点的x轴范围),应该怎么做?
看看
markLine