Bliksem

Missing } After Property List

Recommended Posts

Hi all,

 

I hope you can help me with a solution to this problem I am having.

 

I have adapted the FusionCharts JavaScript code to export graphs to images, but I get a very strange error, which I am absolutely unable to trace.

 

missing } after property list


Notice: Uninitialized string offset:  0 in /srv/.../FusionChartsExportHandlers/FCExporter.php on line 419

 

 

Now... Line 419 in that file looks like this:

 

 

$arrStatus [] = "DOMId=" . @$meta["DOMId"];

 

 

It is about the 4th line of code (excluding comments) in the function parseExportedStatus.

 

As my graphs are rendering fine, and the error did not occur before I attempted to export the graphs to JPG, I assume that my data structure for the graphs are fine, but I did take the generated JS source for the graphs, and evaluated it for missing quotes, and brackets, and general syntax errors, which are none. Hence I am not going to paste my chart code here - I am sure that works.

 

So the only thing remaining is the JavaScript I have added to export the graph. This looks as follows

 


<script type="text/javascript">

   function FC_Rendered (domID)
   {
       if (domID == "<?php echo $chartID1; ?>")
       {
           if (FusionCharts('<?php echo $chartID1; ?>').exportChart)
           {
               FusionCharts('<?php echo $chartID1; ?>').exportChart( { "exportFormat" : '<?php echo $exportFormat; ?>' } );
           }
       }
       else if (domID == "<?php echo $chartID2; ?>")
       {
           if (FusionCharts('<?php echo $chartID2; ?>').exportChart)
           {
               FusionCharts('<?php echo $chartID2; ?>').exportChart( { "exportFormat" : '<?php echo $exportFormat; ?>' } );
           }
       }
   }

   function FC_Exported (statusObj)
   {
       if (typeof count_rendered == 'undefined')
       {
           count_rendered = 0;
       }
       if (statusObj.DOMId == "<?php echo $chartID1; ?>")
       {
           $('#filename1').text(statusObj.fileName);
           count_rendered += 1;
       }
       else if (statusObj.DOMId == "<?php echo $chartID2; ?>")
       {
           $('#filename2').text(statusObj.fileName);
           count_rendered += 1;
       }
       if (count_rendered == 2)
       {
           $('#print-icon-action').show();
           $('#print-icon-message').hide();
       }
   }

</script>

<div id="filename1" style="display: none;"></div>
<div id="filename2" style="display: none;"></div>

 

(The filename divs is just so that I can reference the filename of the image that was exported).

 

Can anybody see anything wrong with this code? Why would I get this error?

Edited by Bliksem

Share this post


Link to post
Share on other sites
Guest Sumedh

Greetings, smile.gif

 

Could you please confirm, FusionChartsExportComponent.js file is included in your project or not?

 

And also, could you please send, the error code after enabling it in debug mode?

 

For debugging, please read more here: http://docs.fusioncharts.com/charts/contents/?exporting-image/ECReferenceDebugJS.html

 

Awaiting your response.

 

Hope you have a great day. smile.gif

Share this post


Link to post
Share on other sites
Greetings, smile.gif

 

Could you please confirm, FusionChartsExportComponent.js file is included in your project or not?

 

And also, could you please send, the error code after enabling it in debug mode?

 

For debugging, please read more here: http://docs.fusioncharts.com/charts/contents/?exporting-image/ECReferenceDebugJS.html

 

Awaiting your response.

 

Hope you have a great day. smile.gif

 

Hi Sumedh,

 

No, I have not included the js file you mentioned. I have done this before in another project that works without including this component as well. Since I do not use this JS file, I can not switch the debug mode on..

 

Maybe I should explain how I implemented fusioncharts?

 

1. I use the PHP version for most functionality

2. I include fusioncharts.js in my <head> tag

3. I use a function to build my chart, as shown below:

 


   function BuildChart($chartdata, $chartsettings, $chartbase)
   {
       $FC = new FusionCharts($chartbase['type'], $chartbase['width'], $chartbase['height']);
       $FC->chartID = $chartsettings['chartID'];
       $FC->setSWFPath(base_url(). "application/libraries/fusioncharts/");
       $FC->setChartParams(ChartSettings($chartsettings));
       foreach ($chartdata as $key => $value)
       {
           $FC->addChartData($value, "Label=" . $key);
       }
       return $FC->renderChart(false, false);
   }

 

4. I did not have to include any additional code to export the charts in the previous project that it did work in.

5. I compared the code of these projects, and I **think** I have replicated it correctly, but the code is obviously not exactly the same as it is totally different projects.

6. Using Code Igniter 2.x and MySQL 5.2.x database, and XAMPP as development stack locally, and a flavor of Debian Linux on deployment server.

 

I do not know what else to tell you. I hope this helps in tracking the problem further.

 

Thank you for your response!

 

Kobus

Share this post


Link to post
Share on other sites

Here is the exporting method I am using: http://docs.fusionch...ServerSave.html

 

Thanks again!

 

Kobus

 

Hi again,

 

I have alerted out the following

alert(FusionCharts('<?php echo $chartID2; ?>').exportChart);

, and got the a strange error that appears to state that my chart may not have completed rendering...

 


function () {
   if (this.ref === void 0 ||
       this.ref === null || typeof this.ref[b] !== "function") {
       a.raiseError(this, "25081617", "run", "~" + b + "()", "ExternalInterface call failed. Check whether chart has been rendered.");
   } else {
       return this.ref[b].apply(this.ref, arguments);
   }
}

 

Now this is strange, because I am calling the export function in the FC_Rendered() function, which is the function called after the chart was generated. Not true?

 

Kobus

 

PS: EDIT: I have now delayed the call for rendering for 15 seconds, and the error still occurs. Not sure what to do next.

Edited by Bliksem

Share this post


Link to post
Share on other sites

I have switched the debugger on now, and found that all five my charts have rendered.

 

Some of them are missing the "dataloaded" event though [ss_error]. But the graphs all render perfectly as intended, as shown in [ss_rendered] screenshot.

 

Any hints would be greatly appreciated. This thing has had me running around like a headless chicken for several hours now... :-(

 

post-27553-0-99371900-1330007843_thumb.png

post-27553-0-72713700-1330007873_thumb.png

Share this post


Link to post
Share on other sites

Here is my rendered JS code:

 

   function FC_Rendered (domID)    {        //FusionCharts.debugMode.enabled(true);        //FusionCharts.debugMode.outputTo( function() { console.log(arguments); } );        //FusionCharts.debugMode.outputFormat('verbose');        if (domID == "SolvLiqCur")        {            if (FusionCharts('SolvLiqCur').exportChart)            {                FusionCharts('SolvLiqCur').exportChart( { "exportFormat" : 'JPG' } );            }        }        else if (domID == "Profitability")        {            if (FusionCharts('Profitability').exportChart)            {                FusionCharts('Profitability').exportChart( { "exportFormat" : 'JPG' } );            }        }        else if (domID == "RevenueEmpl")        {            if (FusionCharts('RevenueEmpl').exportChart)            {                FusionCharts('RevenueEmpl').exportChart( { "exportFormat" : 'JPG' } );            }        }        else if (domID == "GovRels")        {            if (FusionCharts('GovRels').exportChart)            {                FusionCharts('GovRels').exportChart( { "exportFormat" : 'JPG' } );            }        }        else if (domID == "LiqDebtInterest")        {            if (FusionCharts('LiqDebtInterest').exportChart)            {                FusionCharts('LiqDebtInterest').exportChart( { "exportFormat" : 'JPG' } );            }        }    }    function FC_Exported (statusObj)    {        if (typeof count_rendered == 'undefined')        {            count_rendered = 0;        }        if (statusObj.DOMId == "SolvLiqCur")        {            $('#filename1').text(statusObj.fileName);            count_rendered += 1;        }        else if (statusObj.DOMId == "Profitability")        {            $('#filename2').text(statusObj.fileName);            count_rendered += 1;        }        else if (statusObj.DOMId == "RevenueEmpl")        {            $('#filename3').text(statusObj.fileName);            count_rendered += 1;        }        else if (statusObj.DOMId == "GovRels")        {            $('#filename4').text(statusObj.fileName);            count_rendered += 1;        }        else if (statusObj.DOMId == "LiqDebtInterest")        {            $('#filename5').text(statusObj.fileName);            count_rendered += 1;        }        if (count_rendered == 5)        {            $('#print-icon-action').show();            $('#print-icon-message').hide();        }    }</script>

 

 

From this I see the export format is correct as planned, and all the IDs are fine as expected, so I am officially stumped :-(

 

Kobus

Share this post


Link to post
Share on other sites
Guest Rishi Choudhari

Hello,

 

We're sorry that you're facing a hard time getting your charts exported. Let me help you out.

 

From what you've said, it seems that the error reporting level set in your PHP environment reports notices also. As a result, even minor bad coding practices get flagged by PHP and they show up in your console.

 

In FCExporter.php, $arrStatus [] is being used without first being initialized. PHP is complaining about this.

 

Try initializing the array before it is being used in the function body.

 

Let me know if this helps.

Edited by Rishi Choudhari

Share this post


Link to post
Share on other sites

Hello,

 

We're sorry that you're facing a hard time getting your charts exported. Let me help you out.

 

From what you've said, it seems that the error reporting level set in your PHP environment reports notices also. As a result, even minor bad coding practices get flagged by PHP and they show up in your console.

 

In FCExporter.php, $arrStatus [] is being used without first being initialized. PHP is complaining about this.

 

Try initializing the array before it is being used in the function body.

 

Let me know if this helps.

 

Hi Rishi,

 

Thanks for your comment. I have initialized the array as suggested, but the problem still persists.

 

I have taken line 419 as described above,

 

$arrStatus [] = "DOMId=" . @$meta["DOMId"];

 

and broke it up as follows:

 

$arrStatus [] = 
"DOMId=" . 
	@$meta["DOMId"];

 

Now the error is on line 423, not 419 anymore (due to array declaration of $arrStatus, and also the line breaks), hence the problem is with the @$meta["DOMid"] line. My DOMids are created correctly, as shown in my code samples above, so I did some further attempt at debugging, and managed to find quite by chance (as logging $meta to console.log didn't work as I thought it would) that DOMid is not set, width is 0 and height is 0, which are all not correct, as the charts are rendering perfectly. See attached screenshot.

 

I also tested by trying to log the individual array elements of $meta to see if that gives me a clearer indication, but it doesn't. If I try to do console.log on $meta['DOMid'], I now get the same error, on the console.log line:

 


echo '
    <script type="text/javascript">
        console.log("' . $meta['DOMid'] . '");
    </script>
';

 

It is thus seeming like the meta data is not passed to the FCExporter for some reason.

 

 

Thanks,

 

Kobus

post-27553-0-65916000-1330069741_thumb.png

Share this post


Link to post
Share on other sites
Guest Rishi Choudhari

Hi,

 

Can you let me know what is

 $statusCode

set to?

 

I suspect it is set to '0', but I need to confirm it.

Share this post


Link to post
Share on other sites

Hi,

 

Can you let me know what is

 $statusCode

set to?

 

I suspect it is set to '0', but I need to confirm it.

 

Hi,

 

statusCode is 0, as per the screenshot above.

 

Thanks!

 

Kobus

Share this post


Link to post
Share on other sites

Hi,

 

statusCode is 0, as per the screenshot above.

 

Thanks!

 

Kobus

 

Hi,

 

Any feedback on this issue? I am still unable to resolve it :-(

 

Thanks

 

Kobus

Share this post


Link to post
Share on other sites

Hi,

 

Any feedback on this issue? I am still unable to resolve it :-(

 

Thanks

 

Kobus

 

It appears as if different types of graphs are causing the problems. When I use single series charts, they work when using a 2D variant, and when using a 3D variant, or a multi-series chart, I get these errors.

 

Any advice would be greatly appreciated. I am getting seriously desperate.

 

Regards,

 

Kobus

Share this post


Link to post
Share on other sites
Guest Rishi Choudhari

It appears as if different types of graphs are causing the problems. When I use single series charts, they work when using a 2D variant, and when using a 3D variant, or a multi-series chart, I get these errors.

 

Any advice would be greatly appreciated. I am getting seriously desperate.

 

Regards,

 

Kobus

Hello,

 

For a while I've been trying to solve your issue.

 

I'm nowhere close to replicating your errors.

 

First of all, your $statusCode = 0. In the screenshot that you shared in this post - http://forum.fusioncharts.com/topic/11273-missing-after-property-list/page__view__findpost__p__44052 - the statusMessage says "Insufficient data".

 

This error means that there is no stream of the encoded image data going into FCExporter.php.

 

I've attached an image to this reply which shows the stream being passed.

 

Do you see the same thing in your browser?

 

 

post-19690-0-10319200-1332930631_thumb.png

Share this post


Link to post
Share on other sites

Hello,

 

For a while I've been trying to solve your issue.

 

I'm nowhere close to replicating your errors.

 

First of all, your $statusCode = 0. In the screenshot that you shared in this post - http://forum.fusionc...dpost__p__44052 - the statusMessage says "Insufficient data".

 

This error means that there is no stream of the encoded image data going into FCExporter.php.

 

I've attached an image to this reply which shows the stream being passed.

 

Do you see the same thing in your browser?

 

 

 

 

Hi,

 

Thanks again for your reply. I have attached herewith the Firebug data screens similar to yours. I have 7 graphs on one page. 6 of them are failing, 1 is exporting fine. This, in my opinion, eliminates anything related to server path, or a setting in FCExporter, or, even a bug in the exporter. The fact that the graphs are rendered correctly (all 7 of them) makes me think there is no error in my implementation (but I may be wrong).

 

I have thus attached a Firebug screenshot for the one graph that works (gets exported) and one screenshot for one of the other 6 that does not get exported. I see no significant differences between them, unless I miss something?

 

EDIT: I have also attached a screenshot of how the graphs are rendered. This shows that there is no errors in my graph settings, otherwise the graphs would not have rendered?

 

Will it help if I attach the code here or not?

 

Thanks for your effort, Rishi, I appreciate it - I am really stumped here, and the project must launch on Friday. :-(

 

Regards,

 

Kobus

post-27553-0-92857700-1332941106_thumb.png

post-27553-0-06036500-1332941118_thumb.png

post-27553-0-52691600-1332941493_thumb.png

Edited by Bliksem

Share this post


Link to post
Share on other sites

HI,

 

By any chance does your server has a limitation to the POST size. This can be set and increased in php.ini.

 

Bigger sized and complex looking charts do post a huge amount of data to the export handler and if they cross the POST limit, the extra data is cut off and the export handler gets incorrect/insufficient data.

 

Can you please check once render very small sized (300x 300) charts once?

Share this post


Link to post
Share on other sites

HI,

 

By any chance does your server has a limitation to the POST size. This can be set and increased in php.ini.

 

Bigger sized and complex looking charts do post a huge amount of data to the export handler and if they cross the POST limit, the extra data is cut off and the export handler gets incorrect/insufficient data.

 

Can you please check once render very small sized (300x 300) charts once?

 

Sudipto,

 

Thank you so much. If I make smaller graphs, then I do not get the errors anymore. I will now get my post size increased.

 

Have a great day!

 

Kobus

Share this post


Link to post
Share on other sites

Sudipto,

 

Thank you so much. If I make smaller graphs, then I do not get the errors anymore. I will now get my post size increased.

 

Have a great day!

 

Kobus

 

Hmmm...

 

With smaller graphs it works... But with big graphs not.

 

I changed the max_post_size from 8MB to 64MB with big graphs and the errors are still there. Should I make it even bigger?

 

Kobus

 

Share this post


Link to post
Share on other sites

Hmmm...

 

With smaller graphs it works... But with big graphs not.

 

I changed the max_post_size from 8MB to 64MB with big graphs and the errors are still there. Should I make it even bigger?

 

Kobus

 

 

I changed the post_max_size to 256M and errors still there when using graphs with dimensions 600 x 300. Using 300 x 150 sized graphs using 8M worked fine. I have now drawn only one graph (multi-series) with 300 x 300 pixels, with the 256M post limit, and the error is still there. Making that single graph a 300 x 200 works without an error, but now the chart is meaningless - it is all garbled up (because it is too small).

 

Sorry for bugging again, but it is still not fixed. I responded too fast before, with the simple test of only making the graphs smaller.

 

Kobus

 

 

 

 

Share this post


Link to post
Share on other sites

I changed the post_max_size to 256M and errors still there when using graphs with dimensions 600 x 300. Using 300 x 150 sized graphs using 8M worked fine. I have now drawn only one graph (multi-series) with 300 x 300 pixels, with the 256M post limit, and the error is still there. Making that single graph a 300 x 200 works without an error, but now the chart is meaningless - it is all garbled up (because it is too small).

 

Sorry for bugging again, but it is still not fixed. I responded too fast before, with the simple test of only making the graphs smaller.

 

Kobus

 

 

I have also set the memory limit to 256M, doesn't solve it either.

 

Kobus

Share this post


Link to post
Share on other sites

Can you pass us the following?

 

1. dimensions of your charts

 

2. Types of charts used

 

3. data used for each chart

 

so that we can test it at our end.

 

Hi Sudpito,

 

Here are the details for my charts (also see how the graphs are rendered on screen - the errors occur only during exporting):

 

1. All charts have dimensions 600 x 300

2. There are 7 charts on the page (but even with 1 chart, it causes the error). 2 charts are normal line or bar (single series) charts, and 5 charts are MSLine (multi-series line) charts.

3. The data for the seven charts is below (and also attached as text file for easier reference):

 


First chart: Solvency / Liquidity / Current Ratio (Multi-series - 3 categories)

Category

Array
(
   [0] => 2006
   [1] => 2007
   [2] => 2008
   [3] => 2009
   [4] => 2010
)

Data

Array
(
   [solvency] => Array
       (
           [2006] => 0.61
           [2007] => 0.59
           [2008] => 0.62
           [2009] => 0.7
           [2010] => 0.71
       )

   [Liquidity] => Array
       (
           [2006] => 1.24
           [2007] => 1.36
           [2008] => 1.38
           [2009] => 0.81
           [2010] => 0.82
       )

   [Current ratio] => Array
       (
           [2006] => 1.37
           [2007] => 1.52
           [2008] => 1.5
           [2009] => 0.97
           [2010] => 0.99
       )

)

Second chart: Profitability (Multi-series - 5 categories)

Category

Array
(
   [0] => 2006
   [1] => 2007
   [2] => 2008
   [3] => 2009
   [4] => 2010
)

Data

Array
(
   [Return on Assets] => Array
       (
           [2006] => 0.03
           [2007] => 0.05
           [2008] => -0
           [2009] => -0.05
           [2010] => 0.01
       )

   [Return on Equity] => Array
       (
           [2006] => 0.09
           [2007] => 0.12
           [2008] => -0
           [2009] => -0.16
           [2010] => 0.05
       )

   [Consultant Spend over Revenue] => Array
       (
           [2006] => 0.01
           [2007] => 0.02
           [2008] => 0.03
           [2009] => 0.04
           [2010] => 0.03
       )

   [Operating Margin] => Array
       (
           [2006] => 0.32
           [2007] => 0.27
           [2008] => 0.07
           [2009] => -0.21
           [2010] => 0.1
       )

   [Net Profit Margin] => Array
       (
           [2006] => 0.12
           [2007] => 0.18
           [2008] => -0
           [2009] => -0.18
           [2010] => 0.05
       )

)

Third chart: Revenue vs. Employees (Multi-series - 2 categories)

Category

Array
(
   [0] => 2006
   [1] => 2007
   [2] => 2008
   [3] => 2009
   [4] => 2010
)

Data

Array
(
   [Revenue per Employee] => Array
       (
           [2006] => 1142766.58
           [2007] => 1226296.14
           [2008] => 1255451.36
           [2009] => 1431095.97
           [2010] => 1815537.2
       )

)

Fourth chart: Revenues (Single series)

Data

Array
(
   [2006] => 36052000000
   [2007] => 40068000000
   [2008] => 44448000000
   [2009] => 54177000000
   [2010] => 71209000000
)

Fifth chart: Employees (Single series)

Data

Array
(
   [2006] => 31548
   [2007] => 32674
   [2008] => 35404
   [2009] => 37857
   [2010] => 39222
)

Sixth chart: Government Relationships (Multi-series - 3 categories)

Category

Array
(
   [0] => 2006
   [1] => 2007
   [2] => 2008
   [3] => 2009
   [4] => 2010
)

Data

Array
(
   [subsidy] => Array
       (
           [2006] => 0
           [2007] => 0
           [2008] => 0
           [2009] => 149000000
           [2010] => 0
       )

   [Guarantee] => Array
       (
           [2006] => 0
           [2007] => 5000000
           [2008] => 5000000
           [2009] => 175980000000
           [2010] => 175980000000
       )

   [Dividends] => Array
       (
           [2006] => 0
           [2007] => 0
           [2008] => 0
           [2009] => 0
           [2010] => 0
       )

)

Seventh chart: Liquidity / Debt Cover / Interest Cover (Multi-series - 2 categories)

Category

Array
(
   [0] => 2006
   [1] => 2007
   [2] => 2008
   [3] => 2009
   [4] => 2010
)

Data

Array
(
   [Debt Cover] => Array
       (
           [2006] => 1.24
           [2007] => 1.7
           [2008] => 0.66
           [2009] => 0.65
           [2010] => 0.97
       )

   [interest Coverage] => Array
       (
           [2006] => 2.53
           [2007] => 2.54
           [2008] => 0.65
           [2009] => -2.69
           [2010] => 2.49
       )

)

 

 

 

Thanks in advance,

 

Kobus

data.txt

post-27553-0-21391100-1333092466_thumb.png

Share this post


Link to post
Share on other sites

Hi,

 

 

We have tried replicate the issue at our end with most of your settings but could not replicate the same.

 

Could you please try using the Export Handler files from the attachment ? The attachment contains a sample which tests the scenario using 2 charts and is working fine in our 3 test environments.

 

BTW, can you please also let us know the server's platform?

phpexport.zip

Share this post


Link to post
Share on other sites

Hi,

 

 

We have tried replicate the issue at our end with most of your settings but could not replicate the same.

 

Could you please try using the Export Handler files from the attachment ? The attachment contains a sample which tests the scenario using 2 charts and is working fine in our 3 test environments.

 

BTW, can you please also let us know the server's platform?

 

Hi,

 

I tried the attached code and swf and exporters. Now my graphs show "FusionCharts Trial", so I have to replace them back - I am using a licensed copy. But even with the replacement files (except for FusionCharts.php - I have not implemented that, as it says "Class not found fusioncharts.php").

 

There is a FusionCharts_Gen.php or something file in my licensed copy, which got renamed to FusionCharts.php (not sure where exactly I read to do that - but it is somewhere on your site). I use a PHP function to draw my charts. Herewith the code for that:

 



   function BuildChart($chartdata, $chartsettings, $chartbase)
   {
       $FC = new FusionCharts($chartbase['type'], $chartbase['width'], $chartbase['height']);
       $FC->chartID = $chartsettings['chartID'];
       $FC->setSWFPath(base_url(). "application/libraries/fusioncharts/");
       $FC->setChartParams(ChartSettings($chartsettings));
       foreach ($chartdata as $key => $value)
       {
           $FC->addChartData($value, "Label=" . $key);
       }
       return $FC->renderChart(false, false);
   }


   function BuildChart_MS($chartdata, $category, $chartsettings, $chartbase)
   {
       $FC = new FusionCharts($chartbase['type'], $chartbase['width'], $chartbase['height']);
       $FC->chartID = $chartsettings['chartID'];
       $FC->setSWFPath(base_url(). "application/libraries/fusioncharts/");
       $FC->setChartParams(ChartSettings($chartsettings));
   	foreach ($category as $key => $value)
       {
           $FC->addCategory($value);
       }
       foreach ($chartdata as $key => $value)
       {
           $FC->addDataset($key);
           foreach($value as $item)
           {
           	$FC->addChartData($item);
           }

       }
       return $FC->renderChart(false, false);
   }


 

The Linux version/distro as shown by phpinfo() only returns "Linux/SUSE", so not sure which version. Apache 2.2.10, PHP 5.2.6. That is all that I can see that is significant in there.

The system is built on CodeIgniter 2.1.0.

Kind regards and thanks!

Kobus

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