Time for action — powering a chart using JSON data stored in a file
- Create a file
Data.json
in theFirstChart
folder. - Paste the previously converted JSON in this file and save it.
- Create a copy of
FirstChart.html
in the same folder and name it asJSONDataURL.html
. - 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>
- 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.
推薦閱讀
- HoloLens Beginner's Guide
- 深入淺出Spring Boot 2.x
- 從Excel到Python:用Python輕松處理Excel數據(第2版)
- iOS開發實戰:從入門到上架App Store(第2版) (移動開發叢書)
- Integrating Facebook iOS SDK with Your Application
- 編程與類型系統
- Scala Reactive Programming
- SQL Server實用教程(SQL Server 2008版)
- Learning YARN
- MINECRAFT編程:使用Python語言玩轉我的世界
- 從零開始學Android開發
- 交互設計師成長手冊:從零開始學交互
- 你必須知道的.NET(第2版)
- 樹莓派開發從零開始學:超好玩的智能小硬件制作書
- Practical Linux Security Cookbook