PDA

View Full Version : Error in loading data



LedrickLeron
20 Feb 2008, 1:35 PM
I am trying to load FusionCharts data with dataURL and I am getting Error in Loading data, and I can't really figure out why?

Here is the code I am using:


var chartBuild = function() {
chartBuild.superclass.constructor.call(this, {
region: 'center',
id: 'chartIDDiv',
border: false,
loadMask: true,
listeners: {
'render': {
fn: function() {
chart_chartID = new FusionCharts("flash/MSStackedColumn2D.swf", "chartID", "950", "350", "0", "1");
chart_chartID.addParam("wmode", "transparent");
chart_chartID.setDataURL("/newBuilds/createChart.php?date=2007-11-28&chartType=stacked&view=all");
chart_chartID.render("chartIDDiv");
},
scope: this,
single: true
}
}
});
}

Ext.extend(chartBuild, Ext.Panel, { });


here is the php code (pretty basic):


<?php
include('includes/functions.php');

$queryRetrn = createArray("getfree",$_GET["date"]);
echo buildXML($queryRetrn,$_GET["chartType"]);

?>


and what is returned:


<chart caption='Datacenter by Datacenter Overview of Current Storage' xAxisName='Datacenters' yAxisName='Storage (TB)' showSum='0' showValues='0' labelDisplay='ROTATE' slantLabels='1'><categories><category label='2Bell' /><category label='Allen' /><category label='Bothell' /><category label='GDC' /><category label='Nashville' /><category label='Windward' /><category label='WWDC-Lab' /></categories><dataset><dataSet seriesName='hds-alloc'><set value='0' /><set value='0' /><set value='597463' /><set value='0' /><set value='0' /><set value='871860' /><set value='33317' /></dataSet><dataSet seriesName='hds-phys'><set value='0' /><set value='0' /><set value='871829' /><set value='0' /><set value='0' /><set value='982747' /><set value='40751' /></dataSet></dataset><dataset><dataSet seriesName='emc-alloc'><set value='1593074' /><set value='449951' /><set value='559280' /><set value='94750' /><set value='440737' /><set value='372684' /><set value='15279' /></dataSet><dataSet seriesName='emc-phys'><set value='1837195' /><set value='686526' /><set value='886102' /><set value='152825' /><set value='889951' /><set value='637750' /><set value='24268' /></dataSet></dataset><dataset><dataSet seriesName='ebr-alloc'><set value='1447650' /><set value='472053' /><set value='1069863' /><set value='17007' /><set value='16624' /><set value='1135714' /><set value='6118' /></dataSet><dataSet seriesName='ebr-phys'><set value='1825921' /><set value='622973' /><set value='1501617' /><set value='17930' /><set value='54795' /><set value='1364395' /><set value='13117' /></dataSet></dataset><dataset><dataSet seriesName='eva-alloc'><set value='820434' /><set value='36373' /><set value='174970' /><set value='0' /><set value='69296' /><set value='647483' /><set value='47315' /></dataSet><dataSet seriesName='eva-phys'><set value='950019' /><set value='146582' /><set value='414656' /><set value='0' /><set value='93337' /><set value='789240' /><set value='87720' /></dataSet></dataset></chart>



any insite would be helpful.

evant
20 Feb 2008, 1:55 PM
You've given us all your code, but "an error"? What happens? Is it an error inside the flash object? Does firebug give a specific error?

LedrickLeron
20 Feb 2008, 2:00 PM
Ah good point... brain fart!!!

The error occurs in the Flash object, so I took what the html(from source code) output was put it in an .xml file and change the setDataUrl to the xml file I am able to load the flash chart with no issues,

When the setDataURL is set to the php file i get the error... Also just as note I when I run the .php file as it is put in the Ext code, The page itself doesnt show anything, but the source code is where I find all the data... could this be the issue? if so how to resolve that?

LedrickLeron
20 Feb 2008, 2:28 PM
Okay I put into my php file the following to make the data appear on the HTML page, however still getting the "Error in loading data"

again the XML is valid, I have been using the same XML in my test xml files for setDataURL and in my other working code.

evant
20 Feb 2008, 2:47 PM
I've worked with FC before, why don't you put the chart into debug mode?

LedrickLeron
20 Feb 2008, 2:57 PM
that is setting the second form into 1 correct?

chart_chartID = new FusionCharts("flash/MSStackedColumn2D.swf", "chartID", "950", "350", "0", "1");

LedrickLeron
20 Feb 2008, 3:07 PM
Ah setting the first digit to 1 sorry ... when I am setting my dataURL it appears that the whole string is not being sent over:



Info: Chart loaded and initialized.
Initial Width: 950
Initial Height: 370
Scale Mode: noScale
Debug Mode: Yes
Application Message Language: EN
Version: 3.0.4
Chart Type: Multi Series Stacked 2D Column Chart
Chart Objects:
BACKGROUND
CANVAS
CAPTION
SUBCAPTION
YAXISNAME
XAXISNAME
DIVLINES
YAXISVALUES
HGRID
DATALABELS
DATAVALUES
TRENDLINES
TRENDVALUES
DATAPLOT
TOOLTIP
VLINES
LEGEND

INFO: Chart registered with external script. DOM Id of chart is chartID
INFO: XML Data provided using dataURL method.
dataURL provided: createChart.php?date=2007-11-28
dataURL invoked: createChart.php?date=2007-11-28
ERROR: An error occurred while loading data. Please check your dataURL, by clicking on the "dataURL invoked" link above, to see if it's returing valid XML data. Common causes for error are:
No URL Encoding provided for querystrings in dataURL. If your dataURL contains querystrings as parameters, you'll need to URL Encode the same. e.g., Data.asp?id=101&subId=242 should be Data%2Easp%3Fid%3D101%26subId%3D242



and here is all my NEW code I have done:


var strURL = "createChart.php?date=2007-11-28&chartType=stacked&view=all";
strURL = unescape(strURL);

chart_chartID = new FusionCharts("flash/MSStackedColumn2D.swf", "chartID", 950, 370, "1", "1");
chart_chartID.addParam("wmode", "transparent");
//chart_chartID.setDataURL("/newBuilds/createChart.php?date=2007-11-28&chartType=stacked&view=all");
chart_chartID.setDataURL(strURL);
//chart_chartID.setDataURL("xml/new.xml");

chartBuild.superclass.constructor.call(this, {
region: 'center',
id: 'chartIDDiv',
border: false,
loadMask: true,
listeners: {
'render': {
fn: function() {
chart_chartID.render("chartIDDiv");
},
scope: this,
single: true
}
}
});
}

Ext.extend(chartBuild, Ext.Panel, { });