mbriggs Report post Posted March 15, 2009 (edited) Below is the script that uses the PHP Class. I want to put a Gradiant style on the charts like the online demos have and style the fonts. If i am using the class how to do pass the paramiters to style? For example, the nifty # Set chart attributes $FC->setChartParams($strParam); is very clear and simple. so how can i use the xml structure below to do this in the php class? Where do i set or put this code? Also i see the shadow attribute but there doesn't seem to be one for the gradient effect like the online demos have. <chart> <!-- Your data here --> <styles> <definition> <style name='MyFirstFontStyle' type='font' face='Verdana' size='12' color='FF0000' bold='1' bgColor='FFFFDD' /> <style name='MyFirstAnimationStyle' type='animation' param='_xScale' start='0' duration='2' /> <style name='MyFirstShadow' type='Shadow' color='CCCCCC' /> </definition> <application> <apply toObject='Caption' styles='MyFirstFontStyle,MyFirstShadow' /> <apply toObject='Canvas' styles='MyFirstAnimationStyle' /> <apply toObject='DataPlot' styles='MyFirstShadow' /> </application> </styles> </chart> <?php # Include FusionCharts PHP Class include('../MyFCPHPClassCharts/Class/FusionCharts_Gen.php'); # Create Multiseries Column3D chart object using FusionCharts PHP Class $FC = new FusionCharts("MSColumn3D","350","300"); # Set the relative path of the swf file $FC->setSWFPath("../FusionCharts/"); # Store chart attributes in a variable $strParam="caption=Weekly Sales;subcaption=Comparison;xAxisName=Week;yAxisName=Revenue;numberPrefix=$;decimalPrecision=0"; # Set chart attributes $FC->setChartParams($strParam); # Add category names $FC->addCategory("Week 1"); $FC->addCategory("Week 2"); $FC->addCategory("Week 3"); $FC->addCategory("Week 4"); # Create a new dataset $FC->addDataset("This Month"); # Add chart values for the above dataset $FC->addChartData("40800"); $FC->addChartData("31400"); $FC->addChartData("26700"); $FC->addChartData("54400"); # Create second dataset $FC->addDataset("Previous Month"); # Add chart values for the second dataset $FC->addChartData("38300"); $FC->addChartData("28400"); $FC->addChartData("15700"); $FC->addChartData("48100"); ?> <html> <head> <title>First Chart Using FusionCharts PHP Class</title> <script language='javascript' src='../FusionCharts/FusionCharts.js'></script> </head> <body> <?php # Render Chart $FC->renderChart(); ?> </body> </html> Edited March 15, 2009 by Guest Share this post Link to post Share on other sites
Rahul Kumar Report post Posted March 16, 2009 Hi, Please see the code below to add styles to chart using PHP Class. <?php# Include FusionCharts PHP Class include('../MyFCPHPClassCharts/Class/FusionCharts_Gen.php'); # Create Multiseries Column3D chart object using FusionCharts PHP Class $FC = new FusionCharts("MSColumn3D","350","300"); # Set the relative path of the swf file $FC->setSWFPath("../FusionCharts/"); # Store chart attributes in a variable $strParam="caption=Weekly Sales;subcaption=Comparison;xAxisName=Week;yAxisName=Revenue;numberPrefix=$;decimalPrecision=0"; # Set chart attributes $FC->setChartParams($strParam); # Add category names$FC->addCategory("Week 1"); $FC->addCategory("Week 2"); $FC->addCategory("Week 3"); $FC->addCategory("Week 4"); # Create a new dataset $FC->addDataset("This Month"); # Add chart values for the above dataset $FC->addChartData("40800"); $FC->addChartData("31400"); $FC->addChartData("26700"); $FC->addChartData("54400"); # Create second dataset $FC->addDataset("Previous Month"); # Add chart values for the second dataset $FC->addChartData("38300"); $FC->addChartData("28400"); $FC->addChartData("15700"); $FC->addChartData("48100"); #Add styles.//Define First Style element named MyFirstFontStyle $FC->defineStyle("MyFirstFontStyle","font","font=Verdana;size=12;color=FF0000;bgColor=FFFFDD;borderColor=666666;bold=1"); //Define Second Style element named - MyFirstGlow$FC->defineStyle("MyFirstAnimationStyle","animation", "param=_xScale;start=0;duration=2"); //Define Third Style element named - MyFirstGlow$FC->defineStyle("MyFirstShadow","Shadow","color=CCCCCC"); // Apply Style $FC->applyStyle("CAPTION","MyFirstFontStyle,MyFirstShadow"); // Apply Style$FC->applyStyle("CANVAS","'MyFirstAnimationStyle"); // Apply Style$FC->applyStyle("DATAPLOT","MyFirstShadow"); ?> Also, Please let us know the Online demo name/link (which has gradient effect?). Share this post Link to post Share on other sites
mbriggs Report post Posted March 16, 2009 Thanks very much. That is what i was looking for exactly. the method to use and how to pass into them. Perfect. All the best, Michael Share this post Link to post Share on other sites
mbriggs Report post Posted March 16, 2009 (edited) Also, Please let us know the Online demo name/link (which has gradient effect?). The ones in particular for the gradient result we are looking for are the ones here http://www.fusioncharts.com/Demos/Blueprint/ This will compliment the dashbord very well. Edited March 16, 2009 by Guest Share this post Link to post Share on other sites
mbriggs Report post Posted March 16, 2009 I am getting an error: Fatal error: Call to undefined method FusionCharts::defineStyle() in C:wampwwwreportsmychartsclass_chart_multi_2.php on line 47 Here is the script: <?php # Include FusionCharts PHP Class include('../MyFCPHPClassCharts/Class/FusionCharts_Gen.php'); # Create Multiseries Column3D chart object using FusionCharts PHP Class $FC = new FusionCharts("MSColumn3D","550","500"); # Set the relative path of the swf file $FC->setSWFPath("../FusionCharts/"); # Store chart attributes in a variable $strParam="caption=Weekly Sales;subcaption=Comparison;xAxisName=Week;yAxisName=Revenue;numberPrefix=$;decimalPrecision=0;formatNumberScale=0"; # Set chart attributes $FC->setChartParams($strParam); $chart_data_week1 ="9980"; # Add category names $FC->addCategory("Week 1"); $FC->addCategory("Week 2"); $FC->addCategory("Week 3"); $FC->addCategory("Week 4"); # Create a new dataset $FC->addDataset("This Month"); # Add chart values for the above dataset $FC->addChartData("$chart_data_week1"); $FC->addChartData("31400"); $FC->addChartData("26700"); $FC->addChartData("54400"); # Create second dataset $FC->addDataset("Previous Month"); # Add chart values for the second dataset $FC->addChartData("38300"); $FC->addChartData("28400"); $FC->addChartData("15700"); $FC->addChartData("48100"); #Add styles. //Define First Style element named MyFirstFontStyle $FC->defineStyle("MyFirstFontStyle","font","font=Verdana;size=12;color=FF0000;bgColor=FFFFDD;borderColor=666666;bold=1"); //Define Second Style element named - MyFirstGlow $FC->defineStyle("MyFirstAnimationStyle","animation", "param=_xScale;start=0;duration=2"); //Define Third Style element named - MyFirstGlow $FC->defineStyle("MyFirstShadow","Shadow","color=CCCCCC"); // Apply Style $FC->applyStyle("CAPTION","MyFirstFontStyle,MyFirstShadow"); // Apply Style $FC->applyStyle("CANVAS","'MyFirstAnimationStyle"); // Apply Style $FC->applyStyle("DATAPLOT","MyFirstShadow"); ?> <html> <head> <title>First Chart Using FusionCharts PHP Class</title> <script language='javascript' src='../FusionCharts/FusionCharts.js'></script> </head> <body> <? # Render Chart $FC->renderChart(); ?> </body> </html> Share this post Link to post Share on other sites
mbriggs Report post Posted March 16, 2009 sorry i was using the wrong FushionCharts_gen.php file it works.. Share this post Link to post Share on other sites
mbriggs Report post Posted March 16, 2009 How would you make the datasets different colors like below. one is blue and the Previous month Red? # Create a new dataset $FC->addDataset("This Month"); # Add chart values for the above dataset $FC->addChartData("$chart_data_week1"); $FC->addChartData("31400"); $FC->addChartData("26700"); $FC->addChartData("54400"); # Create second dataset $FC->addDataset("Previous Month"); # Add chart values for the second dataset $FC->addChartData("38300"); $FC->addChartData("28400"); $FC->addChartData("15700"); $FC->addChartData("48100"); Share this post Link to post Share on other sites
Rahul Kumar Report post Posted March 18, 2009 Hi, Please see the code: # Create a new dataset $FC->addDataset("This Month","color=215DDE"); # Add chart values for the above dataset $FC->addChartData("$chart_data_week1"); $FC->addChartData("31400"); $FC->addChartData("26700"); $FC->addChartData("54400"); # Create second dataset $FC->addDataset("Previous Month","color=ff0000"); # Add chart values for the second dataset $FC->addChartData("38300"); $FC->addChartData("28400"); $FC->addChartData("15700"); $FC->addChartData("48100"); Also please see http://www.fusioncharts.com/docs/Contents/PHPClassAPI/Functions.html for more information about API functions. Share this post Link to post Share on other sites