Autoscale


andybdjuk

Recommended Posts

HI, i am currently plotting the output of my wind turbine against time . Every time i walk past the PC i Autoscale both axis to give me a nicer graph.

Is there a way of allowing the graph to autoscale automatically as the data comes in?

Warmest regards

Link to comment
Share on other sites

Of course. The Scale From and Scale To parameters of the graph are expressions, so you can put formula in there. Lets say you are plotting a channel called WindTurbine. For ScaleFrom you'd do:

min(WindTurbine)

and ScaleTo you'd do:

max(WindTurbine)

you might want a little room, so maybe you'd do:

min(WindTurbine) - min(WindTurbine) * 0.1

max(WindTurbine) + max(WindTurbine) * 0.1

You will, of course, need to thaw your axes to have these scalings take effect. Doing AutoScale will freeze the Y axis.

Link to comment
Share on other sites

  • 6 months later...

Will that work just for the graph window only?

I have a graph of amps vs time, if there is a large peak I have to autoscale to see how high it is, lets say 35 amps. The y axis becomes 0 - 35. As the amps drops down to say 4 and the graph moves along so that the line is all at 4, autoscaling will not change the y axis to 0 - 4.

It seems the peak value in the channel history is setting the autoscale y value.

Link to comment
Share on other sites

That's exactly what is happening. Doing min(channelname) does the min of the entire history. If you only want it to use, say, the last 60 points, you'd do:

min(channelname[0,59])

You could also do, say, the last 60 seconds worth of points:

min(channelname[systime(),systime()-60])

Link to comment
Share on other sites

  • 6 months later...

Certainly, provided there is a history. Channels, variables and V.Chans act the same when when you are retrieving data from them. They just work different when you are assigning values to them:

variable = 3

makes variable equal to 3

channel = 3

sets the output channel to 3 (calling the driver), and if successful, updates the channel history, moving older data back one place. If channel is an input, nothing will happen

v.channel = 3

updates the history, making 3 the [0] value and moving everything else back one place

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.