Pzr Report post Posted November 3, 2009 Hi folks, I've been looking at the examples fpr PHP and "Combining FusionCharts, PHP & Javascript (dataURL/dataXML) method's" but don't seem to make it work. The problem is I have more than 1 (one) variable I want to pass to the detailed.php that makes the second query. Would anyone please give me an example with more than one variable!? :-) (Eg. $labid, $startdate, $enddate and $type) /Emanuel Share this post Link to post Share on other sites
FusionCharts Support Report post Posted November 3, 2009 Hi, Could you please try once URLEncoding the URL before passing. Share this post Link to post Share on other sites
Pzr Report post Posted November 3, 2009 Hello, function updateChart($ustype,$labid,$labname,$datefrom,$dateto){ //DataURL for the chart var strURL = "Detailed_data.php?ustype=" + $ustype + "&labid=" + $labid + "&labname" + $labname + "&datefrom" + $datefrom + "&dateto" + $dateto; And then: $strXML .= "<set label='$ustype' value='$antal' link='javaScript:updateChart('+$ustype+','+$labid+','+$labname+','+$datefrom+','+$dateto+')'/>"; Is there much wrong in my code??? :-) When leaving out the 'link=...' everything works fine with the first of my charts. But when having 'link=...' in the $strXML I get an "Invalid XML data". With debug: Info: Chart loaded and initialized. Initial Width: 500 Initial Height: 300 Scale Mode: noScale Debug Mode: Yes Application Message Language: EN Version: 3.1.1 Chart Type: 2D Doughnut Chart Chart Objects: BACKGROUND CANVAS CAPTION SUBCAPTION DATALABELS DATAPLOT TOOLTIP INFO: Chart registered with external script. However, the DOM Id of chart has not been defined. You need to define it if you want to interact with the chart using external scripting. INFO: XML Data provided using dataXML method. ERROR: Invalid XML encountered. An XML element is malformed. Click the above "dataURL Invoked" link to see the XML in browser Or check the XML data provided. /Emanuel Share this post Link to post Share on other sites
Pzr Report post Posted November 3, 2009 ok, tried to urlencode the variables: $dataURL = urlencode("ustype=$ustype&labid=$labid&labname=$labname&datefrom=$datefrom&dateto=$dateto"); $strXML .= "<set label='$ustype' value='$antal' link='javaScript:updateChart(". $dataURL .")'/>"; (correct?) And then in the java: function updateChart($dataURL){ //DataURL for the chart var strURL = "Detailed_data.php?"+$dataURL; It's a no-no. /Emanuel Share this post Link to post Share on other sites
FusionCharts Support Report post Posted November 3, 2009 Hi, could you please try using unescapelinks='0'? Share this post Link to post Share on other sites
Pzr Report post Posted November 4, 2009 (edited) Hello, Added the unescapeLinks '0', and now there seem to some action atleast. :-) Here's the debuginfo from second chart: Info: Chart loaded and initialized.Initial Width: 600 Initial Height: 250 Scale Mode: noScale Debug Mode: Yes Application Message Language: EN Version: 3.1.1 Chart Type: Single Series 2D Column Chart Chart Objects: BACKGROUND CANVAS CAPTION SUBCAPTION YAXISNAME XAXISNAME DIVLINES YAXISVALUES HGRID DATALABELS DATAVALUES TRENDLINES TRENDVALUES DATAPLOT TOOLTIP VLINES VLINELABELS INFO: Chart registered with external script. DOM Id of chart is DATADetailed INFO: XML Data provided using dataXML method. XML Data: <chart /> No Data to Display: No data was found in the XML data document provided. Possible cases can be: There isn't any data generated by your system. If your system generates data based on parameters passed to it using dataURL, please make sure dataURL is URL Encoded. You might be using a Single Series Chart .swf file instead of Multi-series .swf file and providing multi-series data or vice-versa. INFO: setDataURL method invoked from external script. INFO: XML Data provided using dataURL method. dataURL provided: Detailed_data.php%3Fundefined dataURL invoked: Detailed_data.php?undefined&FCTime=24609 XML Data: <chart caption=", , to " subCaption="DLP" showFCMenuItem="0" decimalPrecision="000" showNames="0" numberSuffix="" numberPrefix="" formatNumberScale="00" rotateLabels="1" slantLabels="1" /> No Data to Display: No data was found in the XML data document provided. Possible cases can be: There isn't any data generated by your system. If your system generates data based on parameters passed to it using dataURL, please make sure dataURL is URL Encoded. You might be using a Single Series Chart .swf file instead of Multi-series .swf file and providing multi-series data or vice-versa. Any idea, it seems my URLencoded data is not interpred correct. dataURL provided: Detailed_data.php%3FundefineddataURL invoked: Detailed_data.php?undefined&FCTime=24609 /Emanuel Edited November 4, 2009 by Guest Share this post Link to post Share on other sites
FusionCharts Support Report post Posted November 4, 2009 Hi, If you go deeper into how the URL is passed to updateChart() , you will see that the string that is getting passed is not enveloped by a quote (") or apostrope ('). So JavaScript woudl take the wholestring as a variable! explaination: when you call updateChart("thisIsAString") "thisIsAString" constant/value passed to the function's parameter variable $dataURL. But, when you call updateChart(thisIsAString) JavaScript expects thisIsAString as a vairable adn searches for its value ...it is found "undefined" and hence "undefined" is passed to the function's parameter variable $dataURL. Solution: Envelop the string within quotes/apostrophe. link='updateChart("". $dataURL ."")'/>"; or link='updateChart('". $dataURL ."')'/>"; or link='updateChart("". $dataURL ."")'/>"; Share this post Link to post Share on other sites
Pzr Report post Posted November 4, 2009 Hello again, When putting in " at both ends of the variable dataURL I get an error... $dataURL = urlencode("ustype="$ustype"&labid="$labid"&labname="$AE"&datefrom="$datefrom"&dateto="$dateto""); $strXML .= "<set label='$ustype' value='$antal' link='javaScript:updateChart("".$dataURL."")'/>"; And with " at both ends as in link='javaScript:updateChart("".$dataURL."")'/>"; there is an XML-error generated.Do you have any other suggestions for me? :-) Much appreciated! /Emanuel Share this post Link to post Share on other sites
Pzr Report post Posted November 4, 2009 (edited) done some progress (i think), I've come so far that I get this in the second chart: Info: Chart loaded and initialized.Initial Width: 600 Initial Height: 250 Scale Mode: noScale Debug Mode: Yes Application Message Language: EN Version: 3.1.1 Chart Type: Single Series 2D Column Chart Chart Objects: BACKGROUND CANVAS CAPTION SUBCAPTION YAXISNAME XAXISNAME DIVLINES YAXISVALUES HGRID DATALABELS DATAVALUES TRENDLINES TRENDVALUES DATAPLOT TOOLTIP VLINES VLINELABELS INFO: Chart registered with external script. DOM Id of chart is DATADetailed INFO: XML Data provided using dataXML method. XML Data: <chart /> No Data to Display: No data was found in the XML data document provided. Possible cases can be: There isn't any data generated by your system. If your system generates data based on parameters passed to it using dataURL, please make sure dataURL is URL Encoded. You might be using a Single Series Chart .swf file instead of Multi-series .swf file and providing multi-series data or vice-versa. INFO: setDataURL method invoked from external script. INFO: XML Data provided using dataURL method. dataURL provided: Detailed_data.php%3Fustype%3D%27DT%20BUK%27%26labid%3D%27CT%20L-9%27%26labname%3D%27SUASRTGCT1%27%26datefrom%3D%2720091103%27%26dateto%3D%2720091104%27 dataURL invoked: But then nothing. The change made to make this work this far, was when putting ' around the variables to be urlencoded: $dataURL = urlencode("ustype='$ustype'&labid='$labid'&labname='$AE'&datefrom='$datefrom'&dateto='$dateto'"); Might there be something wrong with the urlencoded data anyway? Edited November 4, 2009 by Guest Share this post Link to post Share on other sites
Pzr Report post Posted November 5, 2009 (edited) Update: I've managed to get thru a dataURL, but dont understand why It stops here. Is there a urlencode error with my variables? /E UPDATE! problem solved. did too much changes at same time! :-) Edited November 5, 2009 by Guest Share this post Link to post Share on other sites
FusionCharts Support Report post Posted November 5, 2009 Hi, This actually depends technically where you are calling the dataURL a) while updating an existing chart or while removing an existing the chart and creating a new JavaScript instance of the chart all from scratch. for a) you can use ' but for you need to use %25apos; (i.e. URL Encoded ' ). It could be because, all chart settings like dataURL, regirsterWithJS, debugMode, chartWidth, chartHeight are passed as a querystring of Flash player's FlashVars parameter. & in " acts a querystring variable separator and do not act a QUOTE. Share this post Link to post Share on other sites