FusionCharts API-Methods: isUpdateActive
Created using FusionCharts Suite XT - www.fusioncharts.com
by FusionCharts
HTML
<script src="https://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="https://static.fusioncharts.com/code/latest/fusioncharts.charts.js"></script>
<script src="https://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<!-- This sample shows the usage of the isUpdateActive() method -->
<div id="indicatorDiv">Method Name: <strong>isUpdateActive()</strong>
<p>Returns true if real-time update is enabled for a chart. Returns false is real-time update is stopped using the <a href="http://www.fusioncharts.com/dev/api/fusioncharts/fusioncharts-methods.html#stopUpdate" target="_blank">stopUpdate()</a> method.</p>
<p>Click <strong>Check update status</strong> to check if real-time update has been enabled for the chart shown below.</p>
<div id="chart-container" class="mb-20">FusiomCharts will render here.</div>
<div class="text-center mb-20">
<button id="update_status">Check update status</button>
<button id="stop_updt">Stop update </button>
</div>
<div id="update_message">Real-time update status: <span id="msg"></span>
</div>
CSS
body {
padding: 5px;
margin: 0 auto;
}
strong{
font-weight: bold;
}
.text-center {
text-align: center;
}
p {
margin: 10px auto;
}
.mb-20 {
margin-bottom: 20px;
}
#indicatorDiv {
width: 500px;
font-family:'Arial', 'Helvetica';
font-size: 13px;
}
#update_status {
height: 25px;
font-size: 13px;
}
#update_message {
font-family:'Arial', 'Helvetica';
font-size: 16px;
}
#stop_updt {
height: 25px;
font-size: 13px;
}
#rstrt_updt {
height: 25px;
font-size: 13px;
}
JavaScript
FusionCharts.ready(function () {
var interval;
var stockPriceChart = new FusionCharts({
id: "stockRealTimeChart",
type: 'realtimeline',
renderAt: 'chart-container',
width: '450',
height: '250',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Real-time stock price monitor",
"subCaption": "Harry's SuperMart",
"xAxisName": "Time",
"yAxisName": "Stock Price",
"numberPrefix": "$",
"refreshinterval": "5",
"yaxisminvalue": "35",
"yaxismaxvalue": "36",
"numdisplaysets": "10",
"labeldisplay": "rotate",
"showValues": "0",
"showRealTimeValue": "0",
"theme": "fint",
"captionFontSize": "13",
"subCaptionFontSize": "12"
},
"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()) + ":" +...