Draw chart

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
S_henry
Forum Contributor
Posts: 148
Joined: Sun Jan 25, 2004 10:25 pm
Location: M'sia

Draw chart

Post by S_henry »

Let say I have data about student's mark in several subjects. If I want to represent that data (eg. english=82, math=91) using chart (eg. bar chart) in my page, what is the best way to do it? I mean how can I draw chart using that data?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I believe JPgraph is the most common used charting tool..
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

yeah take a look at jpgraph, its a really nice little tool.
its easy to use even though the documentation may seem intimidating.


but if all you need to do is very basic bar charts, its pretty easy to do it yourself with just html

Code: Select all

<table style="border: 1px solid #000;">

 <tr>
  <td>Math score</td>
  <td><div style="width: <?php echo $math_score; ?>px; background-color: orange;"></div></td>
 </tr>

 <tr>
  <td>English score</td>
  <td><div style="width: <?php echo $eng_score; ?>px; background-color: blue;"></div></td>
 </tr>

</table>
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Post by AGISB »

If you need the bars functioning in older browsers as well you can also consider using small colored gifs that you place in a table with the width you need.
S_henry
Forum Contributor
Posts: 148
Joined: Sun Jan 25, 2004 10:25 pm
Location: M'sia

Post by S_henry »

Because of time constraint, I'll use rehfeld method at this time. And of course I'll study other suggestions after this. Thanx guys..
Post Reply