Highchart Accessing a background service returns more than one chart data

Source: Internet
Author: User

In this article, we make the dynamic chart, we often need more than one chart, if each chart with the service interface to do an interaction is too frequent, this is a pressure both before and after the background, this article describes a one-time access to return multiple sets of data to reduce the front-end and back-end service interaction, Gossip less, view dynamic effects →.→ detailed code ←.←

As shown above, the chart property of Highchart can add the events event, the event we inserted above is:

events: {load:function () {                varSeries = This. series[0]; varOld = 0; SetInterval (function () {                    varx = (k++); vary = math.random () * 100;  while(Y-old >= | | y-old <=-10) {y= Math.random () * 100; } Old=y; Series.addpoint ([x, parseint (y)],true,true); }, 1000); }        }

The event gets a random number every 1 seconds after a successful load, if the value is not more than 10 from the last occurrence, the value is added to the Highchart array, otherwise the random number is regenerated, but the event needs to get a predetermined array by this.series[0]. If we need more than one chart, define THIS.SERIES[1],THIS.SERIES[2] ..... The resulting data is placed in a single chart, which is inconsistent with our needs.

Of course we can not write the events, but directly to SetInterval (func,1000) mentioned outside to write, so that the series can be defined only one item, and applied to different charts.

For implementation please see →.→ detailed code ←.←

Highchart Accessing a background service returns more than one chart data

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.