AutoLegend Object

The AutoLegend object controls legend settings.

Derived from: AutoShape object (All methods and properties of AutoShape apply to this object.)

Properties

ColumnCount

ColumnOffset

DisplayShadow

DrawDescending

EntryCount

EntryLinked

Fill

Font**

FrameStyle

LabelFont*

LabelFormat*

LabelType*

Line

LineLength

Margin

NamesOnLeft

RowOffset

ShadowColor

ShowVisibleEntriesOnly

ShowVisibleOnly

SymbolCount

Title

TitleFont

TitleLinked

TitleOffset

TitleText

Methods

AddEntry

ClearLabelOffset

DeleteEntry

DetachLegend

EntryFont**

EntryName

EntryOrder

EntrySymbolMode

EntrySymbolSize

MoveLabel

Remarks

* Note that the LabelFont, LabelFormat, and LabelType properties are only available for pie chart/doughnut plot legends.

 

** Note the EntryFont method changes the font while the Font property only updates the Property Manager when the application is visible. It is recommended to use both the Font property and EntryFont method when changing font properties. This does not apply to the wind chart legend entries. For Wind Chart legends, it is necessary to use only the Font property.

Example

This example shows how to reference a legend.

Sub Main

 

 'Declares GrapherApp as an object

  Dim GrapherApp As Object

 

 'Creates an instance of the Grapher Application object

 'and assigns it to the variable named "GrapherApp"

  Set GrapherApp = CreateObject("Grapher.Application")

 

 'Make Grapher visible

  GrapherApp.Visible = True

 

'Declare Docs Plot, Shapes, Graph1,

 'and Legend as Object

  Dim Docs, Plot, Shapes, Graph1, Legend As Object

 

 'Assigns the Documents collection to the

 'variable named "Docs"

  Set Docs = GrapherApp.Documents

 

 'Creates a new plot window and assigns it to

 'the variable named "Plot"

  Set Plot = Docs.Add(grfPlotDoc)

 

 'Assigns the AutoShapes collection to the

 'variable named "Shapes"

  Set Shapes = Plot.Shapes

 

 'Adds a high-low-close graph and assigns

 'it to the variable named "Graph1"

  Set Graph1 = Shapes.AddHighLowGraph(GrapherApp.Path + "\samples\hilo.dat")

 

 'Adds a legend and assigns it to the

 'variable named "Legend"

  Set Legend = Graph1.AddLegend(True)

 

End Sub