import { Component, OnInit } from '@angular/core'; import { NzMessageService } from 'ng-zorro-antd'; @Component({ selector: 'app-legend-pie-chart', templateUrl: './legend-pie-chart.component.html', styleUrls: ['./legend-pie-chart.component.scss'] }) export class LegendPieChartComponent implements OnInit { constructor( private message: NzMessageService ) { } ngOnInit() { } typeScriptCode = ` import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-legend-pie-sub-chart', template: \` \`, styleUrls: ['./legend-pie-sub-chart.component.scss'] }) export class LegendPieSubChartComponent implements OnInit { constructor() { } data; position: string; seriesName: string = "" ngOnInit() { this.initChart() } initChart() { this.seriesName = "网站访问来源占比"; this.position = 'bottom' this.data = [ { value: 335, name: '直接访问' }, { value: 310, name: '邮件营销' }, { value: 234, name: '联盟广告' }, { value: 135, name: '视频广告' }, { value: 1548, 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: "[bcacChartLegendPosition]", desc: "图例位置", type: "bottom | right", defaultValue: 'bottom' }, { 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: "[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: '-' }, ] }