View unanswered posts | View active topics It is currently Sun Apr 28, 2024 7:02 pm



Reply to topic  [ 5 posts ] 
bar chart start from zero 
Author Message
Regular pChart user
Regular pChart user

Joined: Mon Dec 13, 2010 7:54 am
Posts: 13
Location: Gold Coast, Australia
Post bar chart start from zero
hi,

i want to be able to tell bar charts to start from zero.

drawBarChart() has an option, AroundZero, which extends "zero" values down to the bottom of the graph.
this option, when set on data which has zero-values, makes them appear to be -2 (or -10 or whatver your y-scale reads as).

please provide an option to force zero as the first y-value (that is, disable y-value padding).


Mon Dec 13, 2010 7:58 am
Profile
Regular pChart user
Regular pChart user

Joined: Mon Dec 13, 2010 7:54 am
Posts: 13
Location: Gold Coast, Australia
Post Re: bar chart start from zero
an update:

ive found that bar charts start counting their y-axis from the lowest common value across all data, minus a further 2 integers. am i right?

i propose changing this so the user can choose two y-start options: either zero, or the actual lowest value across all data.


Mon Dec 13, 2010 8:30 am
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: bar chart start from zero
Hi mykchan,

I've modified the rendering layout so 0 values now appears as a straight 1px height line on bar charts.

I'm not sure to fully understand what you intend to do, the 2px border may be a side effect of the AA algorithm or the rounded border boxes. Can you please show me the bit of code you're working on? This will help me to figure out where to search ;o)

Thank you!
JD.


Mon Dec 13, 2010 2:16 pm
Profile WWW
Regular pChart user
Regular pChart user

Joined: Mon Dec 13, 2010 7:54 am
Posts: 13
Location: Gold Coast, Australia
Post Re: bar chart start from zero
thanks for your quick reply! i really appreciate the work you put into this library.

im sorry, i dont know how to describe the problem im having. hopefully this illuminates it.

here is the image of the chart:

Image

and here is the exact code used to generate the image above:

http://pastebin.com/dhXeTX3D


Tue Dec 14, 2010 12:26 am
Profile
Regular pChart user
Regular pChart user

Joined: Mon Dec 13, 2010 7:54 am
Posts: 13
Location: Gold Coast, Australia
Post Re: bar chart start from zero
thanks to the 2nd post in http://wiki.pchart.net/forum/viewtopic.php?f=3&t=28 i figured it out:

to force the y-axis to start from zero, one must tell the chart:
$chart->drawScale(array('Mode' => SCALE_MODE_START0));


Thu Dec 16, 2010 12:19 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 18 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