Makanz / chartjs-plugin-trendline

This plugin draws an linear trendline in your Chart. Made for Chart.js > 3.0
MIT License
84 stars 59 forks source link

A chart with no datapoints breaks when trying to render a trend line #42

Closed VoxSecundus closed 3 years ago

VoxSecundus commented 3 years ago

If I render a chart where all of its datasets are empty, or if I empty the dataset of a chart already rendered, the chart will bork and no longer allow itself to be modified. This only occurs when trendlineLinear is included in the options. The browser console spits out:

Uncaught TypeError: t.data[0] is undefined

It would be nice if, on such an occasion, the trendline simply didn't render.