Class Legend

Class Legend

Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)

شی‌ء را که نمایانگر افسانه نمودار است، محصور می‌کند.

public class Legend : ChartTextFrame

وراثت

objectChartFrameChartTextFrameLegend

اعضای وراثت‌یافته

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; }

مقدار خاصیت

bool

LegendEntries

مجموعه‌ای از تمام اشیاء LegendEntry در افسانه نمودار مشخص‌شده را دریافت می‌کند. تنظیم ورودی‌های افسانه برای نمودار سطحی پشتیبانی نمی‌شود. بنابراین اگر نوع نمودار نوع سطحی باشد، null برمی‌گرداند.

public LegendEntryCollection LegendEntries { get; }

مقدار خاصیت

LegendEntryCollection

Position

نوع موقعیت افسانه را دریافت یا تنظیم می‌کند.

public LegendPositionType Position { get; set; }

مقدار خاصیت

LegendPositionType

توضیحات


موقعیت پیش‌فرض در سمت راست است.
اگر افسانه در سمت چپ یا راست نمودار باشد، تنظیم خاصیت Legend.X تأثیری نخواهد داشت.
اگر افسانه در بالای یا پایین نمودار باشد، تنظیم خاصیت Legend.Y تأثیری نخواهد داشت.

متدها

GetLegendLabels()

برچسب‌های ورودی‌های افسانه را پس از فراخوانی متد Chart.Calculate() دریافت می‌کند.

public string[] GetLegendLabels()

بازگشت

string[]

 فارسی