PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old August 7th, 2009, 08:51 PM
sapling sapling is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Posts: 4 sapling User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 31 sec
Reputation Power: 0
Question Creating dataset for Image_Graph

I have been pouring through the examples at pear.veggerby.dk and PHPBuilder.com and others but still don't quite understand how to get my dataset built for my graph. Can anyone help?

I want to create a multiple bar graph with y-axis in $ and x-axis in months. I want to have multiple bars at each month showing the production amounts for multiple years; similar to the example at pear.veggerby.dk for plot_bar_multiple .

My code so far looks like:

// create the graph
$Graph =& Image_Graph::factory('graph', array(600, 300));
// add a TrueType font
$Font =& $Graph->addNew('ttf_font', 'arial');
// set the font size to 11 pixels
$Font->setSize(8);

$Graph->setFont($Font);
$Graph->add(
Image_Graph::vertical(
Image_Graph::factory('title', array('Monthly Production', 12)),
Image_Graph::vertical(
$Plotarea = Image_Graph::factory('plotarea'),
$Legend = Image_Graph::factory('legend'),
90
),
5
)
);
$Legend->setPlotarea($Plotarea);
$histres = $db->query('SELECT
practice_id,
year,
month,
prod
FROM
month_history
WHERE
practice_id = '. $practice_id.'
ORDER BY
year, month');
if (PEAR::isError($histres)) {
$message .= "History: ".$histres->getMessage();
Var_Dump::display($message);
exit();
}
$doOnce = true;
$currentyear = 0;
$Dataset[] =& Image_Graph::factory('dataset');

while ($row = $histres->fetchRow()) {
if ($doOnce) {
$currentyear = $row['year'];
$doOnce = false;
}
if ($currentyear != $row['year']) {
$Dataset[] =& Image_Graph::factory('dataset');
$currentyear = $row['year'];
}
$Dataset->addPoint($month_abrev[$row['month']], $row['m_prod']);
}

// create the 1st plot as smoothed area chart using the 1st dataset
$Plot =& $Plotarea->addNew('bar', array($Dataset));

// output the Graph
$Graph->done();


When I run this, I get:
Fatal error: Call to a member function addPoint() on a non-object in /home/practicemonitor/test.php on line 126

line 126 is the addPoint call inside the while loop.

Any help out there? Please?

-Roxanne

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > Creating dataset for Image_Graph


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek