View unanswered posts | View active topics It is currently Wed May 08, 2024 8:32 am



Reply to topic  [ 8 posts ] 
Format the x-Axis 
Author Message
pChart user
pChart user

Joined: Fri Jan 07, 2011 8:08 pm
Posts: 7
Post Format the x-Axis
Hi,

how can I format/reduce the displayed values on the x-Axes. A interval by 5 would be nice [0,5,10,15,20 ...90].

Any ideas?


Attachments:
example.drawSimple.png
example.drawSimple.png [ 36.05 KiB | Viewed 11565 times ]
Fri Jan 07, 2011 8:15 pm
Profile
Post Re: Format the x-Axis
Use the drawScale( $Format ) function.

You can set several parameters in the $Format array.

http://wiki.pchart.net/doc.doc.draw.scale.html

You want to use the 'LabelSkip' parameter.

$MyGraph->drawScale( array('LabelSkip' => 5) );

Unfortunately, I couldn't get the label skipping option to draw a graph at regular intervals of 5.

Instead of the desired: 0,5,10,15,20

I get: 0,4,9,14,19

I don't know if it is because the LabelSkip option seems to start counting at zero or what, or maybe there is a bug.


Fri Jan 07, 2011 9:05 pm
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Format the x-Axis
I'll check this and will let you know.

Kind regards,
JD.


Fri Jan 07, 2011 9:14 pm
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Format the x-Axis
I've patched the pData class.

Try with the option :

Code:
$MyGraph->drawScale( array('LabelSkip' => 4) );


Attachments:
pData.zip [4.22 KiB]
Downloaded 656 times
Fri Jan 07, 2011 9:47 pm
Profile WWW
pChart user
pChart user

Joined: Fri Jan 07, 2011 8:08 pm
Posts: 7
Post Re: Format the x-Axis
Thanks for the quick response! That was exactly that I was looking for.

I tried your patch to correct the values from (0,4,9) but it didn't change anything :(.


Sat Jan 08, 2011 9:57 am
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Format the x-Axis
This is the output I have while skipping two labels :


Attachments:
Capture.PNG
Capture.PNG [ 62.48 KiB | Viewed 11545 times ]
Sat Jan 08, 2011 10:09 am
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Format the x-Axis
Forget it, I didn't attached the good class file ;o)

Use the one below instead! --Sorry


Attachments:
pDraw.zip [24.94 KiB]
Downloaded 843 times
Sat Jan 08, 2011 10:12 am
Profile WWW
pChart user
pChart user

Joined: Fri Jan 07, 2011 8:08 pm
Posts: 7
Post Re: Format the x-Axis
Works great :D :mrgreen: :idea:

Thanks!


Sat Jan 08, 2011 4:16 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 10 guests


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