-
Notifications
You must be signed in to change notification settings - Fork 219
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
No label displayed #47
Comments
try this option?
|
Even with this code : |
My donut is presented like this in my ionic project ; I upload an ionic test project, so you can have a better idea of how to fix my issue, you can download the project here |
any solution to my issue? |
Hi, I ran project and got this error
|
weird, run then this command line in the root of the project |
or maybe it's cause this line is missing in the index.html file: <script src="node_modules/chart.js/src/chart.js"></script> |
You should import after Chart.js library load. in import { ChartsModule } from 'ng2-charts';
import 'chart.piecelabel.js'; // after 'ng2-charts' |
ok, I already made the imports in my real project, I made this test project quickly |
Have you found a solution to my trouble? |
I have the same issue in my Ionic project. No fixed yet. |
However I got this warning : Can not find Chart object This matchs with the following code in Chart.PieceLabel.js : Do you have an idea how to fix it ? |
ah, true that, I have the same warning, moreover, I have the error message "Failed to load resource: the server responded with a status of 404 (Not Found)" from the chart.js file, that might explain the absence of the labels on the dounught chart |
|
@emn178 Thanks for the feedback. I managed to resolve the warning and therefore the issue. My mistake was to import 'chart.piecelabel.js' in the app.component.ts itself like in this example: https://stackblitz.com/edit/doughnut-chart-6iuguq?file=app%2Fapp.component.ts and keep the import { ChartsModule } from 'ng2-charts'; in the app.module.ts. I think the import order was not right. To resolve the "Can not find Chart object" warning and the issue, I removed the line "import 'chart.piecelabel.js';" from the component app.component.ts and add the following lines in the app.module.ts: import { ChartsModule } from 'ng2-charts'; |
by importing the chart.js file, the labels finally appeared and I have no warning. About the app.components.ts file, I made no import, I imported the files in the page with the chart |
Hello, in version 0.9.0, no label is displayed in each slice, here you have my code :
html:
ts :
My code comes from this link, did I forget something? Thanks
Additional info : I'm in an Ionic project (version 3.91), my version of angular is 4.1.3 and my node version is 8.4.0
The text was updated successfully, but these errors were encountered: