LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

line style problem - part 2

I ran the sample strip chart project Jason F sent me on my system (LabWindows/CVI 5.5) and I did observe 3 traces of random signals that exhibit three different line styles when commanded by the "change line style" control button. The blue trace shows "Dash" line, the yellow trace shows "Dash-Dot-Dot, and the red trace shows "Dash-Dot". I then modified the code in stripchart.c to change the data points of trace #2 and trace #3 into constants instead of random data. In other words, datapoints[0]= 100.0 * rand()/RAND_MAX, datapoints[1]= 35.0, datapoints[2] = 70.0. After the code is modified, I ran the project again. Guess what! Only the blue trace ( the one with the random data) changes line style as commanded by the control buttons. The
yellow trace (trace #2) and the red trace (trace #3) do not show the proper line styles when commanded by the control button. I wonder why the line style works for trace of random data but does not work for constant data. Of course, in our application, the data will not be a "constant" in general. However, we are using the traces for monitoring multiple voltage levels which are very close to being constant and we are currently having problem of showing different line styles to distiguish diferent traces. If the line style does not work for us, we will be forced to use color only for distinguishing the traces which is less than desirable because the number of voltages to be monitored on one chart is too numerous (about 16).
0 Kudos
Message 1 of 2
(2,901 Views)
Let me explain why you are seeing what you are seeing. In this example you are plotting 100 points in a plot area that is about 350 pixels wide. What CVI does with line styles on strip charts is this: It draws the selected line style from the end of the current chart history to the currently plotted point. In the case of a plot that is constant. The distance between the chart history and the new point in pixels on the screen is about 3 pixels. So it draws 3 pixels worth of the selected line style, which is always a solid line.

The problem is that it on the next plotted point, it plots a new line, restarting the line style pattern. So what you see is the first 3 or 4 pixels of the line style plotted over and over connected the points.

In the
case of the random number plot, there are many pixels between each point because of the drastic changes in the Y value. So it plots maybe 1 or 2 hundred pixels of the line style.

Notice that if you change the number of X points displayed on the chart to 10, then all line styles are fine.

So, this is actually a result of drawing very small lines between each point, where you are expecting a continuous line. I can't think of an easy workaround without changing the number of points on the plot. If you need to see a lot of points in the history and the Y values don't change much, you may be stuck using line color instead.

Best Regards,

Chris Matthews
National Instruments
Message 2 of 2
(2,901 Views)