Line with 2 Y-axes and addDataFromDatabase()
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Line with 2 Y-axes and addDataFromDatabase() Expand / Collapse
Author
Message
Posted 6/28/2008 7:12:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/29/2008 3:44:10 PM
Posts: 2, Visits: 7
Hello,

I would like to have a 2Dline chart with 2 graphs (lines)

One line has y: visitors x: date
other has y: money x: date (same one as above)

The data is in one MySQL table with columns: date, visitors, money.

I would like to use the addDataFromDatabase() function because it is the easiest for me.

I already managed to draw 1 line, but for 2 lines i need the Combined chart.

Can someone help me please?

Thank you very much!
Post #7076
Posted 6/28/2008 11:25:35 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/28/2008 11:18:54 PM
Posts: 1, Visits: 2
For starters, you need to use a combination dual y axis chart, and have two datasets. The first dataset will be parentYAxis="P" and the 2nd dataset will be parentYAxis="S". Here's an example from the Fusioncharts knowledge base chart gallery: http://www.fusioncharts.com/Gallery/Data/CombiDY2D4.xml.
Post #7081
Posted 6/29/2008 1:05:20 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/29/2008 3:44:10 PM
Posts: 2, Visits: 7
Is that example included in the free edition, if yes, wich swf file is it?

if i use:

$FC->addDatasetsFromDatabase($result, "money", "date","parentYAxis=S");

$FC->addDatasetsFromDatabase($result, "visitors", "date","parentYAxis=P");

is this a good way and will it work? thank you

Post #7083
Posted 6/30/2008 1:05:08 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Today @ 7:54:06 AM
Posts: 644, Visits: 1,948
Hi sizzla,
  It is MSColumn3DLineDY chart and the file name is FCF_MSColumn3DLineDY.swf. It’s a Combination Chart. Please see the docs. http://www.fusioncharts.com/free/docs/Contents/PHPClassAPI/CombinationChart.html   . This will help you for creating A Combination Chart using FusionCharts php API class and also you can add FusionCharts dataset using addDatasetsFromDatabase. Please see function listing from http://www.fusioncharts.com/free/docs/Contents/PHPClassAPI/Functions.html#dbhandling and also see the code bellow.

 # creating FusionCharts object
 $obj = new FusionCharts("MSColumn3DLineDY","400","300");
 $obj->setSWFPath("FusionCharts/");
 
 # Add Category
 $obj->addCategory("week 1");
 $obj->addCategory("week 2");
 
 $strQuery = "select FactoryID,Quantity from factory_output where FactoryID=1 order by FactoryID";
 $result = mysql_query($strQuery) or die(mysql_error());
 
 # Dataset Parameter into arry
 $p[0]="parentYAxis=P";
 # Adding Dataset for Column
 $obj->addDatasetsFromDatabase($result, "FactoryID", "Quantity",$p);

 # Dataset Parameter into arry
 $s[0]="parentYAxis=S";
 $strQuery = "select FactoryID,Quantity from factory_output where FactoryID=2 order by FactoryID";
 $result1 = mysql_query($strQuery) or die(mysql_error());
 # Adding Dataset for Line
 $obj->addDatasetsFromDatabase($result1, "FactoryID", "Quantity",$s);

Thanks,
Arindam

FusionCharts Team
www.fusioncharts.com

Post #7089
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 10:35pm


Execution: 0.031.