apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
59.28k stars 19.57k forks source link

[Bug] 折线图visualMap里的维度dimension设为非当前系列的值,点的颜色正常,线的颜色没变 #19936

Closed LZF-fe closed 2 weeks ago

LZF-fe commented 2 weeks ago

Version

5.5.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html?c=line-sections&version=5.5.0

Steps to Reproduce

场景:根据维度1的数据生成折线图数据,根据维度2的数据改变点和线的颜色

const reasonData = [
  {x: '1', power: 93, state: 1},
  {x: '2', power: 95, state: 3},
  {x: '3', power: 97, state: 1},
  {x: '4', power: 95, state: 3},
  {x: '5', power: 93, state: 1},
]
option = {
  xAxis: {
    type: 'category',
    boundaryGap: false,
  },
  yAxis: {
    type: 'value',
  },
  dataset: {
    dimensions: ['x', 'power', 'state'],
    source: reasonData
  },
  visualMap: [
    {
        show: false,
        dimension: 2,
        // seriesIndex: 0, // 第一部分数据
        pieces: [
            { min: 0, max: 2, color: "red" },
            { min: 2, color: "green" },
        ],
        outOfRange: {  // 不在范围内的
            color: "yellow"
        }
    }
  ],
  series: [
    {
      name: '电量',
      type: 'line',
    }
  ]
};

Current Behavior

折线点的颜色符合预期,但是线的颜色却没变化 image

Expected Behavior

折线图的点和线都应该根据state的值变化成相应的颜色

Environment

- OS:Windows10
- Browser:Chrome 124.0.6367.202(正式版本) (64 位)
- Framework:react18.2

Any additional comments?

No response

echarts-bot[bot] commented 2 weeks ago

@LZF-fe It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED
**TITLE** [Bug] When the dimension in the line chart visualMap is set to a value other than the current series, the color of the points is normal and the color of the line has not changed. **BODY** ### Version 5.5.0 ### Link to Minimal Reproduction https://echarts.apache.org/examples/zh/editor.html?c=line-sections&version=5.5.0 ### Steps to Reproduce **Scenario: Generate line chart data based on data in dimension 1, and change the color of points and lines based on data in dimension 2** ``` const reasonData = [ {x: '1', power: 93, state: 1}, {x: '2', power: 95, state: 3}, {x: '3', power: 97, state: 1}, {x: '4', power: 95, state: 3}, {x: '5', power: 93, state: 1}, ] option = { xAxis: { type: 'category', boundaryGap: false, }, yAxis: { type: 'value', }, dataset: { dimensions: ['x', 'power', 'state'], source: reasonData }, visualMap: [ { show: false, dimension: 2, // seriesIndex: 0, // first part of data pieces: [ { min: 0, max: 2, color: "red" }, { min: 2, color: "green" }, ], outOfRange: { // Not within the range color: "yellow" } } ], series: [ { name: 'Battery', type: 'line', } ] }; ``` ### Current Behavior The color of the polyline points is as expected, but the color of the line has not changed. ![image](https://github.com/apache/echarts/assets/51901783/68a811c1-99e3-4ecc-9694-84bf481b4de7) ### Expected Behavior The points and lines of the line chart should change to corresponding colors based on the state value. ### Environment ```markdown -OS:Windows10 - Browser:Chrome 124.0.6367.202 (official version) (64-bit) - Framework:react18.2 ``` ### Any additional comments? _No response_
helgasoft commented 2 weeks ago

duplicate of #19270, visualMap dimension can't be >1 for lines, it's an old bug