ngx-admin/src/app/pages/charts/chartjs/chartjs-pie.component.ts

57 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Component } from '@angular/core';
@Component({
2017-07-27 12:06:50 +03:00
selector: 'ngx-chartjs-pie',
styles: [
`
:host {
display: block;
}
`,
],
template: `
2017-07-27 12:06:50 +03:00
<canvas baseChart width="400" height="400"
[data]="chartData"
[labels]="chartLabels"
[options]="chartOptions"
[chartType]="chartType"></canvas>
`,
})
export class ChartjsPieComponent {
2017-07-27 12:06:50 +03:00
chartType: string = 'pie';
chartLabels: string[] = ['Download Sales', 'In-Store Sales', 'Mail Sales'];
chartData: number[] = [300, 500, 100];
chartOptions: any = {
responsive: true,
scales: {
2017-07-27 12:06:50 +03:00
xAxes: [
{
gridLines: {
display: true,
color: 'rgba(148,159,177,1)',
},
ticks: {
fontColor: 'white',
},
},
2017-07-27 12:06:50 +03:00
],
yAxes: [
{
gridLines: {
display: true,
color: 'rgba(148,159,177,1)',
},
ticks: {
fontColor: 'white',
},
},
2017-07-27 12:06:50 +03:00
],
},
legend: {
labels: {
fontColor: 'white',
},
},
};
}