Reputation: 1
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
Upvotes: 0
Views: 100
Reputation: 8595
There are two issues with your code.
1) You seem to be creating a new instance of CategoryAxesSettings but not assigning it to the chart, so it's never used.
You need to assign to chart's categoryAxesSettings
property:
var categoryAxesSettings = new AmCharts.CategoryAxesSettings();
categoryAxesSettings.equalSpacing = true;
chart.categoryAxesSettings = categoryAxesSettings;
Or, if you need to modify just one parameter, it's easier to modify it directly, without creating separate object:
chart.categoryAxesSettings.equalSpacing = true;
2) Vertical axes are value axes, not category axes. So you need to use ValueAxesSettings
to set their position.
chart.valueAxesSettings.position = "right";
Upvotes: 0