ChartArea类
ChartArea类
封装代表工作表中图表区的对象。
继承: ChartArea
→
ChartFrame
ChartArea 类型公开以下成员:
属性
属性 | 描述 |
---|---|
is_inner_mode | 指示绘图区尺寸是否包括刻度线和轴标签。 False 指定大小应确定绘图区域、刻度线和轴标签的大小。 |
border | 获取 Line 。 |
area | 获取 ChartFrame.area 。 |
text_font | 获取指定 ChartFrame 对象的 ChartFrame.font 对象。 |
text_options | 获取并设置文本的选项。 |
font | 获取指定 chartarea 对象的 ChartArea.font 对象。 |
auto_scale_font | 如果对象中的文本字体大小随对象大小变化而变化,则为 True。默认值为 True。 |
background_mode | 获取和设置背景的显示模式 |
background | 获取和设置背景的显示模式 |
is_automatic_size | 指示图表框架是否自动调整大小。 |
x | 获取或获取距离其左上角列的水平偏移量,以图表区域的 1/4000 为单位。 |
y | 获取或获取距离其左上角行的垂直偏移量,以图表区域的 1/4000 为单位。 |
height | 获取或设置距图表右下角行的垂直偏移量,以图表区域的 1/4000 为单位。 |
width | 获取或设置距其右下角列的水平偏移量,以图表区域的 1/4000 为单位。 |
shadow | 如果框架有阴影则为真。 |
shape_properties | 获取 ChartFrame.shape_properties 对象。 |
is_default_pos_be_set | 指示是否设置了默认位置(DefaultX、DefaultY、DefaultWidth 和 DefaultHeight)。 |
default_x | 表示图表区域的默认位置的 x ,以 1/4000 为单位。 |
default_y | 表示图表区域的默认位置的 y 轴,以 1/4000 为单位。 |
default_width | 表示图表区域的默认位置的宽度,以 1/4000 为单位。 |
default_height | 表示图表区域的默认位置的高度,以 1/4000 为单位。 |
default_x_ratio_to_chart | 表示以图表区域分数为单位的默认位置的 x。 |
default_y_ratio_to_chart | 以图表区域的分数为单位表示默认位置的 y。 |
default_width_ratio_to_chart | 表示默认位置的宽度,以图表区域的分数为单位。 |
default_height_ratio_to_chart | 表示默认位置的高度,以图表区域的分数为单位。 |
x_ratio_to_chart | 获取或获取距离其左上角列的水平偏移量,以图表区域的比例为单位。 |
y_ratio_to_chart | 获取或获取距离其左上角行的垂直偏移量,以图表区域的比例为单位。 |
width_ratio_to_chart | 获取或设置距其右下角列的水平偏移量,以图表区域的比例为单位。 |
height_ratio_to_chart | 获取或设置距其右下角行的垂直偏移量,以图表区域的比例为单位。 |
x_pixel | 获取或设置左上角的 x 坐标(以像素为单位)。 |
y_pixel | 获取或设置左上角的 y 坐标(以像素为单位)。 |
width_pixel | 以像素为单位获取或设置框架的宽度。 |
height_pixel | 以像素为单位获取或设置框架的高度。 |
方法
方法 | 描述 |
---|---|
set_position_auto(self) | 将框架位置设置为自动 |
例子
from aspose.cells import Workbook
from aspose.cells.charts import ChartType
from aspose.pydrawing import Color
# Instantiating a Workbook object
workbook = Workbook()
# Obtaining the reference of the first worksheet
worksheet = workbook.worksheets[0]
# 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 "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 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 "B3"
chart.n_series.add("A1:B3", True)
# Getting Chart Area
chartArea = chart.chart_area
# Setting the foreground color of the chart area
chartArea.area.foreground_color = Color.yellow
# Setting Chart Area Shadow
chartArea.shadow = True
# Saving the Excel file
workbook.save("book1.xls")