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.8 FAQ-368 How do I modify the legend?

Last Update: 2/3/2015

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

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

This is the text in the legend you would see if you right-click a Legend and choose Properties. If In-Place Edit Mode is active and you double-click on the text part of a Legend, you will be able to see and edit the %(1) and %(2) part which get substituted internally to generate text associated with plotted data.

You can use Legend: Update Legend, which is on the Graph menu and on the right-click context menu of a Legend and the Graph window to change which text is associated with the %(#) notation.

If you choose to add to or replace the %(#) notation, you should rename the text object to anything other than legend since use of the Graph: Legend: Reconstruct Legend menu option will overwrite your changes. Legend Update does not have this behavior and will preserve any text you add and simply re-interpret the %(#) notation.

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.