On re-render or redraw save the state of dataset and sires that was hidden Chart.js V2
Hi, I using chart.js V2 with Angular, My problem currently is that when I hide some sires on my graph, and then change the date of the graph(the graph renders ok with specific data for the selected day, but the graph shows all sires again instead to show only the sires that had stayed visible). As I understand currently it not save or store the state of hided sires and legends that was hided previously. Maybe I missing some option on the Chart.js documentation. Here small video of the behavior: http://screencast.com/t/e2Y7lqtxJ1Iu Thanks.
are you recreating the chart?
Yes,
On Sep 22, 2016 10:43 PM, "Evert Timberg" [email protected] wrote:
are you recreating the chart?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chartjs/Chart.js/issues/3344#issuecomment-249007467, or mute the thread https://github.com/notifications/unsubscribe-auth/AFEGqRnI2VMsU52sNKYZr5BisvJwWwAkks5qstpfgaJpZM4KDi_v .
You need to add hidden: true to any datasets that were hidden previously.
where exactly I need to add this ?
Thanks in advance
Misha Beskin ():-)
Email: [email protected] [email protected] Website:www.feedbacksign.com Skype: Misha Beskin
Phone: +972545203269
On Sat, Sep 24, 2016 at 3:11 AM, Evert Timberg [email protected] wrote:
You need to add hidden: true to any datasets that were hidden previously.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chartjs/Chart.js/issues/3344#issuecomment-249329869, or mute the thread https://github.com/notifications/unsubscribe-auth/AFEGqVZPO8op7AojrZbB3gwx62qjqzykks5qtGq3gaJpZM4KDi_v .
Inside the datasets in the data object. To determine the visibility of a dataset in the chart you can use chartInstance.isDatasetVisible(datasetIndex)
@MishaBeskin recreating the chart is usually not a good way to update data. Instead, you can update the datasets data object and call chart.update(). Hopefully it should fix your issue without dealing with saving the previous states.
Closing as answered