我查看了 amcharts 版本 4 ( https://www.amcharts.com/javascript-charts/ ) 的文档,但似乎无法找到如何将 y 轴格式化为货币。有关于以其他方式格式化 y 轴的文档,但货币似乎不是其中之一。有谁知道如何或从哪里开始?
到目前为止,我有上面的图表,只需要知道如何或在哪里将 y 轴格式化为货币。当您将鼠标悬停在格式化为货币罚款的行上时,我目前有标签,因为这相当简单。这是我创建轴的功能:
function createAxisAndSeries(field, name, opposite) {
const valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
const series = chart.series.push(new am4charts.LineSeries());
series.dataFields.valueY = field;
series.dataFields.dateX = 'date';
series.strokeWidth = 2;
series.yAxis = valueAxis;
series.name = name;
series.tooltipText = '{name}: [bold]${valueY}[/]';
series.tensionX = 0.8;
const interfaceColors = new am4core.InterfaceColorSet();
valueAxis.renderer.line.strokeOpacity = 1;
valueAxis.renderer.line.strokeWidth = 2;
valueAxis.renderer.line.stroke = series.stroke;
valueAxis.renderer.labels.template.fill = series.stroke;
valueAxis.renderer.opposite = opposite;
valueAxis.renderer.grid.template.disabled = true;
}