-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hidden data not applied on Pie chart when new dataset is added #6746
Comments
I'm curious if you use this hiding feature much or how you found the issue? We were somewhat wondering if it'd make sense or be possible to make it a plugin |
@benmccann let me start with how I found the issue. Working on this CHARBA, project, a CHART.JS wrapper for GWT. I've decided to develop a plugin to manage HTML legend in the project, to provide out of the box for the developers who want to manage legend in HTML to have more flexibility. You know that to build it in CHART.JS, some steps are necessary and I'm gonna provide everything by a plugin. During my tests, I found this behavior. At the beginning I thought it was my mistake but, because I wasn't able to find out the bug, I decided to test also the sample of CHART.JS and I saw the same behavior. In another application that I'm developing, the users are using this feature and I think it's nice. In my opinion, it could be implemented into legend plugin. |
@benmccann We also use this feature for custom zooming (we are not using chartjs zoom plugin) In the initial load, chartjs only load aggregated data. When user zooms into specific date range, we bring the new data from backend, clear the chart and redraw it by new data. This help us to load huge timeseries data easily. If user chooses 6 months, we only bring every 1 hour aggregated data and every zoom can go into 1 minute intervals. Backend handles the intervals automatically based on the zoom range. So if user hides a data via legend, during the clear/redraw data, we check if there is any hidden data by legend, so we make it sure that it's still hidden when new zoom range is selected. Here is a demo via custom legends (using Datatables as a legend source): |
@yusufozturk I got an internal server error when trying to visit your link |
@benmccann Oh sorry, it's back again :) |
Thanks. Ok, yeah, that looks very similar to the initial report. You update the graph on zoom and want any datasets previously hidden to stay hidden. I think the main difference is that your case is a line chart and so hiding/showing happens per-dataset and not per-data-point like with a pie chart |
@benmccann Yes that's true. I thought "removing hidden property" will affect also our case. If it's not, sorry for taking your time :/ Thanks! |
Expected Behavior
When you add new dataset to an existing Pie chart and previously you hide a data by legend, the data at index (which should be hidden) shouldn't appear into chart.
Current Behavior
Using the CHART.JS sample. hiding a data of pie chart and then adding new dataset, the new dataset does not reflect the legend. See picture:
Possible Solution
Before updating a chart, check with the legend that the data will apply the legend.
Steps to Reproduce
Using the CHART.JS sample:
Environment
The text was updated successfully, but these errors were encountered: