Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

echart 散点图 无法改变颜色

有个需求是根据目标点名称来改变颜色,但是下面这样我怎么试都是默认的暗红色

       series: [
          {
            data: scatterData.seriesData,
            type: "scatter",
            tooltip: ...,
            itemStyle: {
              normal: {
                color: function(params) {
                  if (params.data[2] == "A点") {
                    // console.log("normal" + params.data[2]); //这里是可以打印出来A点的
                    return "blue";
                  } else {
                    return params.color;//#c23531 默认暗红色
                  }
                }
              }
            }
          }
        ]

而直接赋值颜色是可以的

color: 'blue'

求指点


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

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...