首页 > 解决方案 > Set Y value in pixels in amchart

问题描述

I have a chart with icons that are drawn as a simple line with bullets. The data is like this [["18-07-2021",64], ["19-07-2021",64],["20-07-2021",64], .... ] I manually set the Y value as 64 (max data value). But I want to set this line with icons in pixels offset from the top border of the chart, so it was always on the same height(now when the data changes the Y char max value changes). Is there a way to do so? Thanks.

enter image description here

标签: javascriptamchartsamcharts4

解决方案


您可以使用最小值/最大值来添加最大值和图表顶部之间的差距。例如:

valueAxis.min = 0;
valueAxis.max = 130;
valueAxis.strictMinMax = true;

请参阅https://www.amcharts.com/docs/v4/reference/valueaxis/#max_property中的文档


推荐阅读