pChart 2.x forum http://wiki.pchart.net/forum/ |
|
How to hide a serie in the legend? http://wiki.pchart.net/forum/viewtopic.php?f=3&t=53 |
Page 1 of 1 |
Author: | SandmanXC [ Thu Jan 06, 2011 1:57 pm ] |
Post subject: | How to hide a serie in the legend? |
My problem is at follows. I'm rendering a plot chart and I need the Y Axis to go from 0 to 10 with steps of 1 (and not to the maximum value). The only way I managed to achieve this is by setting a minimum height and placing a transparent (alpha = 0) serie with a single point, 9. I would also need a legend for my chart, but I can't find any way to hide the transparent serie from showing in the legend, as it has no place there. I would really appreciate some help, as I need this to be done real soon. Cheers! |
Author: | jean-damien [ Thu Jan 06, 2011 2:05 pm ] |
Post subject: | Re: How to hide a serie in the legend? |
Hi You can use the setSerieDrawable() function from the pData class. My advice would be to : 1. Create your two series. 2. Draw the scale. 3. Call the setSerieDrawable() function to hide the unneeded serie. 4. Draw your chart & legend. Kind regards, JD. |
Author: | SandmanXC [ Thu Jan 06, 2011 3:43 pm ] |
Post subject: | Re: How to hide a serie in the legend? |
Thanks, that worked. I made it "undrawable" after I drew the scales, so everything is fine. Since we're on the topic, is there anyway to centre the legend automatically? |
Author: | jean-damien [ Thu Jan 06, 2011 3:58 pm ] |
Post subject: | Re: How to hide a serie in the legend? |
There are no automatic positioning functions. You can call the getLegendSize() function to know the size of the legend box and then compute it's position knowing the image size. |
Author: | SandmanXC [ Thu Jan 06, 2011 8:48 pm ] |
Post subject: | Re: How to hide a serie in the legend? |
Cheers . You may close the topic. |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |