|
addZone outside plotarea |
Posted by Fabian on Dec-13-2011 19:22 |
|
Hi Peter,
How could we colored the background of a row?
|
Re: addZone outside plotarea |
Posted by Peter Kwan on Dec-14-2011 04:44 |
|
Hi Fabian,
You can use Axis.addZone to change the background of a row inside the plot area. For example:
//add a zone for the first 3 bars (index = 0, 1, 2)
c->xAxis()->addZone(0 - 0.5, 2 + 0.5, 0x80ffff88);
Note that the zone only change the background color inside the plot area, but not of outside the plot area.
In your attached image, you seem to want to change the background color across the whole image horizontally, not just inside the plot area. If this is the case, you may use an empty TextBox (use BaseChart.addText to create a TextBox object), set it to the required size (using Box.setSize), set the background color (using Box.setBackground), and put at the z-order of the plot area background (use Box.setZOrder).
Hope this can help.
Regards
Peter Kwan |
Re: addZone outside plotarea |
Posted by Fabian on Dec-14-2011 15:01 |
|
Hi Peter,
yes, I want to change the background color across the whole image horizontally.
I will test your suggestion. Thank you! |
Re: addZone outside plotarea |
Posted by Fabian on Dec-14-2011 16:12 |
|
Hi at all, I do it like below:
c->setPlotArea(200, 30, ...
...
c->layout();
...
double dZoneS = d-0.5;
double dZoneE = d+0.5+(1.0*m_pFilterResult->pTitleChildCount[i]);
c->xAxis()->addZone(dZoneS, dZoneE, 0x99EDFEE9);
TextBox *tb = c->addText(0, c->getXCoor(dZoneS), "");
tb->setSize(200,c->getXCoor(dZoneE)-30);
tb->setBackground(0x99EDFEE9);
tb->setZOrder(Chart::PlotAreaZ);
Thanks Peter! |
|