Highcharts The implementation code _javascript technique of multiple Y-axes dynamic Refresh data

Source: Internet
Author: User

Effect Chart:

JS Code:

$ (function () {$ (document). Ready (function () {highcharts.setoptions ({global: {useutc:false}
    });
    var chart; Chart = new Highcharts.chart ({chart: {renderto: ' container ', type: ' Spline ', Animation:hi Ghcharts.svg,//don ' t animate in Old IE marginright:10, events: {load:functi On () {}}}, title: {text: ' Live random Data '}, Xaxis: {type: ' datetime ', tickpixelinterval:150}, YAxis: [{title: {text: ' Value '}, PLO 
          Tlines: [{value:0, width:1, color: ' #808080 '}]}, {title: { Text: ' Name '}, plotlines: [{value:0, width:1, color: ' #808080 '}]}], tooltip: {formatter:function () {return ' <b> ' + This.series.namE + ' </b><br/> ' + highcharts.dateformat ('%y-%m-%d%h:%m:%s ', this.x) + ' <br/> ' +
        Highcharts.numberformat (THIS.Y, 2); }, Legend: {Enabled:false}, exporting: {Enabled:false}, Series               
          : [{name: ' Random data ', Data: (function () {//Generate an array of Random data
          var data = [], time = (new Date ()). GetTime (), I;
            for (i = -19; I <= 0; i++) {Data.push ({x:time + i * 1000, y:math.random ()
          });
        } return data;               
          } ()}, {name: ' Random data ', Data: (function () {//Generate an array of Random data
          var data = [], time = (new Date ()). GetTime (), I;
            for (i = -19; I <= 0; i++) {Data.push ({x:time + i * 1000, y:math.random () });
        } return data; })()
      }]
    });
    Set up the updating of the chart each second var series = chart.series[0];
    var series1 = chart.series[1];
      SetInterval (function () {var x = (new Date ()). GetTime (),//Current Time y = Math.random ();
      Series.addpoint ([x, Y + 1], true, true);
    Series1.addpoint ([x, Y-1], true, true);
  }, 1000);
}); });

HTML code:

 
 

The above highcharts more than one y-axis dynamic Refresh data implementation code is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.