Nightjar Report post Posted May 31, 2013 Hi, I'm new to FC, so apologies if this is a newbie : The following (generated from my jsp page) doesn't work : <script type='text/javascript'> var chart_basicChart = new FusionCharts({"swfUrl":"/qa/resources/Charts/Column3D.swf","registerWithJS":"0","height":"300","renderAt":"basicChartDiv","width":"600","dataFormat":"json","dataSource":"{'chart':{'caption':'Monthly Sales Summary', 'subcaption':'For the year 2006', 'xaxisname':'Month', 'yaxisname':'Sales'},'data':[ { 'label':'January','value':'17400' } ]}","debugMode":"1","id":"basicChart"}).render(); </script> It generates (in the debug window): INFO: XML Data provided using dataXML method. INFO: XML Data provided using dataXML method. ERROR: Invalid XML encountered. A start-tag is not matched with an end-tag. Check the XML data that you've provided. If you've special characters in your XML (like %, &, ' or accented characters), please URL Encode them. If I use (using the same jsp page, but changing the params) : <script type='text/javascript'> var chart_basicChart = new FusionCharts({"swfUrl":"/qa/resources/Charts/Column3D.swf","registerWithJS":"0","height":"300","renderAt":"basicChartDiv","width":"600","dataFormat":"xml","dataSource":"<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='0' formatNumberScale='0' showBorder='1'> <set label='Jan' value='462' /></chart>","debugMode":"1","id":"basicChart"}).render(); </script> it works fine. I copied both sets of data from the documentation, but I presume it's the json format that's wrong. Could someone point me to a json dataset I can use to get a chart up using json please - I can work it from there :-) Many Thanks Share this post Link to post Share on other sites
Swarnam Report post Posted June 1, 2013 Hi, Welcome to FusionCharts Forum. Can you please try using the below code? <script type='text/javascript'> var chart_basicChart = new FusionCharts({"swfUrl":"/qa/resources/Charts/Column3D.swf","registerWithJS":"0","height":"300","renderAt":"basicChartDiv","width":"600","dataFormat":"json","dataSource":"{{ "chart": { "caption": "MonthlySalesSummary", "subcaption": "Fortheyear2006", "xaxisname": "Month", "yaxisname": "Sales" }, "data": [{ "label": "January", "value": "17400" } ] } ]}","debugMode":"1","id":"basicChart"}).render(); </script> Please refer to : http://docs.fusioncharts.com/charts/contents/FirstChart/JSONData.html Hope this helps. Share this post Link to post Share on other sites
Nightjar Report post Posted June 1, 2013 My Bad! I've got it working from a url sending data with the double-quotes as required. It was a pain getting the TestData class to generate the string using double-quotes, so I jumped in at the deep end and it worked first time - I'm using Spring MVC and Jackson json generation from my DTO's. May I suggest a JSON TestData class in the examples? Lovely product Thanks Share this post Link to post Share on other sites
Haritha Report post Posted June 10, 2013 Hi, Glad to know that the solution provided by Swarnam helped. Can you please elaborate more on your requirement on "TestData class"? Awaiting your response. Share this post Link to post Share on other sites