Guest Rajroop

MSStackedColumn2D claims to have no data

Recommended Posts

Hello,

 

 

 

in trying to get a multi-series stacked column 2D graph going, I've come into this problem multiple times, even using the example code from the FusionCharts online documentation for the MSStackedColumn2D graph:

 

 

 

"Notice: Undefined offset: 0 in /FusionCharts/PHP/FusionCharts_Gen.php on line 963"

 

 

 

When I build the chart myself using createMSStDataset() followed by addMSStSubDataset(), I get the above PHP error, along with an empty graph saying "No data to display." Using the code from http://www.fusioncharts.com/docs/Contents/PHPClassAPI/MSStackedCDY.html and taking out the line series parts, I get no graph, but instead simply the word "Chart.".

 

 

 

Any information would be greatly appreciated; further information is gladly furnished.

 

 

 

many thanks,

 

HB

Share this post


Link to post
Share on other sites
Guest Rajroop

Hello HB,

 

 

 

Welcome to the FusionCharts Forum. ;)

 

 

 

Could you please refer with the instructions provided in the FusionCharts PHP Class manual using multi-series stacked column 2D graph given by the link below:

 

 

 

http://www.fusioncharts.com/docs/Contents/PHPClassAPI/MSStackedCDY.html

 

 

 

Also, could you please send us your code snippet so that we may have a look at what the problem may be?

 

 

 

Looking forward to your reply. ;)

Share this post


Link to post
Share on other sites

Hello Rajroop,

 

 

 

at this point, I can actually include the test code verbatim (cut and paste) in a file on my server, only making changes for the pathnames. I have successfully created other charts with FC before, so the pathnames work and provide good results. Cutting and pasting the sample code from

 

 

 

http://www.fusioncharts.com/docs/Contents/PHPClassAPI/MSStackedCDY.html

 

 

 

simply produces the word "Chart."

 

 

 

Thanks again, and let me know if there's any more specific information I can give.

 

 

 

best regards,

 

HB

 

 

 

Rajroop (7/3/2009)
Hello HB,

 

 

 

Welcome to the FusionCharts Forum. ;)

 

 

 

Could you please refer with the instructions provided in the FusionCharts PHP Class manual using multi-series stacked column 2D graph given by the link below:

 

 

 

http://www.fusioncharts.com/docs/Contents/PHPClassAPI/MSStackedCDY.html

 

 

 

Also, could you please send us your code snippet so that we may have a look at what the problem may be?

 

 

 

Looking forward to your reply. ;)

Share this post


Link to post
Share on other sites
Guest Rajroop

Hello ;),

 

 

 

Please accept our humble apologies for the delay in the reply.

 

 

 

Could you please send us your source code, so we may have a look?

Share this post


Link to post
Share on other sites

thanks again, Rajroop; here is the code.

 

 

 


// Include FusionCharts PHP Class                                                                                                                                                                                                

require_once(getenv('FUSIONCHARTS_PATH') . 'PHP/FusionCharts_Gen.php');



// Create Multiseries Stacked Column2D Line DY object using FusionCharts PHP Class                                                                                                                                               

$FC = new FusionCharts("MSStackedColumn2DLineDY","450","350");



// Set the relative path of the swf file                                                                                                                                                                                         

$FC->setSWFPath('classes/third_party/FusionCharts/');



// Define chart attributes                                                                                                                                                                                                       

$strParam="caption=Annual Revenue;rotateValues=1;xAxisName=Year;PYAxisName=Revenue;SYAXisName=Cost as %25 of Revenue;numberPrefix=$;numberSuffix=M;sNumberSuffix=%25;SYAxisMinValue=0;SYAxisMaxValue=100;showValues=0;userounded

ges=1;showSum=1";



// Set chart attributes                                                                                                                                                                                                          

$FC->setChartParams($strParam);



// Add category names                                                                                                                                                                                                            

$FC->addCategory("2001");

$FC->addCategory("2002");

$FC->addCategory("2003");

$FC->addCategory("2004");

$FC->addCategory("2005");



// Add Multi-series Dataset                                                                                                                                                                                                      

$FC->createMSStDataset();

// Add Multi-series dataset with in dataset                                                                                                                                                                                      

$FC->addMSStSubDataset("Product A", "");

// Add set data for plotting the chart                                                                                                                                                                                           

$FC->addChartData("30");

$FC->addChartData("26");

$FC->addChartData("29");

$FC->addChartData("31");

$FC->addChartData("34");



// Add Multi-series dataset with in dataset                                                                                                                                                                                      

$FC->addMSStSubDataset("Product B", "");

// Add set data for plotting the chart                                                                                                                                                                                           

$FC->addChartData("30");

$FC->addChartData("26");

$FC->addChartData("29");

$FC->addChartData("31");

$FC->addChartData("34");



// Add Multi-series Dataset                                                                                                                                                                                                      

$FC->createMSStDataset();

// Add Multi-series dataset with in dataset                                                                                                                                                                                      

$FC->addMSStSubDataset("Product C", "");

// Add set data for plotting the chart                                                                                                                                                                                           

$FC->addChartData("30");

$FC->addChartData("26");

$FC->addChartData("29");

$FC->addChartData("31");

$FC->addChartData("34");



// Add Multi-series lineset for showing lines                                                                                                                                                                                    

$FC->addMSLineset("Cost as %25 of Revenue","lineThickness=4");

// Add set data with in lineset                                                                                                                                                                                                  

$FC->addMSLinesetData("57");

$FC->addMSLinesetData("68");

$FC->addMSLinesetData("79");

$FC->addMSLinesetData("73");

$FC->addMSLinesetData("80");



$FC->renderChart();

 

 

 

The setup lines

 

                                                                                                                                                                                          

require_once(getenv('FUSIONCHARTS_PATH') . 'PHP/FusionCharts_Gen.php');

 

and

 

                                                                                                                                                                              

$FC->setSWFPath('classes/third_party/FusionCharts/');

 

 

 

work just fine in other chart applications. When this code is run through my web browser, all that's produced is "Chart.". Other chart styles (multi-series line, single series line, single series column) work just fine.

 

 

 

thanks again,

 

HB

 

 

 

Rajroop (7/9/2009)
Hello ;),

 

 

 

Please accept our humble apologies for the delay in the reply.

 

 

 

Could you please send us your source code, so we may have a look?

Share this post


Link to post
Share on other sites

Hi HB,
 
If it is your complete code then I found that you are not including FusionCharts.js file which is necessary to render the chart.
 
So could you please use the following code with proper path to FusionCharts.js file and try again?
 
// Include FusionCharts PHP Class  

 

require_once(getenv('FUSIONCHARTS_PATH') . 'PHP/FusionCharts_Gen.php');

 

 

// Create Multiseries Stacked Column2D Line DY object using FusionCharts PHP Class

 

$FC = new FusionCharts("MSStackedColumn2DLineDY","450","350");

 

 

 

// Set the relative path of the swf file

 

$FC->setSWFPath('classes/third_party/FusionCharts/');

 

 

 

// Define chart attributes

 

$strParam="caption=Annual Revenue;rotateValues=1;xAxisName=Year;PYAxisName=Revenue;SYAXisName=Cost as %25 of Revenue;numberPrefix=$;numberSuffix=M;sNumberSuffix=%25;SYAxisMinValue=0;SYAxisMaxValue=100;showValues=0;userounded

 

ges=1;showSum=1";

 

 

 

// Set chart attributes  

 

$FC->setChartParams($strParam);

 

 

 

// Add category names  

 

$FC->addCategory("2001");

 

$FC->addCategory("2002");

 

$FC->addCategory("2003");

 

$FC->addCategory("2004");

 

$FC->addCategory("2005");

 

 

 

// Add Multi-series Dataset  

 

$FC->createMSStDataset();

 

// Add Multi-series dataset with in dataset  

 

$FC->addMSStSubDataset("Product A", "");

 

// Add set data for plotting the chart

 

$FC->addChartData("30");

 

$FC->addChartData("26");

 

$FC->addChartData("29");

 

$FC->addChartData("31");

 

$FC->addChartData("34");

 

 

 

// Add Multi-series dataset with in dataset  

 

$FC->addMSStSubDataset("Product B", "");

 

// Add set data for plotting the chart

 

$FC->addChartData("30");

 

$FC->addChartData("26");

 

$FC->addChartData("29");

 

$FC->addChartData("31");

 

$FC->addChartData("34");

 

 

 

// Add Multi-series Dataset  

 

$FC->createMSStDataset();

 

// Add Multi-series dataset with in dataset  

 

$FC->addMSStSubDataset("Product C", "");

 

// Add set data for plotting the chart

 

$FC->addChartData("30");

 

$FC->addChartData("26");

 

$FC->addChartData("29");

 

$FC->addChartData("31");

 

$FC->addChartData("34");

 

 

 

// Add Multi-series lineset for showing lines  

 

$FC->addMSLineset("Cost as %25 of Revenue","lineThickness=4");

 

// Add set data with in lineset  

 

$FC->addMSLinesetData("57");

 

$FC->addMSLinesetData("68");

 

$FC->addMSLinesetData("79");

 

$FC->addMSLinesetData("73");

 

$FC->addMSLinesetData("80");

 

<html>

 <head>

  <title>Multiseries Stacked Column2D Line DY Chart Using FusionCharts PHP Class</title>

<script language='javascript' src='../FusionCharts/FusionCharts.js'></script>

  </head>

  <body>

<?php

# Render Chart

$FC->renderChart();

?>

 

  </body>

</html>

 
You would need to set the path for the FusionCharts.js (marked bold)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now