OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis     
 
Skip Navigation Links
All BooksExpand All Books
Quick HelpExpand Quick Help
ProgrammingExpand Programming

4.9 FAQ-368 How do I modify the legend?

Last Update: 1/16/2017

The legend is an ordinary text object with the name legend. This text object uses a special syntax to display plot symbols and text. The raw text may look something like:

\l(1) %(1)
\l(2) %(2)

This is what you would see if you were to right-click on the legend object and choose Properties.

For an explanation of syntax and legend customization within the user-interface, see the legend customization discussion in Graph Legends and see the graph legend-related FAQs in the Text Labels & Legends section.

To modify the graph legend programmatically:

You can directly change the text in the legend by addressing the text property of the object named legend:

legend.text$ = Test
\l(1) %(1)
\l(2) %(2);

You can use the legendupdate X-Function to change the way the %(#) is interpreted. For example:

legendupdate mode:=lname;  // display long name
legendupdate mode:=7 custom:=@WS;  // display sheet name, customized option


Other Substitution notations can also be used for the legend, the X and Y axis titles, or ant text object. Please refer to Text Label Options for more details.



Keywords:object, control, programming, substitution

 

© OriginLab Corporation. All rights reserved.