View unanswered posts | View active topics It is currently Tue May 28, 2024 10:25 pm



Reply to topic  [ 5 posts ] 
How to hide a serie in the legend? 
Author Message
Regular pChart user
Regular pChart user

Joined: Thu Jan 06, 2011 1:51 pm
Posts: 11
Post 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!


Thu Jan 06, 2011 1:57 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post 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.


Thu Jan 06, 2011 2:05 pm
Profile WWW
Regular pChart user
Regular pChart user

Joined: Thu Jan 06, 2011 1:51 pm
Posts: 11
Post 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?


Thu Jan 06, 2011 3:43 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post 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.


Thu Jan 06, 2011 3:58 pm
Profile WWW
Regular pChart user
Regular pChart user

Joined: Thu Jan 06, 2011 1:51 pm
Posts: 11
Post Re: How to hide a serie in the legend?
Cheers :). You may close the topic.


Thu Jan 06, 2011 8:48 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron