Chart Recorder type graph wanted


AndyT

Recommended Posts

Hi,

I am running DAQFactory Std edition.

I would like to have a graph where the time was on the vertical axis and the measured dependant values on the horizontal axis. Just like the control panels with strip paper chart recorders on them.

Is this possible? There is a Rotate property for symbols but I can't find one for graphs.

My other attempt was to put Time on Y-axis and Values on the X-axis.

I went to the Axes tab then LeftAxis_1 and set ScaleFrom = SysTime()+30 and ScaleTo = Systime()-30 which gave me a scrolling strip going down the page okay.

Bottom Axis was set ScaleFrom = 0 and ScaleTo = 50 (its a temp I am trying to trace)

But no trace shows - I think because I can't assign the bottom axis in the dropdown.

Someone must of done this already or am I looking in the wrong place.

Andy

Attached a sample using the test device (hope I've got this right I am new to this)

test_chart_rec.ctl

Link to comment
Share on other sites

You are on the right track, but you can't simply put "Time" in the Y expression. "Time" in X expression has special meaning, and pulls the time from the value automatically. "Time" anywhere else has no meaning. Instead, you have to use the getTime() function. So if your X expression now has "mychannel", your Y Expression needs to have "getTime(mychannel)"

You also need to make sure the bottom axis type is set to Lin, not Date/Time.

Link to comment
Share on other sites

It took me a while to get my vertical charts setup correctly, but in the end it helped alot...

The Y axis like AzeoTech said, can't be time, but more of a value that increments over time...

Say you have a value called ChartIncrement and every 30 seconds it adds 1, you could use that for a Y axis to "step" along your chart every 30 seconds....

Then your X axis should be a value that increments at the same 30 seconds ChartIncrement happens so they have the same time and display on the chart correctly...

Please correct me if I'm wrong AzeoTech!

InsertTime() has become my friend. :)

Link to comment
Share on other sites

  • 11 months later...

I have a time scale on the Left axis set as Gettime(channel) to gettime(channel)-7200

because I want a 2 hour chart for my 2 channels plotted on the x-axis.

It works, but not the way I want it to. I want to make the most recent value of gettime(mychannel) to display downwords.

In other words, The graph is going upwards, as new data comes in, when What I want is it to graph downwards, with the most recent data at the bottom of the y axis, and not at the top of the y axis.

Is there a way to do that, and How?

No matter what tricks I try, DF always scales the y scale so that smaller values are closest to the x-axis.

How do I get DF to make the larger values of the Y axis scale to plot closest to the x-axis? Since

time is treated like a number along the y axis, is there anyway to accompish this trickery?

That way newer time would be propagating downwards along the y axix.

;)

Link to comment
Share on other sites

Turn off the labels on the Y axis and add your own, then invert the Y expression itself. So if, the Y Expression is getTime(myChannel), make the Y Expression:

getTime(myChannel[0]) - getTime(myChannel)

This will make the values go from 0 to 7200 where 0 is the most recent data point.

Link to comment
Share on other sites

  • 1 year later...

Hello again Master GURU!

Although my Y-axis "time graphs" are flowing properly, I have yet to figure out the Y-axis time labellng!

As of now, our Y-axis time graphs have no label, the boss just wanted them "pushed out" so to mimic the Moly-Tec strip chart recorder....

So here are my questions -

1.) How do I turn off the Y-axis labelling?

The only way I see how to do this is by making the Y-axis the "same color" as my backround so-to hide the second time format.. Am I missing the obvious?

2.) Y-axis "time-formatting" is not do-able in DF, correct?

Do I need to make "positions" and make a "formatted" variable value "move" to known positions displaying time?? (seems time consuming)

Any pointers would be always appreciated!

Thanks,

Brandon

( Attached is an example of how our Y-axis time graphs look, notice the "left axis 1" is colored the same as the panel behind it! Anyone please extrapolate!! :) )

TimeGraph.ctl

Link to comment
Share on other sites

Actually you can do this pretty cleanly using a couple tricks. I've attached a sample.

1) to get rid of the default ticks, go to the Left Axis, uncheck the Auto Grid Control, and set the Major and Minor tick spacing to something huge (more than 1 billion)

2) name the graph so you can access it from script

3) create variable value components for each left axis tick you want. The top one gets this expression:

formatDateTime("%c", Component.vertGraph.LeftAxis1.CurrentScaleTo)

the bottom this one:

formatDateTime("%c", Component.vertGraph.LeftAxis1.CurrentScaleFrom)

and ones in between something like this:

formatDateTime("%c", Component.vertGraph.LeftAxis1.CurrentScaleTo - (Component.vertGraph.LeftAxis1.CurrentScaleTo - Component.vertGraph.LeftAxis1.CurrentScaleFrom) * 0.25)

my example shows the one 1/4 of the way down from the top.

4) Now since you turned off the ticks, you also turned off the horizontal lines for the grid. You can add these back manually by adding Line Annotations to the graph. In my sample, I create three for the intermediary ticks. The expressions are simply the second parameter of our formatDateTime() function. Here are the three I used:

Component.vertGraph.LeftAxis1.CurrentScaleTo - (Component.vertGraph.LeftAxis1.CurrentScaleTo - Component.vertGraph.LeftAxis1.CurrentScaleFrom) * 0.25

Component.vertGraph.LeftAxis1.CurrentScaleTo - (Component.vertGraph.LeftAxis1.CurrentScaleTo - Component.vertGraph.LeftAxis1.CurrentScaleFrom) * 0.50

Component.vertGraph.LeftAxis1.CurrentScaleTo - (Component.vertGraph.LeftAxis1.CurrentScaleTo - Component.vertGraph.LeftAxis1.CurrentScaleFrom) * 0.75

Leave the text blank, and set the color to black to match the vertical ones.

5) once you have the horizontal lines, move your value components you created in step 3 to line up with the lines.

6) feel free to tweak as needed, including changing the "%c" to whatever time formatting you want.

verticalGraph.ctl

Link to comment
Share on other sites

Really appreciate it, I totally forgot about naming my graph and accessing it from script... :)

Just brainstorming here, would making "moving" variable values that also "flow" as the chart flows be difficult??

I envision 10 or so "positions" that click along with the chart that have a static timestamp for ease of viewing...

It is semi-difficult to see where the data is at while the data is moving, having a timestamp that moves with the graph, personally I can see it easier...,

Would this require extensive programming or is it just not possible in DF??

I know all this graphical stuff is just eye candy and the end result is still in the export, just thinking about my next large loop and how to display it all!

Thanks again for all the knowledge!!

BeeHay

Link to comment
Share on other sites

No really. Making the actual line move is simply a matter of setting the line annotation to an expression that doesn't change. Making the tick label move is a matter of some math. Its all well within DAQFactory's capabilities, but you would have to figure out the algorithm to move the tick label to match the line. Wouldn't be particularly hard. It'd just require a little math.

Link to comment
Share on other sites

Archived

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