|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 2/19/2008 11:33:21 AM
Posts: 2,
Visits: 7
|
|
| Hey all, Im extremley new to fusiongraphs free (only downloaded an 1hr ago) and have been working through the demo code and reading the docs - but am a little confused on where to start. I have to create a graph from the following data set: DB_CYCLE MONTH_YEAR OVERALL_TIME 1_1 NOV_2007 01:30:00 1_2 NOV_2007 02:45:00 1_1 DEC_2007 01:40:00 1_2 DEC_2007 03:00:00 I want to plot this on a line graph with the lines representing the cycles and the Month_year running across the X-axis... this data is stored in a MYSQL database... I have tried the following (based on an example piece of code): $strQuery = "SELECT Concat(bill_run_time.DB,'_',bill_run_time.Cycle) AS BILL_CYCLE, Month(bill_run_time.`Run date`) AS MONTH, bill_run_time.Overall AS OVERALL FROM bill_run_time WHERE bill_run_time.Bill_Run = '1' AND bill_run_time.`Run date` > '2007-11-01' AND bill_run_time.`Run date` < 'now()'"; $result = mysql_query($strQuery) or die(mysql_error()); //Pass the SQL Query result to the FusionCharts PHP Class function //along with field/column names that are storing chart values and corresponding category names //to set chart data from database if ($result) { $FC->addDataFromDatabase($result, "Overall", "Month"); } But the graph has Nan up the y axiss and repeats the months rather than grouping them along the X axis with no Lines plotted. Hope I have explained myself fully - any ideas where I am going wrong? Cheers Dave
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: Today @ 7:20:21 AM
Posts: 869,
Visits: 1,380
|
|
| hi, The value thats being assined is non numeric.Hence it is showing NaN. In FusionCharts FREE you can not pass a time as a value of a chart. The value has to be numeric.
Regards,
Sudipto Choudhury FusionCharts Team
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 2/19/2008 11:33:21 AM
Posts: 2,
Visits: 7
|
|
| Thank you for the info - Im guessing you could do that in v3? I managed to work out a way of getting it working - and it looks ace! Just in case anyone is interested here is the code: include (BASEDIR.'FusionClass/FusionCharts_Gen.php'); $fc = new FusionCharts("MSLine", "550", "300");
$fc->setSWFPath(BASEDIR."FusionCharts/"); $strParam="caption=Bill Run ".$_GET['Bill_Run']." 3 Month History;XAxisName=Month;YAxisName=Time Taken (Minutes);decimalPrecision=0;"; $fc->setChartParams($strParam); $hist_start_date = date('Y-m-d',strtotime("$start_date - 5 Months")); $result_dates = dbquery("Select distinct Concat( date_format(billing_run_times.`Run date`,'%b'),'_ ', YEAR(billing_run_times.`Run date`)) AS Month_Year From billing_run_times Where billing_run_times.Bill_Run = '".$_GET['Bill_Run']."' AND billing_run_times.`Run date` Between '".$hist_start_date."' AND '".$end_date."' Order By billing_run_times.`Run date` ASC");
$result = dbquery("Select Concat(billing_run_times.DB,'_', billing_run_times.Cycle) AS Bill_Cycle, Substr(billing_run_times.Overall,1,2)*60+substr(billing_run_times.Overall,4,2) AS Overall_Mins From billing_run_times Where billing_run_times.Bill_Run = '".$_GET['Bill_Run']."' AND billing_run_times.`Run date` Between '".$hist_start_date."' AND '".$end_date."' Order By Bill_Cycle"); while ($data_date = dbarray($result_dates)) { $fc->addCategory($data_date['Month_Year']); } $data_held = ""; While ($data = dbarray($result)) { if ($data_held != $data['Bill_Cycle']) { $fc->addDataset($data['Bill_Cycle'],"showValues='1'"); }
$fc->addChartData($data['Overall_Mins']); $data_held = $data['Bill_Cycle']; } $fc->renderChart();
Hope this helps someone else Cheers Dave
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 3/27/2008 3:14:10 PM
Posts: 2,
Visits: 59
|
|
Is that in PHP?
David Mendez
|
|
|
|