首页 > 解决方案 > 角度使图表中的选项可选选项

问题描述

我正在使用ngx-charts并且我有一个数据源,我想使用不同的图表类型来显示它,但是“autoScale”选项只能在少数图表中使用,但我想在可用时使用。

代码如下所示:

app.component.html

<ngx-charts-bubble-chart
            [results]="results"
            [xAxis]="options.xAxis"
            [yAxis]="options.yAxis"
            [legend]="options.legend"
            [autoScale]="options.autoScale">
</ngx-charts-bubble-chart>

app.component.ts

obj = {
   xAxis: true,
  yAxis: true,
  legend: false
  autoScale: true
}

如何使 autoScale 可选,以便如果图表不支持 autoScale 我仍然可以使用相同的数据而无需手动删除该 [autoScale]="options.autoScale"选项?

这可能吗?

标签: angularngx-charts

解决方案


推荐阅读