【发布时间】:2020-10-01 11:57:35
【问题描述】:
我有一个显示复杂图表的应用程序。我想为这些添加一个图例,但我不知道该怎么做。
在我的组件中,我像这样导入amcharts:
import { AmChartsService } from '@amcharts/amcharts3-angular';
然后我调用这个函数:
getCharts(id: string) {
this.charts.forEach(chart => {
const amChart = this.AmChartsService.makeChart(chart.id, this.chartService.getById(MyEnum.config));
});
}
我传递给上述函数的配置在我的图表服务中定义如下:
const charts: Chart[] = [
{
id: MyEnum.config,
data: {
...
},
valueAxes: [{
...
}],
balloon: {
...
},
chartCursor: {
...
},
legend: {
position: 'bottom',
bottom: 10,
left: 15,
width: 'auto',
autoMargins: false,
data: []
},
}
}
];
仅当我从配置中删除 data:[] 时才会显示图例。但随后只显示图例的标记。
我想在图表底部添加一个带有标记和标签的图例来说明线条的含义。
【问题讨论】:
标签: angular typescript charts amcharts