Page 1 of 1

Custom axis problem

Posted: Thu Jul 13, 2006 6:20 am
by 9529132
Hi,

There are two series in the chart and I would like to use two horizontal custom axis to seperate them. Here is what I did:

m_chart2.GetAxis().GetCustom(0).SetStartPosition(0);
m_chart2.GetAxis().GetCustom(0).SetEndPosition(50);
m_chart2.GetAxis().GetCustom(0).GetAxisPen().SetColor(RGB(255,0,0));
m_chart2.Series(0).SetHorizontalAxisCustom(0);
m_chart2.Series(0).SetVerticalAxis(aLeftAxis);

m_chart2.GetAxis().AddCustom(TRUE);
m_chart2.GetAxis().GetCustom(1).SetStartPosition(50);
m_chart2.GetAxis().GetCustom(1).SetEndPosition(100);
m_chart2.GetAxis().GetCustom(1).GetAxisPen().SetColor(RGB(0,0,255));
m_chart2.Series(1).SetHorizontalAxisCustom(1);
m_chart2.Series(1).SetVerticalAxis(aRightAxis);
The two axis can display correctly, but the problem is that the custom x-axis values are missing because there is no enough space. Then I tried
m_chart2.GetPanel().SetMarginBottom(15);
Then the values can be displayed, but the space for the series is smaller, which is not desirable. Since there is no such problem for the normal bottom axis, is there any way fix it?

Thank you very much!
David

Posted: Sun Jul 16, 2006 11:23 am
by Pep
Hi David,

the idea is to use the bottom axis for one of the custom axis, as it can be customized (startposition, endpotision,...) as the custom axis.

This way it will take consideration of the bottom labels space.
i.e. (vb code) :

Code: Select all

m_chart2.Axis.Bottom.StartPosition = 0
m_chart2.Axis.Bottom.EndPosition = 50
m_chart2.Axis.Bottom.AxisPen.Color = RGB(255, 0, 0)
m_chart2.Series(0).VerticalAxis = aLeftAxis
m_chart2.Series(0).FillSampleValues (10)

c1 = m_chart2.Axis.AddCustom(True)
m_chart2.Axis.Custom(0).StartPosition = 50
m_chart2.Axis.Custom(0).EndPosition = 100
m_chart2.Axis.Custom(0).AxisPen.Color = RGB(0, 0, 255)
m_chart2.Series(1).HorizontalAxisCustom = c1
m_chart2.Series(1).VerticalAxis = aRightAxis
m_chart2.Series(1).FillSampleValues (10)

Posted: Mon Jul 17, 2006 1:24 am
by 9529132
Hi, Pep,

It works following your way. It seems the main difference is that you used the normal bottom axis setting startposition to 0 and EndPosition to 50, while I used two custom bottom axis. Does that mean I can't use two custom x-axis, one from StartPosition 0 to EndPosition 50, and the other from 50 to 100 if there is space for labels?

Thank you very much!
David

Posted: Tue Jul 18, 2006 1:47 pm
by Pep
Hi David,

yes, you can use two custom axis, but I don't know which is the problem to not use the existing bottom axis for the first customized axis.
In case you don't want to use the existing bottom axis (and use two custom axis) you will have to use the trick you said on your other post (set a bottom margin).