DisplayUnitLabel

DisplayUnitLabel class

Represents the display unit label.

public class DisplayUnitLabel : ChartTextFrame

Properties

Name Description
virtual Area { get; } Gets the area.
override AutoScaleFont { get; set; } True if the text in the object changes font size when the object size changes. The default value is True.
Background { get; set; } Gets and sets the display mode of the background
BackgroundMode { get; set; } Gets and sets the display mode of the background
virtual Border { get; } Gets the border.
DefaultHeight { get; } Represents height of default position
DefaultWidth { get; } Represents width of default position
DefaultX { get; } Represents x of default position
DefaultY { get; } Represents y of default position
virtual DirectionType { get; set; } Gets and sets the direction of text.
override Font { get; } Gets a Font object of the specified ChartFrame object.
virtual Height { get; set; } Gets or sets the height of frame in units of 1/4000 of the chart area.
virtual IsAutomaticSize { get; set; } Indicates whether the chart frame is automatic sized.
virtual IsAutoText { get; set; } Indicates the text is auto generated.
IsDefaultPosBeSet { get; } Indicates whether default position(DefaultX, DefaultY, DefaultWidth and DefaultHeight) are set.
IsDeleted { get; set; } Indicates whether this data labels is deleted.
IsInnerMode { get; set; } Indicates whether the size of the plot area size includes the tick marks, and the axis labels. False specifies that the size shall determine the size of the plot area, the tick marks, and the axis labels.
IsResizeShapeToFitText { get; set; } Gets or sets whether a shape should be auto-fit to fully contain the text described within it. Auto-fitting is when text within a shape is scaled in order to contain all the text inside.
virtual IsTextWrapped { get; set; } Gets or sets a value indicating whether the text is wrapped.
virtual LinkedSource { get; set; } Gets and sets a reference to the worksheet.
ReadingOrder { get; set; } Represents text reading order.
RotationAngle { get; set; } Represents text rotation angle.
Shadow { get; set; } True if the frame has a shadow.
ShapeProperties { get; } Gets the ShapeProperties object.
override Text { get; set; } Gets or sets the text of display unit label.
TextDirection { get; set; } Represents text reading order.
virtual TextFont { get; } Gets a Font object of the specified ChartFrame object.
TextHorizontalAlignment { get; set; } Gets and sets the text horizontal alignment.
TextVerticalAlignment { get; set; } Gets or sets the text vertical alignment of text.
virtual Width { get; set; } Gets or sets the width of frame in units of 1/4000 of the chart area.
virtual X { get; set; } Gets or sets the x coordinate of the upper left corner in units of 1/4000 of the chart area.
virtual Y { get; set; } Gets or sets the y coordinate of the upper left corner in units of 1/4000 of the chart area.

Methods

Name Description
Characters(int, int) Returns a Characters object that represents a range of characters within the text.
virtual SetPositionAuto() Set position of the frame to automatic

Examples


[C#]

//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Excel object
int sheetIndex = workbook.Worksheets.Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];
//Adding a sample value to "A1" cell
worksheet.Cells["A1"].PutValue(50);
//Adding a sample value to "A2" cell
worksheet.Cells["A2"].PutValue(100);
//Adding a sample value to "A3" cell
worksheet.Cells["A3"].PutValue(150);
//Adding a sample value to "A4" cell
worksheet.Cells["A4"].PutValue(200);
//Adding a sample value to "B1" cell
worksheet.Cells["B1"].PutValue(60);
//Adding a sample value to "B2" cell
worksheet.Cells["B2"].PutValue(32);
//Adding a sample value to "B3" cell
worksheet.Cells["B3"].PutValue(50);
//Adding a sample value to "B4" cell
worksheet.Cells["B4"].PutValue(40);
//Adding a sample value to "C1" cell as category data
worksheet.Cells["C1"].PutValue("Q1");
//Adding a sample value to "C2" cell as category data
worksheet.Cells["C2"].PutValue("Q2");
//Adding a sample value to "C3" cell as category data
worksheet.Cells["C3"].PutValue("Y1");
//Adding a sample value to "C4" cell as category data
worksheet.Cells["C4"].PutValue("Y2");
//Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
Chart chart = worksheet.Charts[chartIndex];
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart.NSeries.Add("A1:B4", true);
//Setting the data source for the category data of NSeries
chart.NSeries.CategoryData = "C1:C4";
//Setting the display unit of value(Y) axis.
chart.ValueAxis.DisplayUnit = DisplayUnitType.Hundreds;
DisplayUnitLabel displayUnitLabel = chart.ValueAxis.DisplayUnitLabel;
//Setting the custom display unit label
displayUnitLabel.Text = "100";
//Saving the Excel file
workbook.Save("book1.xls");

[Visual Basic]

'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Adding a new worksheet to the Excel object
Dim sheetIndex As Int32 = workbook.Worksheets.Add()
'Obtaining the reference of the newly added worksheet by passing its sheet index
Dim worksheet As Worksheet = workbook.Worksheets(sheetIndex)
'Adding a sample value to "A1" cell
worksheet.Cells("A1").PutValue(50)
'Adding a sample value to "A2" cell
worksheet.Cells("A2").PutValue(100)
'Adding a sample value to "A3" cell
worksheet.Cells("A3").PutValue(150)
'Adding a sample value to "A4" cell
worksheet.Cells("A4").PutValue(200)
'Adding a sample value to "B1" cell
worksheet.Cells("B1").PutValue(60)
'Adding a sample value to "B2" cell
worksheet.Cells("B2").PutValue(32)
'Adding a sample value to "B3" cell
worksheet.Cells("B3").PutValue(50)
'Adding a sample value to "B4" cell
worksheet.Cells("B4").PutValue(40)
'Adding a sample value to "C1" cell as category data
worksheet.Cells("C1").PutValue("Q1")
'Adding a sample value to "C2" cell as category data
worksheet.Cells("C2").PutValue("Q2")
'Adding a sample value to "C3" cell as category data
worksheet.Cells("C3").PutValue("Y1")
'Adding a sample value to "C4" cell as category data
worksheet.Cells("C4").PutValue("Y2")
'Adding a chart to the worksheet
Dim chartIndex As Int32 = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5)
'Accessing the instance of the newly added chart
Dim chart As Chart = worksheet.Charts(chartIndex)
'Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart.NSeries.Add("A1:B4", True)
'Setting the data source for the category data of NSeries
Chart.NSeries.CategoryData = "C1:C4"
'Setting the display unit of value(Y) axis.
chart.ValueAxis.DisplayUnit = DisplayUnitType.Hundreds
Dim displayUnitLabel As DisplayUnitLabel = chart.ValueAxis.DisplayUnitLabel
'Setting the custom display unit label
displayUnitLabel.Text = "100"
'Saving the Excel file
workbook.Save("book1.xls")

See Also