Original URL: C # Real-time Line chart, waveform map source Download link in the original
Author: Flying Moon
Source: http://www.cnblogs.com/hsiang/
This demo uses the VS-band chart Chart control to produce a real-time, dynamically displayed line chart, and a waveform diagram.
It involves knowledge as follows: Chart control, powerful, can draw a histogram, line chart, waveform, pie chart, greatly simplifying the development and customization of the graph.
Chart Control Concepts: ChartArea, which represents the chart area, a chart can draw multiple ChartArea, overlapping. Series, which represents a sequence of data, each ChartArea can have multiple data lines. That is, series belongs to ChartArea. Axisx,axisy, which represents the primary axis, each chartarea has a corresponding axis, including the primary axis, the auxiliary axis queue set, which represents the first out of the collection.
There are two main methods: Dequeue () means to remove and return the object at the beginning of the system.collections.generic.queue<t>. Enqueue () indicates that the object is added to the end of the system.collections.generic.queue<t>. Timer, timer, timed trip corresponding function, update data, refresh chart.
-----------------------------------------------------------------------------------------------------------
The effect is as follows "click the initialization button First, then click the Start button":
Line chart, which is filled with the number of seconds between [0,100]:
Waveform Diagram "Waveform, is to take the positive and the value, and magnified 50 times times, and then move up 50"
The code is as follows: View code
About Timers Timer "Microsoft's own controls":
Description: Indicates that a user-defined event is raised at the same time interval. Implement the functionality that the user needs. This example is used to periodically update the data in the queue and refresh the chart.
Common instructions: Interval time interval, in milliseconds, this example is 300 milliseconds. Tick The event that is timed to trigger, this example corresponds to the Timer1_Tick event method. Start (), Stop () indicates the start and stop of the timer. Enabled indicates whether the timer is enabled, and the default value is false and needs to be set to true manually.
--------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------