【发布时间】:2018-04-24 13:23:25
【问题描述】:
我正在尝试将 C3 Gauge Chart:http://c3js.org/samples/chart_gauge.html 集成到新的 Angular 5 应用程序中。
这是我的代码 chart.component.ts :
import { Component, OnInit, AfterViewInit } from '@angular/core';
import * as c3 from 'c3';
@Component({
selector: 'app-chart',
templateUrl: './chart.component.html',
styleUrls: ['./chart.component.css']
})
export class ChartComponent implements OnInit, AfterViewInit {
constructor() { }
ngOnInit() {
}
ngAfterViewInit() {
let chart = c3.generate({
bindto: '#chart',
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
]
}
});
}
}
这是我的 chart.component.html
<div id="chart"></div>
但我收到以下错误。
按照这里的内容并没有解决我的问题:How add C3 charts to angular 2+ project
【问题讨论】:
标签: javascript angular c3.js