【发布时间】:2021-11-11 13:58:08
【问题描述】:
我遇到了这个顶点图表的问题,当它全屏时一切都很好,当我最小化屏幕时,图表进入你的卡片,看起来不太好..
app.component.ts:
export class DashboardComponent implements OnInit{
riskByCategoryAnalysis: ChartType;
constructor(){}
ngOnInit(){
this.processRiskByCategory();
}
private processRiskByCategory() {
this.riskByCategoryAnalysis = {
series: [this.one, this.two,
this.three, this.four],
chart: {
height: 276,
type: 'donut',
width: '100%',
},
labels: ["One", "Two", "Three", "Four"],
plotOptions: {
pie: {
donut: {
size: '75%'
}
}
},
dataLabels: {
enabled: false
},
legend: {
show: false,
},
colors: ['#0090E7', '#99D3F5', '#1BC59C', '#A4E8D7'],
};
}
}
app.component.html:
<div class="row" id="apex-chart">
<div class="col-md-7 d-flex align-items-center justify-content-center pr-0">
<apx-chart dir="ltr" class="apex-charts" *ngIf="riskByCategoryAnalysis"
[series]="riskByCategoryAnalysis.series"
[chart]="riskByCategoryAnalysis.chart"
[legend]="riskByCategoryAnalysis.legend"
[colors]="riskByCategoryAnalysis.colors"
[labels]="riskByCategoryAnalysis.labels"
[dataLabels]="riskByCategoryAnalysis.dataLabels"
[plotOptions]="riskByCategoryAnalysis.plotOptions">
</apx-chart>
</div>
</div>
谢谢。
【问题讨论】:
-
能分享一下组件的 HTML 和 CSS 吗?看起来像是 CSS 问题。
-
我已添加 html,但我没有此图表的任何 css 类。
-
我已经发布了一个一般性的答案,对于更具体的答案,我需要一个 stackblitz、codepen 或类似的东西来深入研究它。
-
您能否添加 ChartType 定义。因为这是一个类型问题形式 TS。 ——
标签: angular apexcharts