How to get the position of a custom axis
Posted: Wed Nov 21, 2007 8:25 am
Hi,
I added two custom axis to the chart and I would like to display the axis title at the top of each axis. here is how I did it.
m_chart1.GetAxis().AddCustom(FALSE);
m_chart1.GetAxis().AddCustom(FALSE);
m_chart1.GetAxis().GetCustom(0).SetPositionPercent(-7);
m_chart1.GetAxis().GetCustom(1).SetPositionPercent(-15);
Then in OnAfterDrawTchart1() I added
double x = m_chart1.GetAxis().GetLeft().GetPosition()-24;
double y = m_chart1.GetAxis().GetTop().GetPosition()-20;
m_chart1.GetCanvas().TextOut(x,y,"Axis-1");
x = m_chart1.GetAxis().GetCustom(0).GetPosition()-24;
m_chart1.GetCanvas().TextOut(x,y,"Axis-2");
x = m_chart1.GetAxis().GetCustom(1).GetPosition()-24;
m_chart1.GetCanvas().TextOut(x,y,"Axis-3");
However, all the text were overlapped. After I traced it, I found that the x value didn't change and was always the same as Left Axis position value. Would anyone please tell me how I should get the position value of the custom axis?
Thanks,
David
I added two custom axis to the chart and I would like to display the axis title at the top of each axis. here is how I did it.
m_chart1.GetAxis().AddCustom(FALSE);
m_chart1.GetAxis().AddCustom(FALSE);
m_chart1.GetAxis().GetCustom(0).SetPositionPercent(-7);
m_chart1.GetAxis().GetCustom(1).SetPositionPercent(-15);
Then in OnAfterDrawTchart1() I added
double x = m_chart1.GetAxis().GetLeft().GetPosition()-24;
double y = m_chart1.GetAxis().GetTop().GetPosition()-20;
m_chart1.GetCanvas().TextOut(x,y,"Axis-1");
x = m_chart1.GetAxis().GetCustom(0).GetPosition()-24;
m_chart1.GetCanvas().TextOut(x,y,"Axis-2");
x = m_chart1.GetAxis().GetCustom(1).GetPosition()-24;
m_chart1.GetCanvas().TextOut(x,y,"Axis-3");
However, all the text were overlapped. After I traced it, I found that the x value didn't change and was always the same as Left Axis position value. Would anyone please tell me how I should get the position value of the custom axis?
Thanks,
David