Makanz / chartjs-plugin-trendline

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

Auto register plugin only when global Chart is available #29

Closed Coriou closed 4 years ago

Coriou commented 4 years ago

Basically, can use this plugin as a regular plugin (import, register, use) while keeping the current behaviour of auto-registering itself in the browser when it can.

My use case here is I'm using a server side ChartJS renderer and in this context there's no global "Chart" object.

I've updated the readme as well to document the two ways of using the plugin.

Makanz commented 4 years ago

Thanks for your contribution. Sorry for my slow reply to your PR.