Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
479 views
in Technique[技术] by (71.8m points)

echarts折线图怎么设置点和点之间的颜色?

伪代码
`

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轴范围),应该怎么做?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

看看markLine


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.7k users

...