Question

ZedGraph super users, I have done my best working with ZedGraph to make an analog signal chart. I need some help with the finishing touches.

Currently the graph "grows" from the left to the right as new data comes in (No real world data yet, just a random point every timer tick), if the data grows too large for the default zooming options then the data points are "compressed" on the graph and the right hand side shows more white space, and the X axis scales larger.

What I would like is for the data to grow from right to left (Basically "flip" the graph over the Y axis so +x is to the left and -x is to the right?). Also I would like a "sliding window" for the graph to show only the newest data from the source (basically a 5 second sliding window).

enter image description here

Does ZedGraph have the ability to implement either of these features by default?

Otherwise I plan to negate all of the time stamps on the data (I guess and never show the x axis?) so that the data "grows" from right to left as it comes in. For the sliding window, I was going to only keep (5sec/timeBetweenData) # of data points and remove the rest from the LineItem representing the signal and store them (in case I want to show them to the user again). But If I don't have to do that it would be nice.

Was it helpful?

Solution

So to fix this I did end up negating all of the time stamps so that the new data would "enter" the graph on the left and move to the right as it got older.

Then to create the sliding window effect I removed the oldest point in the graph for every point that I added.

Another unforeseen issue was that the GraphPane by default would add some padding in front of and behind the min and max points, so to fix this I found the minimum and maximum points in my curve and set the dimensions of the axis' scales to that.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top