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.
推薦閱讀
- Mastering Ext JS(Second Edition)
- Python編程自學(xué)手冊(cè)
- Mastering phpMyAdmin 3.4 for Effective MySQL Management
- Java入門很輕松(微課超值版)
- JavaScript Unlocked
- Mastering OpenCV 4
- Hands-On C++ Game Animation Programming
- Java軟件開(kāi)發(fā)基礎(chǔ)
- Android嵌入式系統(tǒng)程序開(kāi)發(fā)(基于Cortex-A8)
- 征服C指針(第2版)
- 編程的原則:改善代碼質(zhì)量的101個(gè)方法
- Visual Basic程序設(shè)計(jì)
- Python語(yǔ)言及其應(yīng)用(第2版)
- INSTANT SASS CSS How-to
- Java程序設(shè)計(jì)教程(慕課版)