Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- Highcharts.setOptions({
- global: {
- useUTC: false
- }
- });
- // Create the chart
- $.get('api_plc/1', function (res) {
- var obj = jQuery.parseJSON(res);
- Highcharts.stockChart('containers', {
- chart: {
- events: {
- load: function () {
- // set up the updating of the chart each second
- var series = this.series[0];
- setInterval(function () {
- var x = (new Date()).getTime(), // current time
- y = Math.round(Math.random() * 100);
- series.addPoint([x, y], true, true);
- }, 1000);
- }
- }
- },
- rangeSelector: {
- buttons: [{
- count: 1,
- type: 'minute',
- text: '1M'
- }, {
- count: 5,
- type: 'minute',
- text: '5M'
- }, {
- type: 'all',
- text: 'All'
- }],
- inputEnabled: false,
- selected: 0
- },
- title: {
- text: 'Live random data'
- },
- exporting: {
- enabled: false
- },
- series: obj.data.series
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement