It has been a headache recently and how to implement the realtime graph. To sum up, we need to solve the following problems:
1. How to transmit Custom Data
2. What format should data be transmitted?
3. Can I perform partial refresh, that is, ajax requests or other methods?
4. Can I asynchronously refresh different divs on the same page? Will it be slow if there are too many divs?
5. What is the mechanism for implementing the realtime graph? Can it be customized?
Recently, we have been studying echarts to update the real-time data interface of adddata. So I did an experiment separately. The source code is as follows:
The answer to the above five questions is as follows:
Data can be stored in a database or online. as you like, JSON data can be obtained through AJAX or jquery databases and then converted into an array and transmitted to echarts. The most common format is json format. No matter ajax, jsonp, or websocket, it can be used as a way to obtain data. This is a data-level thing that will not be attached to charts. Of course, you can use ajax to obtain data and then display it, basically, ajax data is used in our actual applications ~ The chart provides the loading Method for retrieving data as a transitional display ~