Skip to content

[Bug] Toggling y-axis in multi-y-axis chart doesn't update datazoom min/max correctly #20791

Open

Description

@tking5

Version

5.6.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?code=MYGwpgZgLgBAvDA5AIwE4HsDuA7RBuAKGFQEsBzAC1gRRAFcx8CAPAQ2fhhgG1EBZdLgA0SACoNEIxAHUwAE0liKdRYgBipVQGVWUbXVwBdAugAOUEoM4BvAl2DoQ6VAC4eoSFBHFyVQ0LsYKHRHZHRmN2sYQK4SB2wtKABPcEiw1DkwVABhR2c3H0ooAF8Ari4IMF06VDBImDldVgAtEIBbSOKYLsDSwODHC1NOsphwMjBsORHAslJpnmtSmCX_QMaoFvbImKCk0zqYACIAZxASTNQj0YqSECgsgUy3I-xBMGvdpIBBZhITgCSUzAER4AAYRABGNblMaeF5ggCkny4fS4zF-_zc3F2tlhXA2rDcbGYN3KcwuQMyoIhuy46AgEBOYCgbkhAFYyVx2P8ADKsZBgED1BxOVwwDzQbq7NHlPH4wnE9hcmAUuRUkFslU8k78wXClYSvLiwpUaWw4qBGEwH5_E7Y3HRfGq-Yamnau16oUi40FcBSy0Wsny2Fqt1aukwUzoE4kCyCNyIUhFSSRnVeg1RUX5CXJs2y1FW0bM0hge08XGR7CsNqHRC8zyp52KngciEwABMAGZ2x2OwAWEQdyEADihXc5MEh_YA7EOAGxg62w5IHRPnbCMGXBqs1usAJV8ehVLe4kLBvd7HahY6nXZEs5Ei-X5VXdY3jBVGLt4anKtt_y_pCMpWgQxR4EAA

Steps to Reproduce

  1. Have a chart with 2 or more y-axis with differing min/max & minValue/maxValue
  2. Toggle first y-axis off in legend
  3. y-axis datazoom doesn't update min/max labels.

Current Behavior

Datazoom with >2 y-axis doesn't account for both axes, it always defaults to the first. The values don't update when first axis is toggled, currently they get reset to NaN.

Expected Behavior

The min/max value should be global for all y-axis when both are included in yAxis array of dataZoom. Datazoom labels should update when first y-axis is toggled.

Environment

- OS: macOS Sequoia
- Browser: Chrome
- Framework:

Any additional comments?

No response

Activity

  1. added
    en
    pending
    on Feb 25, 2025
  2. helgasoft commented on Feb 25, 2025

    @helgasoft

    This code will work as expected with feature.dataZoom.
    But you'll lose the regular dataZoom. And be aware of this bug #20265 when selecting too narrow X area.

  3. tking5 commented on Feb 25, 2025

    @tking5
    Author

    Sure, but the slider dataZoom issue still remains.

  4. helgasoft commented on Feb 26, 2025

    @helgasoft

    actually for me step 3 does not reproduce.
    There is one visible blue y-axis that do update values dynamically thru dataZoom slider, as expected.
    BTW two grids are not necessary, one is sufficient.

  5. tking5 commented on Feb 26, 2025

    @tking5
    Author

    The axis is fine but the handle labels on the dataZoom do not update when the first entry of the legend is toggled off for me still. The dataZoom functions correctly with clipping the axis/data but doesn't update its handle labels/details. Internally the min/max & minValue/maxValue of the dataZoom do not update correctly when the legend toggles, not the axis (this works as expected). A temporary workaround I have is adjusting the yAxisIndex of the array when the legend is toggled by binding to the "legendselectchanged" event and manually updating it myself, though this feels like it should be the default behavior.

    Related, the dataZoom min/max (again not the axes, just the zoom) do not correctly account for the min/max of all axes listed in the yAxisIndex array, it seems to default to the first index.

  6. helgasoft commented on Feb 26, 2025

    @helgasoft

    handle labels on the dataZoom do not update when the first entry of the legend is toggled off

    Aah, your code does not have handleLabel, that's why I did not understand.
    Now I see the problem and your workaround - Demo. It could be considered a bug, I added it to the list in #20392.

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

    bugenpending

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions