From d32414f626d36b23940f999757a6a49e22102911 Mon Sep 17 00:00:00 2001 From: nixa <4dmitr@gmail.com> Date: Thu, 12 May 2016 18:36:51 +0300 Subject: [PATCH] baChartistChart component --- .../chartistJs/chartistJs.component.ts | 18 ++---- .../components/chartistJs/chartistJs.html | 61 ++++++++++++++++--- .../baChartistChart.component.ts | 34 +++++++++++ .../baChartistChart/baChartistChart.html | 1 + .../baChartistChart/baChartistChart.loader.ts | 1 + .../baChartistChart/baChartistChart.scss | 0 .../theme/components/baChartistChart/index.ts | 1 + src/app/theme/components/index.ts | 1 + 8 files changed, 94 insertions(+), 23 deletions(-) create mode 100644 src/app/theme/components/baChartistChart/baChartistChart.component.ts create mode 100644 src/app/theme/components/baChartistChart/baChartistChart.html create mode 100644 src/app/theme/components/baChartistChart/baChartistChart.loader.ts create mode 100644 src/app/theme/components/baChartistChart/baChartistChart.scss create mode 100644 src/app/theme/components/baChartistChart/index.ts diff --git a/src/app/pages/charts/components/chartistJs/chartistJs.component.ts b/src/app/pages/charts/components/chartistJs/chartistJs.component.ts index 3d7efa97..923d8797 100644 --- a/src/app/pages/charts/components/chartistJs/chartistJs.component.ts +++ b/src/app/pages/charts/components/chartistJs/chartistJs.component.ts @@ -2,6 +2,7 @@ import {Component, ViewEncapsulation} from '@angular/core'; import {BaCard} from '../../../../theme/components'; import {ChartistJsService} from "./chartistJs.service"; +import {BaChartistChart} from '../../../../theme/components'; @Component({ selector: 'chartist-js', @@ -9,9 +10,11 @@ import {ChartistJsService} from "./chartistJs.service"; providers: [ChartistJsService], encapsulation: ViewEncapsulation.None, styles: [require('chartist/dist/chartist.css'), require('./chartistJs.scss')], - directives: [BaCard], + directives: [BaCard, BaChartistChart], template: require('./chartistJs.html'), }) + +// TODO: service for the data export class ChartistJs { private simpleLineOptions = { @@ -196,19 +199,6 @@ export class ChartistJs { constructor(private _chartistJsService:ChartistJsService) { } - ngOnInit() { - new Chartist.Line('#line-chart', this.simpleLineData, this.simpleLineOptions); - new Chartist.Line('#area-chart', this.areaLineData, this.areaLineOptions); - new Chartist.Line('#bi-chart', this.biLineData, this.biLineOptions); - - new Chartist.Bar('#simple-bar', this.simpleBarData, this.simpleBarOptions); - new Chartist.Bar('#multi-bar', this.multiBarData, this.multiBarOptions, this.multiBarResponsive); - new Chartist.Bar('#stacked-bar', this.stackedBarData, this.stackedBarOptions); - - new Chartist.Pie('#simple-pie', this.simplePieData, this.simplePieOptions, this.getResponsive(20, 80)); - new Chartist.Pie('#label-pie', this.labelsPieData, this.labelsPieOptions); - new Chartist.Pie('#donut', this.simpleDonutData, this.simpleDonutOptions, this.getResponsive(5, 40)); - } getResponsive(padding, offset) { return [ diff --git a/src/app/pages/charts/components/chartistJs/chartistJs.html b/src/app/pages/charts/components/chartistJs/chartistJs.html index 761032e2..dc3e8378 100644 --- a/src/app/pages/charts/components/chartistJs/chartistJs.html +++ b/src/app/pages/charts/components/chartistJs/chartistJs.html @@ -3,22 +3,51 @@