feat(charts): add the charts demos

This commit is contained in:
Alexander Zhukov 2017-07-27 12:06:50 +03:00
parent cf9ccf1850
commit dd7acac528
25 changed files with 925 additions and 228 deletions

View file

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
@Component({
selector: 'ngx-chart-js-bar',
selector: 'ngx-chartjs-bar',
styles: [
`
:host {
@ -11,16 +11,15 @@ import { Component } from '@angular/core';
],
template: `
<canvas baseChart
[datasets]="barChartData"
[labels]="barChartLabels"
[options]="barChartOptions"
[legend]="barChartLegend"
[chartType]="barChartType"></canvas>
[datasets]="chartData"
[labels]="chartLabels"
[options]="chartOptions"
[legend]="chartLegend"
[chartType]="chartType"></canvas>
`,
})
export class ChartjsBarComponent {
barChartOptions: any = {
chartOptions: any = {
scaleShowVerticalLines: false,
responsive: true,
legend: {
@ -29,36 +28,35 @@ export class ChartjsBarComponent {
},
},
scales: {
xAxes: [{
gridLines: {
display: true,
color: 'rgba(148,159,177,1)',
xAxes: [
{
gridLines: {
display: true,
color: 'rgba(148,159,177,1)',
},
ticks: {
fontColor: 'white',
},
},
ticks: {
fontColor: 'white',
],
yAxes: [
{
gridLines: {
display: true,
color: 'rgba(148,159,177,1)',
},
ticks: {
fontColor: 'white',
},
},
}],
yAxes: [{
gridLines: {
display: true,
color: 'rgba(148,159,177,1)',
},
ticks: {
fontColor: 'white',
},
}],
],
},
};
barChartLabels: string[] = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
barChartType: string = 'bar';
barChartLegend: boolean = true;
barChartData: any[] = [
chartLabels: string[] = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
chartType: string = 'bar';
chartLegend: boolean = true;
chartData: any[] = [
{ data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A' },
{ data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B' },
];
}