# graphic scale

## Recommended Posts

I'm measuring the height of the water and I want to show it on the graph. When the level falls below a certain value, I want the macro to assign an average value to the graph. In the graph, the y axis is level_b.
However, when the second condition is provided in this way, the whole graphic line disappears from the screen.

while(1)
level_a = (level - 457) * 0.6546
if(level < 473.0)
level_b = 100
else
level_b = level_a
endif
endwhile

##### Share on other sites

I'm not quite clear what you are trying to do.  You are reading "Level" and want to plot this on the graph.  But if the level is < 473 you want it to display the value 100?  In this case, in your graph, simply enter this expression:

((level - 457) * 0.6536) * (level >= 473) + 100 * (level < 473)

This is using a little boolean math.  "True" is 1 in DAQFactory, and "False" is 0, so when level >= 473, only the first part goes through, and when level < 473 only the second part.  Since all paths use "level" and level has time associated with it, it will plot correctly.

You do not need any script.

The big issue with your script is that level_b = 100 assigns a scalar to level_b and you can't plot a scalar because it is only one point.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.