|
hi,please help! i can't coding this style, i think you can do it!! please !thx |
Posted by xiaoming on Apr-26-2013 16:05 |
|
the style i can't coding it and i coding on MFC,how can i coding!
note:
the above the red line i must set the points's color red, and the Following the bule line i
must set the points's color bule
please help!
thx!!
|
Re: hi,please help! i can't coding this style, i think you can do it!! please !thx |
Posted by Peter Kwan on Apr-27-2013 11:04 |
|
Hi xiaoming,
I suggest you to separate your points into 3 groups for the red points, blue points, and green points, and then add them as 3 separate scatter layers. The line itself can be added as a fourth layer.
For example
//separate myData into 3 groups
std::vector<double> redData(myDataLength, Chart::NoValue);
std::vector<double> greenData(myDataLength, Chart::NoValue);
std::vector<double> blueData(myDataLength, Chart::NoValue);
for (int i = 0; i < myDataLength; ++i) {
if (myData[i] < lowMark) blueData[i] = myData[i];
else if (myData[i] > highMark) redData[i] = myData[i];
else greenData[i] = myData[i];
}
// Add 3 scatter layers
c->addScatterLayer(DoubleArray(xCoor, myDataLength), DoubleArray(&(redData[0]), myDataLength), "", GlassSphereShape, 11, 0xff3333, 0xff3333);
c->addScatterLayer(DoubleArray(xCoor, myDataLength), DoubleArray(&(greenData[0]), myDataLength), "", GlassSphereShape, 11, 0x33ff33, 0x33ff33);
c->addScatterLayer(DoubleArray(xCoor, myDataLength), DoubleArray(&(blueData[0]), myDataLength), "", GlassSphereShape, 11, 0x3333ff, 0x3333ff);
// The line layer
c->addLineLayer(DoubleArray(myData, myDataLength), 0xff0000)->setXData(DoubleArray(xCoor, myDataLength));
Hope this can help.
Regards
Peter Kwan |
Re: hi,please help! i can't coding this style, i think you can do it!! please !thx |
Posted by xiaoming on Apr-27-2013 17:45 |
|
thx you have do it but the other problem is:
the point and point can't connect by line.
en, please help! hao can i line these;
if coding like these:
layer->addDataSet(viewPortDataSeriesD, 0xFF3333, _TU("料价比"));
//m_bSetData=0;
long myDataLength=viewPortDataSeriesA.len;
std::vector<double> redData(myDataLength, Chart::NoValue);
std::vector<double> greenData(myDataLength, Chart::NoValue);
std::vector<double> blueData(myDataLength, Chart::NoValue);
for (int i = 0; i < myDataLength; ++i) {
if (viewPortDataSeriesA[i] < 100) blueData[i] = viewPortDataSeriesA[i];
else if (viewPortDataSeriesA[i] > 200) redData[i] = viewPortDataSeriesA[i];
else greenData[i] = viewPortDataSeriesA[i];
}
c->addScatterLayer(DoubleArray(viewPortTimeStamps.data,
viewPortTimeStamps.len), DoubleArray(&(redData[0]), greenData.size()), "", 10, 11,
0xff3333);
c->addScatterLayer(DoubleArray(viewPortTimeStamps.data,
viewPortTimeStamps.len), DoubleArray(&(greenData[0]), greenData.size()), "", 10, 11,
0x33ff33);
c->addScatterLayer(DoubleArray(viewPortTimeStamps.data,
viewPortTimeStamps.len), DoubleArray(&(blueData[0]), blueData.size()), "", 10, 11,
0x3333ff);
the img show is not nice!!!
|
Re: hi,please help! i can't coding this style, i think you can do it!! please !thx |
Posted by Peter Kwan on Apr-28-2013 11:14 |
|
Hi xiaoming,
You forget to add the line layer. In the code in my message, the line layer is added after the scatter layers.
// The line layer
c->addLineLayer(viewPortDataSeriesA, 0xff0000)->setXData(viewPortTimeStamps);
Hope this can help.
Regards
Peter Kwan |
Re: hi,please help! i can't coding this style, i think you can do it!! please !thx |
Posted by xiaoming on Apr-28-2013 11:18 |
|
thx verymuch!!!! your code is very nice!! your code of write to me can do a good work!! |
|