Legend (Collection)

Member of:

ChartSection object

Description:

Enables you to set and get legend item attributes of a chart. You use this collection to set and retrieve the line width of a line chart; or to modify the foreground color of a Bar chart.

Tip:

All collections have the “Item(NameOrIndex)” method. This is the default method for all collections that returns collection items at a particular index or by name. Use brackets ([]) to represent calls to the Item (Method). For example, these statements are identical: myItem = Documents[1] myItem = Documents.Item(1) myItem = Documents["StartUp.bqy"] myItem = Documents.Item("StartUp.bqy")

Example 1:

This example shows how to change the color, fill pattern, line color, and the line width of a legend item:

ActiveDocument.Sections["Chart"].Legend.Items[1].Fill.Color = bqBlue
ActiveDocument.Sections["Chart"].Legend.Items[1].Fill.BrushStyle = bqBrushStyleCross
ActiveDocument.Sections["Chart"].Legend.Items[1].Line.Color= bqBlue
ActiveDocument.Sections["Chart"].Legend.Items["Q1"].Line.Width = 6

Example 2:

The Legend style property sets the appearance of the line, such as a solid, dotted or a dashed line. this example shows how to set a "dot, dash" style:

ActiveDocument.Sections["Chart"].Legend.Items["1"].Line.Style= bqDashStyleDotDash

Example 3:

This example shows how to set the marker style, marker size, marker border color, and marker fill color of a legend item:

ActiveDocument.Sections["Chart"].Legend.Items["Q1"].Line.MarkerStyle = bqSquare
ActiveDocument.Sections["Chart"].Legend.Items[1].Line.MarkerSize = bq6pt
ActiveDocument.Sections["Chart"].Legend.Items[1].Line.MarkerBorderColor= bqRed
ActiveDocument.Sections["Chart"].Legend.Items["Q1"].Line.MarkerFillColor= bqGreen

Methods:

LegendItems.Item(NameOrIndex)

Properties:

Read-only: Property Count as Number