要在Angular 8中使用ZingChart,您需要执行以下步骤:
npm install zingchart-angular
import { ZingChartModule } from 'zingchart-angular';
@NgModule({
imports: [
ZingChartModule
]
})
export class AppModule { }
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
chartData = {
type: 'bar',
series: [
{ values: [2, 4, 6, 8, 10] }
]
};
}
在上面的示例中,我们将图表类型设置为条形图,然后定义了一个系列,其中包含一组值。
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
chartData = {
type: 'bar',
series: [
{ values: [2, 4, 6, 8, 10] }
],
theme: 'dark',
title: {
text: 'My Chart'
}
};
}
在上述示例中,我们添加了一个主题选项,并设置图表的标题为"My Chart"。
这样,您就可以在Angular 8中使用ZingChart并设置值和其他一些设置了。