anirbansarkar Report post Posted January 29, 2010 Hi, I want to make a combination of bar chart and line chart where the data for one financial year will be portrayed with bar chart whereas the data for another financial year will be portrayed using a line chart. I am using PHP + MySQL . Any help in this context will be highly appreciated. Thanks in advance!!! Share this post Link to post Share on other sites
Ayan Pal Report post Posted February 1, 2010 (edited) Hi anirbansarkar, this is a sample code quite same as you required. <?php #We've also used ../Includes/DBConn.php to easily connect to a database. include("../Includes/DBConn.php"); # Include FusionCharts PHP Class include('../Class/FusionCharts_Gen.php'); #Connect to the DB $link = connectToDB(); # Create Column 3D + Line Dual Y-Axis Combination Chart $FC = new FusionCharts("MSCombi2D","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;pYAxisName=Revenue;sYAxisName=Total Quantity;numberPrefix=$;sNumberSuffix= U"; # Set chart attributes $FC->setChartParams($strParam); #Sets the type of the Database $FC->setDataBaseType("mysql"); # Add category names $strQuery = "select distinct weekNames from Sales"; $result = mysql_query($strQuery); $FC->addCategoryFromDatabase($result, "weekNames"); # Add a new dataset with dataset parameters $strQuery = "select weekNames,revenue from Sales WHERE financialyear='2010'"; $result = mysql_query($strQuery); $FC->addDatasetsFromDatabase($result, "weekNames", "revenue"); # Add a new dataset with dataset parameters fpr previous year as line $datasetParamArray=["renderAs=Line']; $strQuery = "select weekNames,revenue from Sales WHERE financialyear='2009'"; $result = mysql_query($strQuery); $FC->addDatasetsFromDatabase($result, "weekNames", "revenue",$datasetParamArray); ?> <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> please change the code as per your exact requirement. you may refer to these links--> http://www.fusioncharts.com/Docs http://www.fusioncharts.com/Docs/Contents/PHPClassAPI/Functions.html http://www.fusioncharts.com/Docs/Contents/PHPClassAPI/CombinationChart.html Edited February 1, 2010 by Guest Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 2, 2010 Many thanks for the reply. I tried executing the code with modifications as per my requirement but I cannot get rid of a syntax error in the line <code> $datasetParamArray=["renderAs=Line']; </code> The syntax error is : Parse error: syntax error, unexpected '[' in <line and page details> Kindly help!!! Share this post Link to post Share on other sites
Ayan Pal Report post Posted February 2, 2010 Hi anirbansarkar, please see attached zip file for sample code. please change the code as per your requarement sample.zip Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 2, 2010 Thanks. I am doing it on the lines of sample.zip with modifications as per my requirement. The first series is showing in bar but the second series in line is still not appearing. However, no errors are also being shown!! ?? Share this post Link to post Share on other sites
Guest Madhumita Report post Posted February 4, 2010 Hello, Could you please attach the modified file along with a screnn-shot of the chart? Apologies for the inconvenience. Awaiting your reply. Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 4, 2010 Many thanks for your response. I am attaching a zip file with the required contents. Regards!!! chart.zip Share this post Link to post Share on other sites
Ayan Pal Report post Posted February 5, 2010 Hi anirbansarkar, please see attached zip file for the modified index.php, it is modified as per your database. index.zip Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 5, 2010 Thanks a ton !!! Share this post Link to post Share on other sites
Guest Basundhara Ghosal Report post Posted February 5, 2010 Hi Anirban, You are welcome. Glad to help you. Happy FusionCharting. Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 8, 2010 Thanks once again!!! Just a query - Hope I can add another line series to the existing combination chart if I want to chart a 3 year comparison data, i.e - combination of one bar chart and two line charts to chart the data of 3 financial years. Regards. Share this post Link to post Share on other sites
Guest Basundhara Ghosal Report post Posted February 8, 2010 Hi Anirban, You are welcome. Yes, you can render one more line chart in the same combination chart just by adding one more dataset which has to be rendered as line. Hope this helps. Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 15, 2010 Hi, I have plotted a combination chart using 3 financial years - one bar chart series and two line chart series. The chart is appearing as per my requirement. The only thing which I require is that the chart should be a normal acombination chart and not a 3D one. I have used the 'MSCombi3D' chart type. What do I actually need to use? Any help will be highly appreciated. Regards, Anirban Sarkar Share this post Link to post Share on other sites
Guest Madhumita Report post Posted February 15, 2010 Hello, You require the MSCombi2D chart. ref. - http://www.fusioncharts.com/docs/Contents/ChartSS/Combi2D.html Hope this helps. Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 15, 2010 Many thanks once again. But from where will I get the required .swf file. I do not have it with me. At the same time, I need to plot the data points in the line chart. What do I need to do for that? Thanks and regards!!! Share this post Link to post Share on other sites
Guest Madhumita Report post Posted February 15, 2010 (edited) Hello, I can provide you with the evaluation version of FusionCharts V3 MSCombi2D.swf. Please refer to the link below which demostrates how to plot a single series chart. http://www.fusioncharts.com/docs/Contents/PHP_DB.html In case od a line chart you need to follow the same logic. MSCombi2D.zip Edited February 15, 2010 by Guest Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 16, 2010 Many thanks once again!!! I have been able to plot the 2D graph with the .swf file provided. Is there any way by which I can suppress the values appearing against every plot points? Thanks and regards. Share this post Link to post Share on other sites
Guest Basundhara Ghosal Report post Posted February 16, 2010 Hi Anirban, You are welcome. Please try setting the the attribute "showValues" to '0' i.e, zero in the <dataset> element. Please refer to the link below:- Ref.- http://www.fusioncharts.com/docs?/ChartSS/MSStColLineDY.html Hope this helps. Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 17, 2010 Many thanks once again!!! I have been able to suppress the data values in the bar chart by using the dataset attribute showValues to 0. However the same is not happening in case of line chart. I am using the following code: <CODE> $FC_bbgs->addDataset($last_1_fin_yr_desc,"renderAs=Line","showValues=0"); </CODE> Where am I going wrong? Thanks and regards!!! Share this post Link to post Share on other sites
Guest Basundhara Ghosal Report post Posted February 17, 2010 Hi Anirban, Happy to help you. In case you wish not to display the values of the line plot, please try setting the "showValues" to '0' in the <lineset> element. Hope this helps. Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 18, 2010 Hi, I am having problems when generating a pie chart with links. I have generated the pie chart and want to make every individual slice a link which in turn will redirect me to another page. Please refer to the function getPoDueXML in the attached file. The problem which I am facing is that the chart is not getting generated and it is showing 'Invalid XML data'. Also having problems regarding the suppressing of data values in the line chart which I had posted earlier. Thanks and regards!!! ChartGen.zip Share this post Link to post Share on other sites
Ayan Pal Report post Posted February 18, 2010 Hi anirbansarkar, could you please try this code in your function @$strXML .= "<set label='" . escapeXML($wing_name,$forDataURL) . "' value='" . $row_tot_amt['tot_po_due'] . "' isSliced='" . $slicedOut . "' link='" . urlencode($strLink) . "' />"; Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 18, 2010 That's GR8!!! Thanks a ton, once again!!! Share this post Link to post Share on other sites
Guest Basundhara Ghosal Report post Posted February 18, 2010 Hi Anirban, We are happy that your issue is resolved. Happy FusionCharting and keep FusionCharting. Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 19, 2010 Hi, I have not yet been able to suppress the data values in the line chart. As per your suggestion I tried setting the showValues attribute to 0 in the <lineset> element but I feel that I am going wrong somewhere. In case of the bar chart I am using the undergiven code which is working fine: <code> $FC->addDataset($row_fin_yr_desc['fin_desc'],'showValues=0'); </code> Following the above concept, I tried the following in case of line chart which however is not working: <code> $FC->addDataset($last_1_fin_yr_desc,"renderAs=Line",'showValues=0'); </code> Where am I going wrong? Any help will be appreciated. Thanks and regards!!! Share this post Link to post Share on other sites
Guest Basundhara Ghosal Report post Posted February 19, 2010 Hi Anirban, Could you please specify the name of the swf file that you are using for this? Awaiting your reply. Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 19, 2010 The name of the swf file is 'MSCombi2D' Thanks and regards!!! Share this post Link to post Share on other sites
Guest Rajroop Report post Posted February 19, 2010 Hi Anirban, Could you please send us your generated XML for this? You may obtain the same using the debug window. Ref.- http://www.fusioncharts.com/docs/?Debug/window.html Looking froward to your reply. Share this post Link to post Share on other sites
anirbansarkar Report post Posted February 26, 2010 I want to plot the data of last 3 financial years quarter wise in a column chart. I want to plot the summation of every quarter for the last three financial years, including the current financial year - 2009/2010. The graph will be as follows: In the X axis there will be 3 points for FY-0708, FY-0809 and FY-0910 respectively. Against every financial year point there will be 4 bars (each bar representing a particular quarter of the financial year). So overall, there will be 4 bars against every financial year and 12 bars in total subject to availability of data. I have tried doing the same but feel that I am going wrong somewhere. I am uploading a zip file with the code snippet. The code only contains the script for one financial year. Hope this code can be replicated for the other two financial years. Any help will be highly appreciated. Thanks and regards. chart.zip Share this post Link to post Share on other sites
Ayan Pal Report post Posted March 1, 2010 (edited) Hi anirbansarkar, as per your requirement you have to add four quarters of financial year as categories, then add latest 3 years as dataset with it's quarters as set within it. for details you can refer to this link http://www.fusioncharts.com/docs/Contents/PHPClassAPI/Functions.html#dbhandling hope this will help you:) Edited March 1, 2010 by Guest Share this post Link to post Share on other sites