|
dot instead of a line on Dual Y Axis chart |
Posted by Sunny on Feb-25-2014 07:30 |
|
I have created a dual Y axis chart which works well as long as my line has 2 or more points. see attached.
double data1[] = {43.0,53.0,56.0,58.0,59.0,58.0,55.0,52.0,48.0,43.0,43.0,43.0};
double data2[] = {42,45};
XYChart *c = new XYChart(550, 390);
This is how the line is drawn
c->addLineLayer(DoubleArray(data2, (int)(sizeof(data2) / sizeof(data2[0]))), 0x000000)->setLineWidth(5);
This is how the bar is drawn
layer->addDataSet(DoubleArray(data1, (int)(sizeof(data1) / sizeof(data1[0]))),0x0D4FFB);
there are instances when I have data only for only month
ex. double data2[] = {42};
My questions is how can chartdirector just draw a point.
|
Re: dot instead of a line on Dual Y Axis chart |
Posted by Peter Kwan on Feb-26-2014 01:38 |
|
Hi Sunny,
You need at least 2 points to draw a line. To draw a single point, you may use a symbol (a
scatter chart, or a line chart with data symbols). For example:
LineLayer *myLineLayer = c->addLineLayer(DoubleArray(data2, (int)(sizeof(data2) /
sizeof(data2[0]))), 0x000000);
c->setLineWidth(5);
c->getDataSet(0)->setDataSymbol(Chart::CircleSymbol, 11, 0x000000);
If you want to draw a symbol only if there is one point, you may add an "if" statement to
check for one data point and execute the "setDataSymbol" only if the "if" statement is true.
Hope this can help.
Regards
Peter Kwan |
Re: dot instead of a line on Dual Y Axis chart |
Posted by Sunny on Feb-26-2014 09:49 |
|
Thank you Peter for your prompt reply |
Re: dot instead of a line on Dual Y Axis chart |
Posted by Sunny on Feb-26-2014 09:49 |
|
Thank you Peter for your prompt reply |
Re: dot instead of a line on Dual Y Axis chart |
Posted by Sunny on Feb-26-2014 09:50 |
|
Thank you Peter for your prompt reply |
|