Class LegendEntryCollection
Contents
[
Hide
]LegendEntryCollection class
Represents a collection of all the LegendEntry
objects in the specified chart legend.
public class LegendEntryCollection : CollectionBase<LegendEntry>
Properties
Name | Description |
---|---|
Capacity { get; set; } | |
Count { get; } | |
Item { get; } | Gets the LegendEntry element at the specified index. |
Item { get; set; } |
Methods
Name | Description |
---|---|
BinarySearch(LegendEntry) | |
BinarySearch(LegendEntry, IComparer<LegendEntry>) | |
BinarySearch(int, int, LegendEntry, IComparer<LegendEntry>) | |
Clear() | |
Contains(LegendEntry) | |
CopyTo(LegendEntry[]) | |
CopyTo(LegendEntry[], int) | |
CopyTo(int, LegendEntry[], int, int) | |
Exists(Predicate<LegendEntry>) | |
Find(Predicate<LegendEntry>) | |
FindAll(Predicate<LegendEntry>) | |
FindIndex(Predicate<LegendEntry>) | |
FindIndex(int, Predicate<LegendEntry>) | |
FindIndex(int, int, Predicate<LegendEntry>) | |
FindLast(Predicate<LegendEntry>) | |
FindLastIndex(Predicate<LegendEntry>) | |
FindLastIndex(int, Predicate<LegendEntry>) | |
FindLastIndex(int, int, Predicate<LegendEntry>) | |
GetEnumerator() | |
IndexOf(LegendEntry) | |
IndexOf(LegendEntry, int) | |
IndexOf(LegendEntry, int, int) | |
LastIndexOf(LegendEntry) | |
LastIndexOf(LegendEntry, int) | |
LastIndexOf(LegendEntry, int, int) | |
RemoveAt(int) |
Examples
[C#]
namespace Demos
{
using Aspose.Cells;
using Aspose.Cells.Charts;
using System;
public class LegendEntryCollectionDemo
{
public static void LegendEntryCollectionExample()
{
// Create a new workbook
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
// Add some data for the chart
sheet.Cells[0, 1].PutValue("Income");
sheet.Cells[1, 0].PutValue("Company A");
sheet.Cells[2, 0].PutValue("Company B");
sheet.Cells[3, 0].PutValue("Company C");
sheet.Cells[1, 1].PutValue(10000);
sheet.Cells[2, 1].PutValue(20000);
sheet.Cells[3, 1].PutValue(30000);
// Add a chart to the worksheet
int chartIndex = sheet.Charts.Add(ChartType.Column, 9, 9, 21, 15);
Chart chart = sheet.Charts[chartIndex];
chart.SetChartDataRange("A1:B4", true);
// Access the legend of the chart
Legend legend = chart.Legend;
// Access the collection of legend entries
LegendEntryCollection legendEntries = legend.LegendEntries;
// Modify properties of the first legend entry
if (legendEntries.Count > 0)
{
LegendEntry firstEntry = legendEntries[0];
firstEntry.IsDeleted = false;
firstEntry.AutoScaleFont = true;
firstEntry.Background = BackgroundMode.Transparent;
}
// Save the workbook
workbook.Save("LegendEntryCollectionExample.xlsx");
workbook.Save("LegendEntryCollectionExample.pdf");
}
}
}
See Also
- class CollectionBase<T>
- class LegendEntry
- namespace Aspose.Cells.Charts
- assembly Aspose.Cells