Keep legend length in sync with data length
Keep legend length in sync with data length

If you have a line chart that's data prop has a dataset value with a variable length of objects (eg a chart with a non-constant number of legend items), the original updateChart can only account for datasets that are growing in size, not shrinking. I added a quick check to the updateChart function that pops out the extraneous array values, if necessary. This saves you from having to call redraw over and over and can make your app run much smoother.
jerairrest/react-chartjs-2,jerairrest/react-chartjs-2