LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems Encountered; Improvements needed to Stripchart Controls

Working with strip chart controls, working out printing issues, I've encountered some limitations to the control, in particular the Legend, that do not seem to be solvable via SetCtrlAttribute or SetTraceAttribute.  The Legend, and particularly, the Interactive Legend, is extremely useful, but there are things that need improvement.
1.  The legend background cannot be set to transparent -- it accepts the attribute, and displays black, even if the background is white.  The textblock displays gray within the black background.
1A.  It would be really nice to get the legend text on a clear decoration, rather than a solid decoration.  Transparent is not clear, when it comes to a legend.
2.  The legend font size cannot be set
2A.  Cannot set font BOLD.
3.  The legend does not scale along with the control when PrintCtrl is used to print a strip chart -- in my app, it is tiny when printed, compared to what it appears to be on the screen.
4.  The legend initially appears off the control.  If the control is large compared to the panel it is on, the legend appears off the panel, and must be found, to get it back onto, or near the control.
5.  When the control is sized smaller, the legend stays put.  Then, when the control is sized larger, the legend moves off the panel, relative to the direction of control expansion.
6.  It is not possible to pre-enter default Legend text.  This is important, in order to properly size the legend and place it in the correct location.
7.  The inability to annotate a trace (ie, mark a trace with "1", or "2", etc) makes it very difficult to print a strip chart and determine which trace is which.  Yes, it is possible to have one trace print bold X's and one trace to print bold O's, but if you cannot read the Legend, it does not really help.
 
If I've missed something in the above list -- like there is a way around one of these -- please illuminate me...
0 Kudos
Message 1 of 12
(4,989 Views)
And there's more...
 
8.  There does not seem to be any way to obtain the x-axis index of data on the strip chart, left edge, right edge or anywhere.  As long as you know the starting offset and are keeping track of the number of samples sent to the strip chart, you can calculate either the left or right-most sample index.  But when you PAUSE the strip, and move the thumb, suddenly you can't determine where in the data you are actually looking.  This is critical if one wants to print a portion of the data, available in the array, that is visible on the paused strip chart.  (Yes, you can just PrintCtrl(), which is what I will end up doing, but I want to redraw the control with new trace parameters so it prints more clearly.)
0 Kudos
Message 2 of 12
(4,985 Views)

Hello hendra@ngms,

Thank you for posting to the NI Discussion Forums.  I’m glad that you have found the Interactive Legend to be useful.  Here are some answers to your issues:

1.       The strip chart legend background can be set to transparent, using a line of code similar to the following:

SetCtrlAttribute (panelHandle, PANEL_STRIPCHART, ATTR_LEGEND_PLOT_BGCOLOR, VAL_TRANSPARENT);

The legend frame color can also be set to transparent, using the same command, only setting the ATTR_LEGEND_FRAME_COLOR attribute instead.

2.       In order to change the font shown in the legend, you must change it for each plot that is represented in the legend, using SetPlotAttribute(), and changing the Legend Plot Text Font attribute (ATTR_PLOT_LG_FONT). 

 

I agree that it would be nice to be able to directly change the font size here.  Luckily, all is not lost.  You can still use CreateMetaFont() to specify a point size, style (i.e. bold, italic, etc.) and then set the plot font (using SetPlotAttribute()) to the newly created font.

3.       The size and position of the Legend can be controlled programmatically as well, again using SetCtrlAttribute().  The following properties correspond to size and position of the legend:

 

ATTR_LEGEND_AUTO_SIZE

ATTR_LEGEND_HEIGHT

ATTR_LEGEND_LEFT

ATTR_LEGEND_TOP

ATTR_LEGEND_WIDTH

 

It is true that the legend moves away from the strip chart when the chart is resized.  This is to avoid any overlapping of the two, so that the legend does not hide behind the chart and leave the developer wondering where it went off to.

 

4.        You can distinguish different traces by changing the color, line style, thickness, markers (as you mentioned above) and plot style for each trace.  These are also changed using the SetPlotAttribute() command.

 

It is true that you must have the legend visible for the user to really know which plot corresponds to which trace.

 

5.       I am not clear on the problem you are having with the x-axis data on the chart.  The x-axis is labeled by default,  but if you right-click on the chart and select Edit Control…, and then select X-axis… from the Edit Strip Chart dialogue, you can edit the parameters of the chart.  Be sure that the box next to Show Labels is checked.  The x-axis data for the plot can also be accessed programmatically using the GetPlotAttribute() function.

If you do have any product suggestions, we welcome them at our Product Suggestion Center.  We do take good look at these before adding features to future releases of our products.  Thanks for the feedback!

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 3 of 12
(4,966 Views)
Chris,
 
I greatly appreciate the time you have taken to illuminate me.  You have cleared up some issues.  Let me address your response point by point:
1.  Setting the legend to transparent programmatically does not work.  Try it.  I just did, a second time.  The legend is black.
2.  I knew that I could change the font.  My comment was about font size, and bold.  It did not occur to me to create a metafont.  I'll try that.  Thanks...
3.   Your item 3 referred to my items 3, 4, and 5.  The way CVI moves the legend around is annoying.  The problem, and I consider it a CVI bug, is that the legend is not scaled appropriately along with the control, when it is sent to print, via PrintCtrl.  That is why I need to change the font size and bold.  On the screen, the legend is properly sized.  When printed, the legend is about 25% of the size it was on the screen.
4.  I am curerntly replotting the data from an array into a new control when I want to print it, with different plot characteristics, so that two plots can be distinguished.  Annoying, but workable.  You mentioned "markers" in your comment #4, and I"m not sure what you meant by that. 
5.  I am not having trouble with X-axis labels or text.  My point #7 may be connected with your comment about "markers".  On strip chart recorders, newer digital models, one can turn on markers so that each trace will have the trace number imbedded in it as it is printed.  Is there any similar capability here?
Your comment #5 may have addressed my point #8, not  sure, or you may not have addressed it.  It is a problem for me that I cannot determine programmatically what data is displayed, when a Strip Chart is paused.  I cannot read back an index and I cannot read back data.  CVI know the index of the leftmost data point, so why can't I read the index?
 
Thanks very much for your help.
0 Kudos
Message 4 of 12
(4,950 Views)

hendra@ngms,

Attached is a project I created in LabWindows/CVI version 8.5, as well as the associated source, header, and UIR files.  Run the project and see how you can, in fact, make the legend transparent.

The “markers” I was referring to is just the “Point Style” attribute under SetPlotAttribute().  Sorry if I was a little misleading with my lingo.

As far as displaying the trace number directly next to the plot on the strip chart, I do not believe there is any such functionality that exists right now.  Your best option would be to differentiate the plots by setting different attributes (as mentioned in point #4 of my previous post), and using the legend as a reference to see which plot corresponds to which trace.

The x-axis data for the plots are attributes of the plots, not the strip chart.  If you want to get the x-axis data from the plot, then use the GetPlotAttribute() function (as mentioned in point #5 of my previous post).  You will see that one of the available attributes is “X Data”.  If it is the range of the x-axis being displayed on the chart you are interested in, then you can use the GetAxisScalingMode() command to extract this data (for all axes).  This is also demonstrated in the attached example program.  Press the plot button repeatedly, and observe that as the displayed range moves, the maximum and minimum values are displayed in the fields below the chart.

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 5 of 12
(4,933 Views)
Chris,
 
Again, thanks very much.  You have shown me how to get the X-axis values that I need.  Now I need to verify that operating in date/time mode I can get the proper index value.  I'll do that in your app.
 
As far as Legend transparency, what you sent me is interesting, but does not work as I would expect it to.  When transparent is selected, the text also goes transparent. The attached Word file shows all four combinations of the switches.  Is this what you see?  I would expect that if I set the legend and frame transparent, I would see the text.  What do you think?
 
Gary
0 Kudos
Message 6 of 12
(4,918 Views)
Chris,
 
I set up the chart for Absolute time, and received releative indices for X-min and X-max.  This is good, and helps me to print paused charts.
 
Can you give me a short explanation why the values obtained are floating point?  I would expect integer indices of the left X value and right X value.  A point is a point, not a fractional point.
 
Also, have you been following my thred on PrintCtrl()?  I could sure use your help understanding the 5 second screen update lockout I'm seeing.  My next task is to devise a way to determine if all execution is blocked for 5 seconds, or just screen updates.
 
Thanks... Gary
0 Kudos
Message 7 of 12
(4,913 Views)

hendra@ngms,

 

It's true, the text goes transparent as the legend goes transparent.  If you want to have the text to appear without a frame, you can try setting the color of the legend to be the same as the panel. See the modified example (attached) to see what I am talking about.

 

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 8 of 12
(4,912 Views)
Chris,
 
I looked at your revised app.  This is a bug, and should be reported as a bug and fixed in a future release.  What is called TRANSPARENT here is actually VISIBLE/INVISIBLE.  I don't want an invisible legend.  I want a legend with transparent background, so I can put it on the chart, and have the chart visible through it.
 
I can work around this -- it is not a show stopper.
 
What is a potential show stopper is this problem with PrintCtrl() blocking screen updates for 5 full seconds.  I cannot tell my operator that when the need to print 30 pages of strip charts that the application will be unavailable for the next 2 1/2 minutes plus, while these pages are printed.  The fellow that I'm conversing with, Luis, has no answers.  If you can help, I will greatly appreciate it.  Look for the the thread, "Question about PrintCtrl()".
0 Kudos
Message 9 of 12
(4,908 Views)

hendra@ngms,

 

This was reported to R&D (# 1212007) for further investigation.  Please use the solution from my previous post as a possible work-around.

 

As for the PrintCtrl() issue, please continue to refer to the issue on its original forum:  Questions about PrintCtrl()

 

Thanks again for the feedback!

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 10 of 12
(4,899 Views)