0

I have a Stock Chart and I want to remove empty spaces between candles and to set axe to the right. So I added the following code:

var categoryAxesSettings = new AmCharts.CategoryAxesSettings();
categoryAxesSettings.equalSpacing = true;
categoryAxesSettings.position = "right";

But it makes no effect!

Can't figure out where problem is :( Please help!

My code is exactly the same as this one - http://www.amcharts.com/demos/adding-removing-panel/ or http://codepen.io/anon/pen/GppXgq

4

1 回答 1

0

您的代码有两个问题。


1)您似乎正在创建 CategoryAxesSettings 的新实例,但未将其分配给图表,因此从未使用过。

您需要分配给图表的categoryAxesSettings属性:

var categoryAxesSettings = new AmCharts.CategoryAxesSettings();
categoryAxesSettings.equalSpacing = true;
chart.categoryAxesSettings = categoryAxesSettings;

或者,如果您只需要修改一个参数,直接修改它会更容易,而无需创建单独的对象:

chart.categoryAxesSettings.equalSpacing = true;

2)垂直轴是价值轴,而不是类别轴。所以你需要用它ValueAxesSettings来设置它们的位置。

chart.valueAxesSettings.position = "right";
于 2015-09-14T06:23:03.637 回答