FusionCharts - Simple Realtime Chart.

Created using FusionCharts Suite XT - www.fusioncharts.com

by wind_chime18

HTML

<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.charts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<div id="chart-container" style="width:50px;height:50px;">FusionCharts will render here</div>
<!-- 
    Simple example showing stock price in every 5 sec interval using Real Time Line Chart.
-->

JavaScript

FusionCharts.ready(function () {
    var stockPriceChart = new FusionCharts({
        id: "stockRealTimeChart",
        type: 'realtimeline',
        renderAt: 'chart-container',
        width: '500',
        height: '300',
        dataFormat: 'json',
        dataSource: {
            "chart": {
                "caption": "PowerDonut",
                "subCaption": "Current",
                "xAxisName": "Time",
                "yAxisName": "Current",
                "numberSuffix": " (A)",
                "refreshinterval": "1",
                "yaxisminvalue": "0",
                "yaxismaxvalue": "0",
                "numdisplaysets": "",
                "labeldisplay": "rotate",
                "showValues": "0",
                "showRealTimeValue": "0",
                "theme": "fint"
            },
            "categories": [{
                "category": [{
                    "label": "Day Start"
                }]
            }],
            "dataset": [{
                "data": [{
                    "value": "35.27"
                }]
            }]
        },
       "events": {
           "initialized": function (e) {
               function addLeadingZero(num){
                   return (num <= 9)? ("0"+num) : num;
               }
               function updateData() {
                    // Get reference to the chart using its ID
                    var chartRef = FusionCharts("stockRealTimeChart"),
                        // We need to create a querystring format incremental update, containing
                        // label in hh:mm:ss format
                        // and a value (random).
                        currDate = new Date(),
                        label = addLeadingZero(currDate.getHours()) + ":" +
                                addLeadingZero(currDate.getMinutes()) + ":" +
                                addLeadingZero(currDate.getSeconds()),
                        // Get random number between 35.25 & 35.75 - rounded to 2 decimal...