05-16-2008 10:47 AM
05-20-2008 12:48 PM
05-26-2008 10:40 AM
KristenC,
I have the same problem, so I have thougth the following algorithm:
- I define two traces in the stripchart (one in green color, the other in red color).
- The two traces have the SAME values to be displayed, and are displayed one point at time.
- IF the trace has to be displayed in green color, I draw FIRST the RED COLOR trace, THEN the GREEN color trace;
- OTHERWISE I draw FIRST the GREEN COLOR trace, THEN the RED color trace;
The second drawn trace should overwrite the first drawn trace.....
Do you think that this algorithm could work?
THANKS!
05-26-2008 12:44 PM
06-17-2008 10:10 AM
06-18-2008 05:13 PM
06-24-2008 01:51 PM
EP000 and MaxtheMax,
Unfortunately the behavior you were seeing prior to CVI 8.5 was technically a bug. Trace attributes such as ATTR_TRACE_COLOR were supposed to apply to the entire strip chart and not just individual points or ranges of points. When CVI 8.5 was released we made several changes and improvements to the strip chart code to allow things such as Autoscaling Y-Axis, History Buffers, etc.. Because of these changes when you make a change to either the axis or trace attributes the entire strip chart must be refreshed which causes all traces to be essentially replotted with the active trace settings, such as the current color. The new strip chart code forced us to close this loophole and there isn't really a way to re-enable what you were seeing. Unfortunately some users such as yourselves were exploiting the incorrect behavior to achieve desired effects on the strip chart that never would have been possible otherwise.
There are two possible workarounds, but neither is perfect. Probably the best way to replicate the behavior you were seeing would be to replace the strip chart with a graph control. You could then use a single call to PlotY to handle each contiguously colored block of points. You would have to handle scrolling the X-axis yourself though. Also you'd need to either buffer the points until you wanted the color to change, or you could create a lot of 2 point plots which just go from yData[i-1] to yData[i] so that you get what appears to be one continuous plot. If memory issues became a concern you could delete plots once they are no longer visible on the graph.
If you must use a strip chart you could change the plot mode to scatter, and add two traces, one white and one red. Then when you determine which color you want for the next point, you could plot the "true" value to the proper trace and plot a value that would be outside the visible y-axis range to the other trace. Autoscaling would need to be disabled for the Y-Axis for this to work. This is probably the simplest solution, but because it involves scatter plots the individual points would not be connected, which might not be desirable depending on your application.
I'm sorry that we don't have a "better" solution for you.
Kevin
NI