Your teaching....
1) ParamDlg.h
public:
double *xProjData ;
double *yProjData ;
long lLength;
2)
void CParamDlg::UpdateHisto()
{
xProjData = new double[Length];
yProjData = new double[Length];
lLength = Length;
for (long index = 0; index < Length; index ++)
{
xProjData[index] = index + 1;
yProjData[index] = (double)pProjection[index];
}
drawChart(&m_ChartViewer);
}
3)
void CParamChipCheckerDlg::drawChart(CChartViewer *viewer)
{
XYChart *c = new XYChart(392, 100);
c->setPlotArea(35, 30 , c->getWidth()-50, c->getHeight()-50, c->linearGradientColor(35, 30, 0, c->getHeight()-50, 0xf0f6ff, 0xa0c0ff), -1, Chart::Transparent, 0xffffff, 0xffffff);
c->xAxis()->setLabelStyle("arialbd.ttf", 8);
c->yAxis()->setLabelStyle("arialbd.ttf", 8);
c->xAxis()->setColors(Chart::Transparent);
c->yAxis()->setColors(Chart::Transparent);
//===> Draw Chart.
LineLayer *layer = c->addLineLayer();
layer->setLineWidth(2);
layer->setXData(DoubleArray(xProjData, lLength));
layer->addDataSet(DoubleArray(yProjData, lLength ), 0xcc0000, "Power");
viewer->setChart(c);
//<=== Draw Chart.
}
In code,
layer->setXData(DoubleArray(xProjData, lLength));
layer->addDataSet(DoubleArray(yProjData, lLength ), 0xcc0000, "Power"); |