UNPKG

ng2-charts-schematics

Version:

ng2-charts schematics collection for generating chart components

43 lines (40 loc) 1.56 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 radarChartOptions: ChartOptions = { responsive: true, }; public radarChartLabels: Label[] = ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running']; public radarChartData: ChartDataSets[] = [ { data: [65, 59, 90, 81, 56, 55, 40], label: 'Series A' }, { data: [28, 48, 40, 19, 96, 27, 100], label: 'Series B' } ]; public radarChartType: ChartType = 'radar'; constructor() { } ngOnInit() { }`; const newMarkup = `<div style="display: block;"> <canvas baseChart [datasets]="radarChartData" [options]="radarChartOptions" [labels]="radarChartLabels" [chartType]="radarChartType"> </canvas> </div> `; const newImports = [ ['ChartDataSets, ChartOptions, ChartType', 'chart.js'], ['Label', 'ng2-charts'], ]; // You don't have to export the function as default. You can also have more than one rule factory // per file. function ng2ChartsRadar(_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.ng2ChartsRadar = ng2ChartsRadar; //# sourceMappingURL=ng2-charts-radar.js.map