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[]

 日本語