Page 1 of 1

Sync Axis Position between two Charts

Posted: Tue Aug 26, 2014 8:58 am
by 16068533
Hello

i'm using two Charts and i want to have the right Y-Axis of the Charts on the same X-Position.
The right Y-Axis in the upper Chart is an costum axis, in the lower chart it's the default right axis.
It also could be inverted (upper Chart is default axis and lower Chart is custom axis)

To make it more easier i have uploaded two pictures, the first one is what i have until now.
The secound one is what i want to have (edited with Paint).
Trend_small.png
Trend_small.png (26.09 KiB) Viewed 5595 times
Trend_want_to_have_small.png
Trend_want_to_have_small.png (27.79 KiB) Viewed 5587 times
I tryed to use the Chart.Panel.MarginRight Propertie but that doesn't work for me because the legend moves too when it was set.
Can someone help me to achieve this goal?

Best regards

Franz

Re: Sync Axis Position between two Charts

Posted: Tue Aug 26, 2014 10:17 am
by narcis
Hi Franz,

Custom axes don't calculate margins automatically. You can either set desired margin manually or for a more dynamic solution implement something as the PlaceAxes method Sandra posted here. Also, for the margin between the chart and the legend you can use tChart1.Legend.HorizMargin property.

Hope this helps.

Re: Sync Axis Position between two Charts

Posted: Tue Aug 26, 2014 3:22 pm
by 16068533
Hi NarcĂ­s,

thank you for your help.

I set the Chart.Legend.HorizMargin in the Chart.BeforeDraw-Event and it works very well.