echarts visualMap bug for multi series

hjzp0vay  于 2022-10-20  发布在  Echarts
关注(0)|答案(1)|浏览(225)

Version

4.7.0

Steps to reproduce

There are two line series, but only one of them is effected by visualMap. I find the other one seems also changes its color in tooltip.

the option is following:

{
  "color": ["#3fb1e3", "#6be6c1", "#626c91", "#a0a7e6", "#33b86c", "#96dee8"],
  "dataset": {
    "source": [
      {
        "down_threshold": -0.05,
        "mean_threshold": 0.09,
        "time": "2021-04-06 00:00:00.000",
        "up_threshold": 0.24,
        "value": 0.17279120676562648
      },
      {
        "down_threshold": -0.05,
        "mean_threshold": 0.09,
        "time": "2021-04-06 01:00:00.000",
        "up_threshold": 0.24,
        "value": 0.1918523077076779
      },
      {
        "down_threshold": -0.05,
        "mean_threshold": 0.09,
        "time": "2021-04-06 02:00:00.000",
        "up_threshold": 0.24,
        "value": 0.21198067458580033
      },
      {
        "down_threshold": -0.05,
        "mean_threshold": 0.09,
        "time": "2021-04-06 03:00:00.000",
        "up_threshold": 0.24,
        "value": 0.23904901094433784
      },
      {
        "down_threshold": -0.05,
        "mean_threshold": 0.09,
        "time": "2021-04-06 05:00:00.000",
        "up_threshold": 0.24,
        "value": 0.21231917196347566
      }
    ]
  },
  "series": [
    {
      "type": "line",
      "encode": { "x": "time", "y": "value" },
      "name": "结果值",
      "symbol": "none",
      "markLine": {
        "silent": true,
        "lineStyle": { "color": "red" },
        "data": [
          {
            "yAxis": 0.2,
            "label": { "formatter": "0.2(上限)", "position": "insideEndBottom" }
          },
          {
            "yAxis": 0.18,
            "label": {
              "formatter": "0.18(下限)",
              "position": "insideEndBottom"
            }
          }
        ]
      }
    },
    {
      "type": "line",
      "encode": { "x": "time", "y": "mean_threshold" },
      "name": "平均值",
      "symbol": "none"
    }
  ],
  "title": {
    "textStyle": { "color": "#aaa", "fontSize": 14 },
    "left": "center",
    "top": 10,
    "show": true,
    "text": "结果图"
  },
  "tooltip": {
    "trigger": "axis",
    "axisPointer": {
      "type": "cross",
      "label": { "backgroundColor": "#6a7985" }
    }
  },
  "xAxis": {
    "type": "category",
    "boundaryGap": false,
    "axisLine": {
      "lineStyle": { "color": "#efefef", "width": 1, "type": "solid" }
    },
    "axisTick": { "show": false },
    "axisLabel": { "color": "#9a9a9a" },
    "splitLine": { "show": false },
    "nameTextStyle": { "color": "#9a9a9a" }
  },
  "yAxis": {
    "type": "value",
    "axisLine": {
      "lineStyle": { "color": "#efefef", "width": 1, "type": "solid" }
    },
    "nameTextStyle": { "color": "#9a9a9a" },
    "axisTick": { "show": false },
    "axisLabel": { "color": "#9a9a9a" },
    "splitLine": { "show": true, "lineStyle": { "width": 1, "type": "dash" } }
  },
  "grid": { "show": false, "top": 50, "bottom": 50, "left": 45, "right": 22 },
  "legend": {
    "show": true,
    "left": "center",
    "top": "bottom",
    "textStyle": { "color": "#333" },
    "data": [
      { "name": "结果值", "textStyle": { "color": "#3fb1e3" } },
      { "name": "平均值", "textStyle": { "color": "#6be6c1" } }
    ]
  },
  "visualMap": [
    {
      "seriesIndex": 0,
      "type": "piecewise",
      "show": false,
      "pieces": [
        { "color": "red", "gte": 0.2 },
        { "color": "red", "lte": 0.18 }
      ],
      "outOfRange": { "color": "#3fb1e3" }
    },
    {
      "seriesIndex": 1,
      "type": "piecewise",
      "show": false,
      "pieces": [
        { "color": "red", "gte": 0.2 },
        { "color": "red", "lte": 0.18 }
      ],
      "outOfRange": { "color": "#6be6c1" }
    }
  ]
}

What is expected?

The two series should be both effected by visualMap.

What is actually happening?

One of the series is not effected by visualMap.

相关问题