The ng-2 charts library wraps the Charts.js library to make it easily accessible in Angular 2+.
Questions tagged [ng2-charts]
530 questions
69
votes
12 answers
NG2-Charts Can't bind to 'datasets' since it isn't a known property of 'canvas'
I am trying to use the basic example of NG2-Charts (http://valor-software.com/ng2-charts/)
I copy pasted the HTML part
38
votes
7 answers
Chart JS +ng2-charts not working on Angular+2
Hello developers i have been literally the whole day trying to implement charts on my proyect , but following the official docs there is not way i could rid off this error :
ERROR in ./node_modules/ng2-charts/__ivy_ngcc__/fesm2015/ng2-charts.js…

Enrique GF
- 1,215
- 3
- 16
- 35
33
votes
6 answers
How do I change the color for ng2-charts?
I have added ng2-charts to my project and display 2 charts - donut & barchart. both are displayed in gray since I added
to the…

edamerau
- 481
- 1
- 6
- 13
32
votes
2 answers
WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 "export 'ɵɵdefineInjectable' was not found in '@angular/core'
I am using ng2-charts in Angular 7 app and having warning
WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72
"export 'ɵɵdefineInjectable' was not found in '@angular/core'
error in VS Code
error in browser
What could be the…

WasiF
- 26,101
- 16
- 120
- 128
31
votes
16 answers
ng2-charts update labels and data
I'm trying to create dynamically a chart using ng2-chart,
I get information from an angular 2 service, when I change only labels of chart it works and when I change data only it works, but When I change both just data are updated in the chart. have…

mustafa918
- 498
- 1
- 6
- 15
24
votes
7 answers
How can I set the height of a chart with ng2-charts
How do I set a chart's height using ng2-charts? I'm making a line chart, just like the demo on the ng2-charts site.
I've searched the documentation for ng2-charts and chart.js. In chart.js it looks like you set a height property on the canvas…

BrandonReid
- 1,264
- 1
- 13
- 17
19
votes
2 answers
Change legend position of ng-charts (using angular2)
How do I change the position of the legend (that by default appears on top of the chart)? I'm using ng-charts, and I'm trying to change the position according to the documentation, but it does not seem to be working.
The template contains…

sridharan
- 2,011
- 10
- 36
- 61
15
votes
3 answers
Module not found: Error: Can't resolve 'chart.js' in /node_modules/ng2-charts/fesm2015'
I am encountering the error:
ERROR in ./node_modules/ng2-charts/fesm2015/ng2-charts.js
Module not found: Error: Can't resolve 'chart.js' in /node_modules/ng2-charts/fesm2015'
I did "npm install --save ng2-charts". Could you help me to understand why…

Andres
- 731
- 2
- 10
- 22
12
votes
3 answers
Angular 2 ng2-charts doughnut text in the middle?
I am using Doughnut chart from ng2-charts (http://valor-software.com/ng2-charts/) in angular 2.
I have been searching for an option to put a text in the middle without success.
I already searched in ng-chart options as in chart.js (dependency).
Do…

Ivan Juarez
- 1,413
- 4
- 21
- 30
11
votes
2 answers
How to create Data Labels with ng2-chart?
Well, here I am again with my Angular and javascript woes feeling dumber for each question I ask.
But let me try to explain my initial steps and how it lead to this problem. So, in my latest project, I wanted to throw some fancy charts to make…

ak.leimrey
- 1,137
- 2
- 11
- 25
11
votes
1 answer
Trying to set size of charts in ng2-charts
I am trying to set the size of my charts.
I have copy and pasted the ng2-chart example of the bar chart into my typescript file.
If I play around with the canvas :

Oliver Watkins
- 12,575
- 33
- 119
- 225
10
votes
1 answer
Angular2 ng2-chart customizations?
I have started to use angular2 ng2-chart. I have few questions regarding the below image which I created using angular2 ng2-chart but still want to do more customization:
Questions:
1) How can I draw a dotted-line between two points when there are…

Hassan Kashif
- 435
- 1
- 7
- 26
9
votes
1 answer
How to wrap X axis labels to multi-lines (X axis label formatting) in ng2-Charts?
How to wrap x axis labels in to multi-lines (2 lines) in a bar chart made by https://valor-software.com/ng2-charts/ ?
Expected Result should be like this. See the X axis labeling.
Ng2-charts is based on Chart.js and found following links (PRs) which…

Amila Iddamalgoda
- 4,166
- 11
- 46
- 85
9
votes
3 answers
ng2-charts: How to set fixed range for y axis
I have a chart.js chart using ng2-charts module. The chart shows Percentage on y axis and time on x axis. Is it possible to set y axis to show 0 to 100 instead of dynamic range based on data?

user2347528
- 580
- 1
- 8
- 22
9
votes
4 answers
How do I use plugins in ng2-charts?
I'm not sure how exactly to import a plugin into ng2-charts, specifically the annotation plugin. I'm using Angular2 / Ionic2. There doesn't seem to be any documentation or answers on this.

Daniel Engle
- 131
- 1
- 2
- 4