UNPKG

ng2-charts-schematics

Version:

ng2-charts schematics collection for generating chart components

39 lines (37 loc) 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const schematics_1 = require("@angular-devkit/schematics"); const ng2_process_tree_1 = require("./ng2-process-tree"); const newCode = `public doughnutChartLabels: Label[] = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales']; public doughnutChartData: MultiDataSet = [ [350, 450, 100], [50, 150, 120], [250, 130, 70], ]; public doughnutChartType: ChartType = 'doughnut'; constructor() { } ngOnInit() { }`; const newMarkup = `<div style="display: block;"> <canvas baseChart [data]="doughnutChartData" [labels]="doughnutChartLabels" [chartType]="doughnutChartType"> </canvas> </div> `; const newImports = [ ['ChartType', 'chart.js'], ['Label, MultiDataSet', 'ng2-charts'], ]; // You don't have to export the function as default. You can also have more than one rule factory // per file. function ng2ChartsDoughnut(_options) { // console.log('options', _options); return schematics_1.chain([ schematics_1.externalSchematic('@schematics/angular', 'component', _options), (tree, _context) => ng2_process_tree_1.ng2ProcessTree(tree, _context, _options, newCode, newMarkup, newImports) ]); } exports.ng2ChartsDoughnut = ng2ChartsDoughnut; //# sourceMappingURL=ng2-charts-doughnut.js.map