官术网_书友最值得收藏!

Time for action — powering a chart using JSON data stored in a file

  1. Create a file Data.json in the FirstChart folder.
  2. Paste the previously converted JSON in this file and save it.
  3. Create a copy of FirstChart.html in the same folder and name it as JSONDataURL.html.
  4. Change the following lines of code, as highlighted:
    <html>
    <body>
    <div id="chartContainer">FusionCharts will load here!</div>
    <script type="text/javascript"><!-- var myChart = new FusionCharts("../FusionCharts/Column3D.swf", "myChartId","400", "300", "0", "1" ); myChart.setJSONUrl("Data.json"); myChart.render("chartContainer");// -->
    </script>
    </body>
    </html>
    
  5. View the page in the browser. You should see the same chart as the previous one.

What just happened?

You just configured your chart to use JSON data as URL, instead of XML. If you do not see a chart, however, your browser might be restricting JavaScript to load local files. In that case, you will have to switch to the JSON Data String method, as explained in the next section.

主站蜘蛛池模板: 龙州县| 英吉沙县| 三门县| 丽江市| 安图县| 新巴尔虎左旗| 革吉县| 米林县| 长沙县| 界首市| 罗源县| 邢台市| 麦盖提县| 云阳县| 南京市| 梨树县| 万盛区| 迁安市| 咸丰县| 尚志市| 河西区| 镇雄县| 皋兰县| 白沙| 庐江县| 铜梁县| 鞍山市| 海兴县| 蒲江县| 通许县| 无棣县| 龙口市| 隆子县| 宁德市| 临漳县| 四会市| 荆州市| 建水县| 克什克腾旗| 威信县| 罗平县|