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

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.

主站蜘蛛池模板: 临安市| 浮梁县| 海安县| 山东省| 扎赉特旗| 博爱县| 定襄县| 康乐县| 泗水县| 抚宁县| 望城县| 嘉鱼县| 泊头市| 黄冈市| 庄河市| 舟曲县| 怀远县| 兴仁县| 荣昌县| 沙湾县| 牡丹江市| 营山县| 泽普县| 临泉县| 墨竹工卡县| 监利县| 巴彦淖尔市| 高要市| 罗平县| 临夏市| 临泽县| 襄汾县| 沧源| 得荣县| 吉首市| 鲁甸县| 铜梁县| 睢宁县| 阿城市| 安国市| 三台县|