import { Component, OnInit } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
@Component({
selector: 'app-base-pie-chart',
templateUrl: './base-pie-chart.component.html',
styleUrls: ['./base-pie-chart.component.scss']
})
export class BasePieChartComponent implements OnInit {
constructor(
private message: NzMessageService
) { }
ngOnInit() {
}
typeScriptCode = `import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-base-pie-sub-chart',
template: \`
\`,
styleUrls: ['./base-pie-sub-chart.component.scss']
})
export class BasePieSubChartComponent implements OnInit {
constructor() { }
chartData = [];
seriesName = "";
radius = "";
ngOnInit() {
this.initChart()
}
initChart() {
this.seriesName = "区域声环境质量等级比例"
this.radius = "70%"
this.chartData = [
{ value: 123, name: '一级' },
{ value: 311, name: '二级' },
{ value: 102, name: '三级' },
{ value: 28, name: '四级' },
{ value: 8, name: '五级' }
]
}
}`;
htmlCode = `import { ChartModule } from 'bcac-lib/business-component/chart'
@NgModule({
imports: [
ChartModule
]
})`;
copied($event) {
if ($event.isSuccess) {
this.message.success('复制成功');
}
}
apiData = [
{ param: "[bcacChartTitleText]", desc: "图形标题", type: "string", defaultValue: '图表名' },
{ param: "[bcacChartShowTitle]", desc: "是否显示图形标题", type: "string", defaultValue: 'true' },
{ param: "[bcacChartShowLegend]", desc: "是否显示图例", type: "string", defaultValue: 'true' },
{ param: "[bcacChartFileName]", desc: "文件下载名", type: "string", defaultValue: '图表' },
{ param: "[bcacChartLoading]", desc: '图片加载等待', type: "boolean", defaultValue: 'false' },
{ param: "[bcacChartShowToolbox]", desc: '图片是否显示工具栏', type: "Boolean", defaultValue: 'true' },
{ param: "[bcacChartSeriesName]", desc: '系列名称', type: "string", defaultValue: "''" },
{ param: "[bcacLabelLineLength]", desc: '视觉引导线第一段的长度', type: "number", defaultValue: "10" },
{ param: "[bcacLabelLineLength2]", desc: '视觉引导线第二段的长度', type: "number", defaultValue: "10" },
{ param: "[bcacPieChartRadius]", desc: '饼图半径', type: " Array | Array", defaultValue: '60%' },
{ param: "[bcacPieChartCenter]", desc: '饼图位置', type: "Array | Array", defaultValue: '["50%", "50%"]' },
{ param: "[bcacChartData]", desc: '图片数据', type: "{name:string,value:string}[]", defaultValue: '[]' },
{ param: "(bcacGetChartInstance)", desc: '获取当前echart实例', type: "EventEmitter<>", defaultValue: '-' },
]
}