Skip to content

chart.hide(datasetIndex, dataIndex) not hiding bar  #11450

Closed

Description

@Offbeatmammal

Expected behavior

per the docs, using chart.hide(0,3) should hide the third item in the first dataset

Current behavior

currently while chart.hide(0) correctly hides the dataset, chart.hide(0,3) seems to have no effect on a bar chart.

for a line chart it does remove the point, but doesn't reflow the line (still goes through the point)

Reproducible sample

https://codepen.io/offbeatmammal/pen/vYvBaav

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

I may be missing the intent of this function (in which case this may be better as a feature request) but I would like to be able to (temporarily) toggle individual items in a dataset on/off (eg when showing a list of countries toggle to only show German speaking ones) without having to splice and restore the datapoints

chart.js version

4.3.2

Browser name and version

No response

Link to your project

No response

Activity

  1. isafux commented on Feb 13, 2024

    @isafux

    This bug also exists exactly as described in newer chart.js version 4.4.1.
    A fix would very much be appreciated.

  2. EricWittrock commented on Apr 28, 2024

    @EricWittrock
    Contributor

    If no one else is already, I will work on this issue.

  3. linked a pull request that will close this issue#11450 hide bar by dataindex #11755on Apr 29, 2024
  4. added a commit that references this issue on Apr 29, 2024
  5. LecyQ commented on May 14, 2024

    @LecyQ

    I tried this but still does not hide the data. Am I missing something?

  6. alex-statsig commented on Nov 8, 2024

    @alex-statsig

    Was this issue / fix covering the issue described in #11319 (the fact that the hidden bar still takes up space)? Or is this a different issue pertaining to chart.hide not hiding it at all? @LeeLenaleee

  7. LeeLenaleee commented on Nov 8, 2024

    @LeeLenaleee
    Collaborator

    This was a different issue that it did not hid at all.

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