8👍
✅
Change your chart.js
to
<script src="node_modules/chart.js/dist/Chart.bundle.min.js"></script>
app module ts code
import { ChartsModule } from 'ng2-charts/ng2-charts';
// In your App's module:
imports: [
ChartsModule
]
Update
remove script tag in index.html and add in
check your angular-cli.json and scripts array, then inside it add:
“../node_modules/chart.js/dist/Chart.bundle.min.js”
1👍
Aside adding the chart.js
file to .angular-cli.json
, you’re only missing the chartType
passed as an input to baseChart
.
<canvas baseChart
[chartType]="'horizontalBar'"
[data]="chartData"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
0👍
import { ChartsModule } from ‘ng2-charts/ng2-charts’;
// In your App’s module:
imports: [
ChartsModule
]
Source:stackexchange.com