Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This doesn't work #4

Closed
blockjon opened this issue Nov 21, 2018 · 10 comments
Closed

This doesn't work #4

blockjon opened this issue Nov 21, 2018 · 10 comments

Comments

@blockjon
Copy link

blockjon commented Nov 21, 2018

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

image

image

@blockjon
Copy link
Author

I must be doing something wrong.. not importing something correctly etc. Are there any examples of how to use this in es6 with react?

@blockjon
Copy link
Author

🤔 answered my own question: If I add this at the top of my file, it works:

import * as name from "chartjs-plugin-colorschemes";

@nagix
Copy link
Owner

nagix commented Nov 21, 2018

Good to know that you have already solved the issue. For React, just import 'chartjs-plugin-colorschemes'; is fine.

@osterland
Copy link

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

@nagix
Copy link
Owner

nagix commented Jan 19, 2019

import 'chartjs-plugin-colorschemes'; works in an Angular 2+ project as well.

@osterland
Copy link

thank you for your answer - i tried this ofc but no luck.

Iam starting to think - is this maybe for linecharts only? ;)

@efriandika
Copy link

yes same here..
It does not works in angular 7.x
I use pie chart..

Any idea ?

@nagix
Copy link
Owner

nagix commented May 27, 2019

@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.

@felipefialho
Copy link

thanks @nagix

@alanhyue
Copy link

alanhyue commented Jan 31, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants