Makanz / chartjs-plugin-trendline

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

Error when there is less than two non-null values #84

Open jasmine-q opened 9 months ago

jasmine-q commented 9 months ago

When the data array contains a single non-null value I get this error: Uncaught TypeError: Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': The provided double value is non-finite.

This also occurs if the data array is all null values.

Please see code example here: https://codesandbox.io/s/working-trendline-forked-dm6z2x?file=/src/index.js

Thanks

Makanz commented 5 months ago

Please try the latest version 2.1.0