GDI + Moving a piece of the Screen  
Author Message
Testpilot.dk





PostPosted: Visual C# General, GDI + Moving a piece of the Screen Top

Hi!

I have a question about, the GDI and plotting live data in a coordinate system.

This works fine, but I whant to move a piece of the screen when the data is out of visible area

How could I do this

Hope for a quick reply.




Visual C#8  
 
 
Testpilot.dk





PostPosted: Visual C# General, GDI + Moving a piece of the Screen Top

I want to make a live plotting area, where the screen are moving, so it always would be the newest data displayed on the screen.

I want to slowly move the top of the screen, so the oldest part of the plot will disappears.



 
 
Testpilot.dk





PostPosted: Visual C# General, GDI + Moving a piece of the Screen Top

The problem is, that I have some live data, produced by a machine.

The data I get are generate by a counter and and timer, where the timer is the x-axis and the counter are on the y-axis.

And I want to show thoose datas for a period of 5 min, when the 5th min are approach, it should move the graph along the x-Axis so it always will display the last 5 min.



 
 
sirjis





PostPosted: Visual C# General, GDI + Moving a piece of the Screen Top

Where are you storing the data Perhaps in a List (or a Queue) of GraphPoints (where GraphPoint is just some class/struct that you make that contains a timestamp and a value) Then you can create a UserControl and override its OnPaint method. Inside that method, draw the data that you want. When you receive new data, update the collection of points and call Refresh() on your user control.

There are more details than I've explained, but that's one general way of approaching this problem. I hope it helps get you started.

 
 
Testpilot.dk





PostPosted: Visual C# General, GDI + Moving a piece of the Screen Top

Hi!

That could be a solution, but I couldn't get it to work properly.

It make some **** lines from the end to the start.

for (int i = 0; i < x; i++)

{

if (i < x - 1)

{

if (x == 200)

ClearFirstAreaOfArrayList();

e.Graphics.TranslateTransform(48.0f, 80.0f);

e.Graphics.DrawLine(GraphPen,(Point)arl[i + 1], (Point)arlIdea);

e.Graphics.ResetTransform();

}

}

And in the ClearFirstAreaOfArrayList iam removing the first 50th points and make my x - 50

Hope you could help me