Skip to content

[Bug] Visual map for line chart does not work on dimensions higher than 1 #19270

Closed

Description

@jpfeuffer

Version

5.2.2

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?c=line-simple&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AG4CGANgK5W0A0JAvt-uRz4iqUmUo1YDFu1q9-sPFQBOEKoVgBtEulFjYAE0ZhGRTZoCMAVgAMnC_YC6nLdav2nLy1YAcnAEwBzq4AbHaB_o7OOqQU1HTMENAcMTwk0ej0-KwsALKMIGYxevqKKmp4AJLQBlQYRHYxYgYQALZU0HhQ0ESBTaQgagDG6kWlpUiwrUkNLq2M9bAWAHQOsEPAzMDKdABGbBywfP0TUzNLq3MLvS4bWztSylQGtEcK46ST0z2w_pdT11gAGZbpttnQAOZPDqvY4fDKkOGwaI8ADcQA

Steps to Reproduce

see example. super simple.

switch dimension to 1 to see how it should look like, since dimension 1 and 2 are actually the same.

Current Behavior

Does not color the lines

Expected Behavior

switch dimension to 1 to see how it should look like, since dimension 1 and 2 are actually the same.

Environment

All

Any additional comments?

option = {
  xAxis: {
    type: 'value',
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [[150,1,1], [155,1,1], [158,2,2], [160,2,2]],
      type: 'line'
    }
  ],
  visualMap: [
    {
        seriesIndex: 0,
        dimension: 2,
        pieces: [
            { min: 0, max: 1.1, color: 'blue' },
            { min: 1.1, max: 2, color: 'red' },
            { min: 2.1, max: 3, color: 'green' },
        ],
    },
  ],
};

Activity

  1. added
    en
    pending
    on Nov 2, 2023
  2. jpfeuffer commented on Nov 2, 2023

    @jpfeuffer
    Author

    Similar issues with no answers:
    #18629
    #11667

  3. frab90 commented on Nov 21, 2023

    @frab90

    any idea why this happens? have you already done any investigation @helgasoft ?

  4. Ovilia commented on May 16, 2024

    @Ovilia
    Contributor

    After cheching the source code, I think this is by-design instead of being a bug.

    For line series, the data dimensions are not arbitory, but instead, the first dimension means X and the second Y. So if visualMap takes a dimension other than X and Y, it makes to sense whether to map the color of line vertically or horizontally. Thus, only the first and seconds dimension should be allowed for visualMap.

  5. added and removed
    pending
    on May 16, 2024
  6. jpfeuffer commented on May 16, 2024

    @jpfeuffer
    Author

    Could we convert this into a feature request instead? Or is there a workaround on how to color different line segments of a series differently? Independently of their x/y dimensions.

  7. helgasoft commented on May 16, 2024

    @helgasoft

    is there a workaround on how to color different line segments of a series differently? Independently of their x/y dimensions.

    yes, custom lines - Demo. Colors could also come from a data column, then visualMap won't even be needed.
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions