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.
推薦閱讀
- 多媒體CAI課件設計與制作導論(第二版)
- 密碼學原理與Java實現
- Beginning C++ Game Programming
- INSTANT Sencha Touch
- Python算法從菜鳥到達人
- 零基礎學C語言第2版
- 深度探索Go語言:對象模型與runtime的原理特性及應用
- Qt 4開發實踐
- 從零學Java設計模式
- Clojure for Finance
- 軟件測試技術
- Learning ROS for Robotics Programming
- 編程風格:程序設計與系統構建的藝術(原書第2版)
- R High Performance Programming
- Server Side development with Node.js and Koa.js Quick Start Guide