LegendKey Members
Use the LegendKey object to control the appearance of the series or trendline that corresponds to the legend entry. Use the LegendEntry object’s LegendKey property to get a reference to this collection. The LegendKey object has the following members. Key members (shown in bold) are covered in the following reference section:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Setting the key properties of the legend key is equivalent to setting them for their corresponding series. LegendKey simply provides an alternate way to get at those settings. See the Series object in Chapter 16 for descriptions of the preceding key members.
The following code shows using the LegendKey to change series markers and also shows the alternate code using the Series object (commented out):
Sub LegendKeyMembers( ) Dim chrt As Chart, le As LegendEntry, _ lk As LegendKey, sr As Series ' Get the chart. Set chrt = ActiveChart chrt.ChartType = xlLineMarkers ' Make sure chart has a legend. chrt.HasLegend = True For Each le In chrt.Legend.LegendEntries ' Get the legend key Set lk = le.LegendKey lk.MarkerStyle = xlMarkerStyleCircle lk.MarkerSize = 4 Next ' Equivalent code using the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access