1

I am using amchart (not stock chart) to generate charts of two or more datasets. I noticed that lines with different values are being adjusted by their max values. Please have a look at the attached screenshot:

amchart

As you can see for example the amount 1.8k is above the amount 4.2k because of the enabled auto-adjustment. Searching through the amcharts forum gave no result. Thanks you in advance!

UPDATE 1: I have found one post with the similar problem, but I think it is quite not a good way to adjust axises in such manner:

UPDATE 2: Taking into consideration the @zerion's answer I have written some lines in my backend to be sure the synchronization will always be correct. I calculate min and max values for each numeral field that will be used as an axis, then using usort I sort the dataset array by (max - min) condition.

Riddick
  • 55
  • 7

2 Answers2

3

Yes, or you can even tell the axis to synchronize:

valueAxis2.synchronizeWithAxis(valueAxis1); valueAxis2.synchronizationMultiplier = 1;

So you should only think of which of your axis has the widest range of values, and sync other axes to this one.

zeroin
  • 5,863
  • 6
  • 31
  • 42
  • For some incomprehensible reasons this method doesn't work when there are more than two axises, synchronization works only for the last axis, all others disappears: `valueAxis1.synchronizationMultiplier = 1; valueAxis1.synchronizeWithAxis(valueAxis0); valueAxis2.synchronizationMultiplier = 1; valueAxis2.synchronizeWithAxis(valueAxis0); valueAxis3.synchronizationMultiplier = 1; valueAxis3.synchronizeWithAxis(valueAxis0);` – Riddick Dec 28 '13 at 12:22
  • It worked after I set synchronization as below: `...valueAxis1.synchronizationMultiplier = 1; valueAxis1.synchronizeWithAxis(valueAxis0); valueAxis2.synchronizationMultiplier = 1; valueAxis2.synchronizeWithAxis(valueAxis1); valueAxis3.synchronizationMultiplier = 1; valueAxis3.synchronizeWithAxis(valueAxis2);` Thank you @zeroin! – Riddick Dec 29 '13 at 05:40
2

After more careful investigations I have found that the needed effect could be achieved by setting valueAxis.maximum (and maybe valueAxis.minimum if there are negative values) to the highest (lowest) value among all dataSets.

Riddick
  • 55
  • 7