LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph legend question

I am attempting to draw legends based on a variable number of plots. I use LGInsertLegendItemForPlot. When I draw the legend for a single plot, no problem. It draws the plot description ("buffer" in LGInsertLegendItemForPlot) and it draws the plot legend (i.e 4 data points using, say, crosses, with the correct colour, mimicking the actual plot). When I want to show two legends (two plots/plothandles) it does the same but the two descriptions are on top of one another. The plot legends are not on top of one another but below one another, as expected. I played around with the "position" variable but this does not seem to make any difference. Any suggestions?

Regards and thanks

Erik

0 Kudos
Message 1 of 6
(3,327 Views)

Hi,

...where did you find this function?

OK, let's assume it exists, what are your height parameters, and what is auto size set to?

What happens if you use SetCtrlAttribute (panelHandle, graphCtrl, ATTR_LEGEND_AUTO_SIZE, 1); ?

0 Kudos
Message 2 of 6
(3,320 Views)

Good day

This function is part of the legend.fp instrument driver functions. According to "Help" the  toolbox.fp is also required, which is included in the project. I tried your suggestion (ATTR_LEGEND_AUTO_SIZE) but that does not make a difference. Irrespective of that one can see in the graph legend control that it increases in size when 0, 1 or 2 legends are to be shown (height increases).

Erik

0 Kudos
Message 3 of 6
(3,315 Views)

Hello, the legend control is a very old instrument that has been superseded in CVI7.0 with the introduction of graph controls with built-in legend; it remains in recent installs basically for backward compatibility. See this discussion and the other one linked there for reference.

If you are using a newer version of CVI I suggest you to move to built-in legends, basically created by means of some attributes to be passed to SetPlotAttribute. You may also take a look at userint\graphlegend.cws example



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 6
(3,309 Views)

ah... which version of CVI are you using? There is a conflict between the very old legend.fp and CVI releases later than 7.0, see here and here

0 Kudos
Message 5 of 6
(3,308 Views)

The software was probably first written with CVI 5.0 and I think that legend.fp was probably copied and pasted as the software (and CVI) was updated. We are currently using CVI 2012 so it is very possible that you are correct. I am now going to rewrite it using the newer functions as per your suggestion and do away with the old instrument driver. Thanks very much for your help. Greatly appreciated.

Erik

0 Kudos
Message 6 of 6
(3,291 Views)