DisplayUnitLabel类

DisplayUnitLabel类

代表显示单元标签。

遗产: DisplayUnitLabelChartTextFrameChartFrame

DisplayUnitLabel 类型公开以下成员:

特性

属性描述
is_inner_mode指示绘图区域大小是否包括刻度线和轴标签。
False 指定大小应确定绘图区域、刻度线和轴标签的大小。
border获取Line
area获取ChartFrame.area
text_font获取指定ChartFrame对象的ChartFrame.font对象。
text_options获取和设置文本的选项。
font获取指定ChartFrame对象的DisplayUnitLabel.font对象。
auto_scale_font如果对象中的文本随对象大小更改而更改字体大小,则为 true。默认值是true。
background_mode获取和设置背景的显示模式
background获取和设置背景的显示模式
is_automatic_size指示图表框架是否自动调整大小。
x获取或设置图表区域左上角的 x 坐标,以 1/4000 为单位。
y获取或设置图表区域左上角的 y 坐标,以 1/4000 为单位。
height获取或设置框架的高度,以图表区域的 1/4000 为单位。
width获取或设置框架的宽度,以图表区域的 1/4000 为单位。
shadow如果框架有阴影,则为 true。
shape_properties获取 ChartFrame.shape_properties 对象。
is_default_pos_be_set指示是否设置默认位置(DefaultX、DefaultY、DefaultWidth 和 DefaultHeight)。
default_x代表默认位置的x
default_y代表默认位置的y
default_width代表默认位置的宽度
default_height代表默认位置的高度
is_auto_text表示文本是自动生成的。
is_deleted指示该数据标签是否被删除。
text_horizontal_alignment获取和设置文本水平对齐方式。
text_vertical_alignment获取或设置文本的垂直对齐方式。
rotation_angle代表文本旋转角度。
is_automatic_rotation指示图表文本是否自动旋转。
text获取或设置显示单元标签的文本。
linked_source获取和设置对工作表的引用。
text_direction代表文本阅读顺序。
reading_order代表文本阅读顺序。
direction_type获取和设置文本的方向。
is_text_wrapped获取或设置一个值,该值指示文本是否换行。
is_resize_shape_to_fit_text获取或设置形状是否应自动调整以完全包含其中描述的文本。自动适配是
当缩放形状内的文本以包含其中的所有文本时。

方法

方法描述
set_position_auto将框架位置设置为自动
characters返回一个 Characters 对象,该对象表示文本中的一系列字符。

例子

from aspose.cells import Workbook
from aspose.cells.charts import ChartType, DisplayUnitType

# Instantiating a Workbook object
workbook = Workbook()
# Adding a new worksheet to the Excel object
sheetIndex = workbook.worksheets.add()
# Obtaining the reference of the newly added worksheet by passing its sheet index
worksheet = workbook.worksheets[sheetIndex]
# Adding a sample value to "A1" cell
worksheet.cells.get("A1").put_value(50)
# Adding a sample value to "A2" cell
worksheet.cells.get("A2").put_value(100)
# Adding a sample value to "A3" cell
worksheet.cells.get("A3").put_value(150)
# Adding a sample value to "A4" cell
worksheet.cells.get("A4").put_value(200)
# Adding a sample value to "B1" cell
worksheet.cells.get("B1").put_value(60)
# Adding a sample value to "B2" cell
worksheet.cells.get("B2").put_value(32)
# Adding a sample value to "B3" cell
worksheet.cells.get("B3").put_value(50)
# Adding a sample value to "B4" cell
worksheet.cells.get("B4").put_value(40)
# Adding a sample value to "C1" cell as category data
worksheet.cells.get("C1").put_value("Q1")
# Adding a sample value to "C2" cell as category data
worksheet.cells.get("C2").put_value("Q2")
# Adding a sample value to "C3" cell as category data
worksheet.cells.get("C3").put_value("Y1")
# Adding a sample value to "C4" cell as category data
worksheet.cells.get("C4").put_value("Y2")
# Adding a chart to the worksheet
chartIndex = worksheet.charts.add(ChartType.COLUMN, 5, 0, 15, 5)
# Accessing the instance of the newly added chart
chart = worksheet.charts[chartIndex]
# Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart.n_series.add("A1:B4", True)
# Setting the data source for the category data of NSeries
chart.n_series.category_data = "C1:C4"
# Setting the display unit of value(Y) axis.
chart.value_axis.display_unit = DisplayUnitType.HUNDREDS
displayUnitLabel = chart.value_axis.display_unit_label
# Setting the custom display unit label
displayUnitLabel.text = "100"
# Saving the Excel file
workbook.save("book1.xls")

也可以看看