Area series problem in Log scale
Posted: Sat Feb 19, 2005 2:28 am
I have drawn an area series with log scale on a chart,
then unknown line appears on the chart.
Just for my information,
the unknown line appears or not when size the chart.
There is a sampe code below.
Thanks.
//Sample code
const int nValueCount = 21;
struct XY_VALUE
{
double m_lfX;
double m_lfY;
XY_VALUE(){}
XY_VALUE(double lfX, double lfY)
{
m_lfX = lfX;
m_lfY = lfY;
}
};
XY_VALUE UpperCurve[nValueCount] =
{
XY_VALUE(0.0000167, 355.7701149),
XY_VALUE(0.0000695, 285.1034483),
XY_VALUE(0.0002373, 224.7931034),
XY_VALUE(0.000542, 190.0689655),
XY_VALUE(0.0013838, 153.5172414),
XY_VALUE(0.001415, 152.908046),
XY_VALUE(0.0018914, 143.1609195),
XY_VALUE(0.0024723, 134.6321839),
XY_VALUE(0.0033045, 127.9310345),
XY_VALUE(0.0048293, 122.4482759),
XY_VALUE(0.0070577, 117.5747126),
XY_VALUE(0.0088226, 115.137931),
XY_VALUE(0.0100868, 114.5287356),
XY_VALUE(0.0168537, 110.8735632),
XY_VALUE(0.0384891, 107.8275862),
XY_VALUE(0.0687634, 106.6091954),
XY_VALUE(0.1501808, 106),
XY_VALUE(0.3207586, 106),
XY_VALUE(2.5564204, 106),
XY_VALUE(53.1970466, 106),
XY_VALUE(166.0478439, 106)
};
m_TChart.AddSeries(3); //Add Area Series
m_TChart.Series(0).SetColor(RGB(255, 0, 0));
m_TChart.Series(0).GetAsArea().GetAreaPen().SetVisible(FALSE);
m_TChart.Series(0).GetAsArea().SetTransparency(80);
m_TChart.GetAxis().GetBottom().SetLogarithmic(TRUE);
m_TChart.GetAxis().GetBottom().SetLogarithmicBase(10);
m_TChart.GetAxis().GetBottom().GetLabels().SetValueFormat("#,##0.#######");
for(int nIndex = 0; nIndex < nValueCount; nIndex++)
{
m_TChart.Series(0).AddXY(UpperCurve[nIndex].m_lfX, UpperCurve[nIndex].m_lfY, "", RGB(255, 0, 0));
}
double lfMaxValueOfUpperCurve = 0.f;
lfMaxValueOfUpperCurve = m_TChart.Series(0).GetYValues().GetMaximum();
m_TChart.Series(0).GetAsArea().SetUseYOrigin(TRUE);
m_TChart.Series(0).GetAsArea().SetYOrigin(lfMaxValueOfUpperCurve);
then unknown line appears on the chart.
Just for my information,
the unknown line appears or not when size the chart.
There is a sampe code below.
Thanks.
//Sample code
const int nValueCount = 21;
struct XY_VALUE
{
double m_lfX;
double m_lfY;
XY_VALUE(){}
XY_VALUE(double lfX, double lfY)
{
m_lfX = lfX;
m_lfY = lfY;
}
};
XY_VALUE UpperCurve[nValueCount] =
{
XY_VALUE(0.0000167, 355.7701149),
XY_VALUE(0.0000695, 285.1034483),
XY_VALUE(0.0002373, 224.7931034),
XY_VALUE(0.000542, 190.0689655),
XY_VALUE(0.0013838, 153.5172414),
XY_VALUE(0.001415, 152.908046),
XY_VALUE(0.0018914, 143.1609195),
XY_VALUE(0.0024723, 134.6321839),
XY_VALUE(0.0033045, 127.9310345),
XY_VALUE(0.0048293, 122.4482759),
XY_VALUE(0.0070577, 117.5747126),
XY_VALUE(0.0088226, 115.137931),
XY_VALUE(0.0100868, 114.5287356),
XY_VALUE(0.0168537, 110.8735632),
XY_VALUE(0.0384891, 107.8275862),
XY_VALUE(0.0687634, 106.6091954),
XY_VALUE(0.1501808, 106),
XY_VALUE(0.3207586, 106),
XY_VALUE(2.5564204, 106),
XY_VALUE(53.1970466, 106),
XY_VALUE(166.0478439, 106)
};
m_TChart.AddSeries(3); //Add Area Series
m_TChart.Series(0).SetColor(RGB(255, 0, 0));
m_TChart.Series(0).GetAsArea().GetAreaPen().SetVisible(FALSE);
m_TChart.Series(0).GetAsArea().SetTransparency(80);
m_TChart.GetAxis().GetBottom().SetLogarithmic(TRUE);
m_TChart.GetAxis().GetBottom().SetLogarithmicBase(10);
m_TChart.GetAxis().GetBottom().GetLabels().SetValueFormat("#,##0.#######");
for(int nIndex = 0; nIndex < nValueCount; nIndex++)
{
m_TChart.Series(0).AddXY(UpperCurve[nIndex].m_lfX, UpperCurve[nIndex].m_lfY, "", RGB(255, 0, 0));
}
double lfMaxValueOfUpperCurve = 0.f;
lfMaxValueOfUpperCurve = m_TChart.Series(0).GetYValues().GetMaximum();
m_TChart.Series(0).GetAsArea().SetUseYOrigin(TRUE);
m_TChart.Series(0).GetAsArea().SetYOrigin(lfMaxValueOfUpperCurve);