Unable to display chart using PHP 5.2.5
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Unable to display chart using PHP 5.2.5 Expand / Collapse
Author
Message
Posted 6/12/2008 8:22:29 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/13/2008 7:49:38 PM
Posts: 2, Visits: 5
Hello everyone,

I'm testing the FCF version and stuck with an issue:

My page template display HTML code via a variable assign:

$page->html .= "HTML Code";

So I did runs all the authentication, chart type selection and then I have the code like this:

===================== Begin of code ========================================

    # Create Column3D chart Object
     $chart = new FusionCharts("Column3D","300","250");
     
     $page->html .= "After create chart object?<br>";
     
     # set the relative path of the swf file
     $chart->setSWFPath( FCF_CHART_LIBRARY_PATH );
     
     $page->html .= "After declaring the chart SWF path<br>";
     
     # Set chart attributes
     $strParam="caption=Weekly Sales;xAxisName=Week;yAxisName=Revenue;numberPrefix=$;decimalPrecision=0;formatNumberScale=1";
     
     $chart->setChartParams( $strParam );
     $page->html .= "After setting the chart paramters<br>";

     # add chart values and category names
     $chart->addChartData("40800","name=Week 1");
     $chart->addChartData("31400","name=Week 2");
     $chart->addChartData("26700","name=Week 3");
     $chart->addChartData("54400","name=Week 4");
     
     $page->html .= "After sending the chart data<br>";
     
     $page->html .= '<script language="javascript" src="' . FCF_CHART_LIBRARY_PATH . 'FusionCharts.js"></script>';
         
     # Render Chart 
       $page->html .= $chart->renderChart();

============================ End of Code ============================

Unfortunately, the page renders only the word : Chart. on top of my template before all of my page generation. When I check the source this is what generated above all my HTML code:

===================== Begin block code ========================================

<!-- START Script Block for Chart Column3D73 -->
 <div id="Column3D73Div" align="center">
  Chart.
 </div>
 <script type="text/javascript"> 
  //Instantiate the Chart 
  var chart_Column3D73 = new FusionCharts("http://hcrpms/fusionchartfree/fusioncharts/FCF_Column3D.swf", "Column3D73", "300", "250");
  //Provide entire XML data using dataXML method
  chart_Column3D73.setDataXML("<graph caption='Weekly Sales' xAxisName='Week' yAxisName='Revenue' numberPrefix='$' decimalPrecision='0' formatNumberScale='1'  ><set  value='40800' name='Week 1'  color='AFD8F8'  /><set  value='31400' name='Week 2'  color='F6BD0F'  /><set  value='26700' name='Week 3'  color='8BBA00'  /><set  value='54400' name='Week 4'  color='A66EDD'  /></graph>")
  //Finally, render the chart.
  chart_Column3D73.render("Column3D73Div");
 </script> 
 <!-- END Script Block for Chart Column3D73 -->

====================== End block code ================================

From a comparison with other codes that works by itself, this little section has to go inside the <body></body> for it to work properly. Not sure why mine didn't.

I even tried this:

$page->html .= $chart->renderChart();

But the result is the same.

Any help in solving this issue will be greatly appreciated.

Regards,

Post #6815
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 11:40pm


Execution: 0.047.