Closed blockjon closed 5 years ago
I must be doing something wrong.. not importing something correctly etc. Are there any examples of how to use this in es6 with react?
🤔 answered my own question: If I add this at the top of my file, it works:
import * as name from "chartjs-plugin-colorschemes";
Good to know that you have already solved the issue. For React, just import 'chartjs-plugin-colorschemes';
is fine.
do you know by any chance how to import colorschemes for an angular2+ project? I got many errors every way i try
Thank you very much in advance
import 'chartjs-plugin-colorschemes';
works in an Angular 2+ project as well.
thank you for your answer - i tried this ofc but no luck.
Iam starting to think - is this maybe for linecharts only? ;)
yes same here.. It does not works in angular 7.x I use pie chart..
Any idea ?
@osterland @efriandika Regarding Angular, if you are using this plugin with ng2-charts, it does not work because a color scheme is applied only when no colors are defined in a chart config but ng2-charts has default colors. In order to workaround this, I have added the override
option in 20c60e5, which enables to override the existing color settings with the specified color scheme. This change will be available in the next v0.4.0 release.
thanks @nagix
Had the same issue when using with Vue.js. @blockjon 's solution works.
import * as name from "chartjs-plugin-colorschemes";
But I do not understand why the instruction import "chartjs-plugin-colorschemes"
doesn't work. It seems to be a difference in the mechanism of importing modules. I am still new to JS, I would love to hear if anyone have identified the reason.
I love the idea behind this project... unfortunately I just tried it and it doesn't work. I followed the directions exactly as described and all of my metrics are all grey colored. There are also no errors.
chart.js version 2.7.3 chartjs-plugin-colorschemes version 0.1.0 installed with npm using react