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

Refreshing Data doesnt recal Trendline? #19

Closed wopag closed 5 years ago

wopag commented 5 years ago

Plugin works fine on drawing using the standard "config" but Im updating the chart data set after the initial draw

for (var index = 0; index < 12; ++index) { window.myLine.data.datasets[0].data[index] = newdata[index+12]; } window.myLine.update();

But the trendline disappears? - Ive done some tracing and the data is entering the plugin - but hte Y scale always comes out as a negative - so I presume its drawing off canvas?

wopag commented 5 years ago

Sorted. newdata[index+12] --- is actually a string - which updates jschart ok but not the plugin.

Fixed with a parseFloat( newdata[index+12] )