Class Legend
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
차트 범례를 나타내는 객체를 캡슐화합니다.
public class Legend : ChartTextFrame
상속
object ← ChartFrame ← ChartTextFrame ← Legend
상속된 멤버
ChartTextFrame.m_IsAutoText, ChartTextFrame.m_deleted, ChartTextFrame.horizontal, ChartTextFrame.vertical, ChartTextFrame.rotation, ChartTextFrame.m_CharsList, ChartTextFrame.Characters(int, int), ChartTextFrame.IsAutoText, ChartTextFrame.IsDeleted, ChartTextFrame.TextHorizontalAlignment, ChartTextFrame.TextVerticalAlignment, ChartTextFrame.RotationAngle, ChartTextFrame.IsAutomaticRotation, ChartTextFrame.Text, ChartTextFrame.LinkedSource, ChartTextFrame.ReadingOrder, ChartTextFrame.DirectionType, ChartTextFrame.IsTextWrapped, ChartTextFrame.IsResizeShapeToFitText, ChartFrame.m_IsAutoXPos, ChartFrame.m_IsAutoYPos, ChartFrame.m_IsOffsetPosBeSet, ChartFrame.m_fontIndex, ChartFrame.m_AutoScaleFont, ChartFrame.m_BackgroundMode, ChartFrame.m_isAutoSize, ChartFrame.SetPositionAuto(), ChartFrame.IsInnerMode, ChartFrame.Border, ChartFrame.Area, ChartFrame.TextOptions, ChartFrame.Font, ChartFrame.AutoScaleFont, ChartFrame.BackgroundMode, ChartFrame.IsAutomaticSize, ChartFrame.X, ChartFrame.Y, ChartFrame.Height, ChartFrame.Width, ChartFrame.Shadow, ChartFrame.ShapeProperties, ChartFrame.IsDefaultPosBeSet, ChartFrame.DefaultX, ChartFrame.DefaultY, ChartFrame.DefaultWidth, ChartFrame.DefaultHeight, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
예제
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
Cells cells = sheet.Cells;
cells[0,1].PutValue("수익");
cells[1,0].PutValue("회사 A");
cells[2,0].PutValue("회사 B");
cells[3,0].PutValue("회사 C");
cells[1,1].PutValue(10000);
cells[2,1].PutValue(20000);
cells[3,1].PutValue(30000);
int chartIndex = sheet.Charts.Add(ChartType.Column, 9, 9, 21, 15);
Chart chart = sheet.Charts[chartIndex];
chart.SetChartDataRange("A1:B4", true);
//범례의 너비와 높이 설정
Legend legend = chart.Legend;
//범례는 기본적으로 차트의 오른쪽에 위치합니다.
//범례가 차트의 왼쪽 또는 오른쪽에 위치할 경우, Legend.X 속성을 설정해도 효과가 없습니다.
//범례가 차트의 위쪽 또는 아래쪽에 위치할 경우, Legend.Y 속성을 설정해도 효과가 없습니다.
legend.Y = 1500;
legend.Width = 50;
legend.Height = 50;
//범례의 위치 설정
legend.Position = LegendPositionType.Left;
Dim workbook as Workbook = new Workbook()
Dim sheet as Worksheet = workbook.Worksheets(0)
Dim cells as Cells = sheet.Cells
cells(0,1).PutValue("수익")
cells(1,0).PutValue("회사 A")
cells(2,0).PutValue("회사 B")
cells(3,0).PutValue("회사 C")
cells(1,1).PutValue(10000)
cells(2,1).PutValue(20000)
cells(3,1).PutValue(30000)
Dim chartIndex as Integer = sheet.Charts.Add(ChartType.Column, 9, 9, 21, 15)
Dim chart as Chart = sheet.Charts(chartIndex)
chart.SetChartDataRange("A1:B4", True);
'범례의 너비와 높이 설정
Dim legend as Legend = chart.Legend
'범례는 기본적으로 차트의 오른쪽에 위치합니다.
'범례가 차트의 왼쪽 또는 오른쪽에 위치할 경우, Legend.X 속성을 설정해도 효과가 없습니다.
'범례가 차트의 위쪽 또는 아래쪽에 위치할 경우, Legend.Y 속성을 설정해도 효과가 없습니다.
legend.Y = 1500
legend.Width = 50
legend.Height = 50
'범례의 위치 설정
legend.Position = LegendPositionType.Left
속성
IsOverLay
차트와 겹치지 않게 범례를 표시할지 여부를 가져오거나 설정합니다.
public bool IsOverLay { get; set; }
속성 값
LegendEntries
지정된 차트 범례의 모든 LegendEntry 객체 컬렉션을 가져옵니다. 표면 차트의 범례 항목을 설정하는 것은 지원되지 않습니다. 따라서 차트 유형이 표면 차트 유형인 경우 null을 반환합니다.
public LegendEntryCollection LegendEntries { get; }
속성 값
Position
범례 위치 유형을 가져오거나 설정합니다.
public LegendPositionType Position { get; set; }
속성 값
비고
기본 위치는 오른쪽입니다.
범례가 차트의 왼쪽 또는 오른쪽에 위치할 경우, Legend.X 속성을 설정해도 효과가 없습니다.
범례가 차트의 위쪽 또는 아래쪽에 위치할 경우, Legend.Y 속성을 설정해도 효과가 없습니다.
메서드
GetLegendLabels()
Chart.Calculate() 메서드를 호출한 후 범례 항목의 레이블을 가져옵니다.
public string[] GetLegendLabels()
반환값
string[]