-
Nov 19th, 2015, 07:41 AM
#1
Thread Starter
New Member
Rookie Question on Charts
I'm trying to make some live charts, for a software, used to monitor the current status of Wind Turbines.
For instance, I'm making a chart that on uptime / downtime.
How do I make my timer add 1 point to a certain line, per tick?
-
Nov 20th, 2015, 12:30 AM
#2
Re: Rookie Question on Charts
Hi,
The trick here is to create a New DataPoint for each Tick of the Timer and specify the values for the X and Y axis. Then, using the Chart Series Points Collection of the chart to be modifed, you can then Remove the existing first item in the chart series and finally Add the new DataPoint to the end of the Point collection. This then has the effect of a nicely animated rolling chart in real time. i.e:-
vb.net Code:
Dim DP As New DataPoint With DP .AxisLabel = Now.ToLongTimeString .YValues(0) = YourYValue End With With Chart1.Series(0).Points .RemoveAt(0) .Add(DP) End With
Hope that helps.
Cheers,
Ian
-
Nov 20th, 2015, 03:19 AM
#3
Thread Starter
New Member
Re: Rookie Question on Charts
Originally Posted by IanRyder
vb.net Code:
Dim DP As New DataPoint With DP End With
I can't dim as new DataPoint
-
Nov 20th, 2015, 04:18 AM
#4
Re: Rookie Question on Charts
Hi,
Whenever you get an error with regards to something that it not defined then the first thing to do is to read the Documentation for that object so that you can see if there is something that you may have missed. If you read this:-
DataPoint Class
You will then know that you need to add a Reference to the System.Windows.Forms.DataVisualization Assembly and then you need to Import the Namespace System.Windows.Forms.DataVisualization.Charting.
Once you have done that you are good to go.
Cheers,
Ian
NB. As an additional note you also need to remember to tell us what your errors are rather than making us guess. Your next issue will then be that With Block at the end of your variable declaration.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|