Series类

Series类

封装代表图表中单个数据系列的对象。

Series 类型公开以下成员:

属性

属性描述
is_filtered表示该系列是否被选中或被过滤。True 表示该系列被过滤,不会显示在图表上。
layout_properties表示布局的属性。
points获取图表中一系列点的集合。
area表示Series对象的背景区域。
border表示系列对象的边框。
name获取或设置数据系列的名称。
display_name获取图表上显示的系列名称。
count_of_data_values获取数据值的数量。
is_vertical_values指示数据源是否是垂直的。
values表示此图表系列的 Y 值。
values_format_code表示 Values 的 NumberList 的格式代码。
x_values_format_code表示X Values的NumberList的格式代码。
x_values表示图表系列的 x 值。
bubble_sizes获取或设置图表系列的气泡大小值。
trend_lines返回此系列的所有趋势线。
smooth表示曲线平滑。
如果折线图或散点图的曲线平滑功能已打开,则为 True。
仅适用于线图和由线连接的散点图。
shadow如果该系列有阴影则为真。
has_3d_effect如果该系列具有三维外观,则为真。
仅适用于气泡图。
bar_3d_shape_type获取或设置用于三维条形图或柱形图的三维形状类型。
data_labels表示指定 ASeries 的 DataLabels 对象。
type获取或设置数据系列的类型。
marker获取 Series.marker
plot_on_second_axis指示此系列是否绘制在第二个值轴上。
x_error_bar表示该系列的X方向误差线。
y_error_bar表示该系列的 Y 方向误差条。
has_hi_lo_lines如果折线图有高低线,则为真。
仅适用于折线图。
hi_lo_lines返回一个 HiLoLines 对象,该对象代表折线图上一系列的高低线。
仅适用于折线图。
has_series_lines如果堆积柱形图或条形图有系列线或
如果饼图或饼图条形图的两个部分之间有连接线。
仅适用于堆积柱形图、条形图、饼图或饼条图。
series_lines返回一个 SeriesLines 对象,该对象代表堆积条形图或堆积柱形图的系列线。
仅适用于堆积条形图和堆积柱形图。
has_drop_lines如果图表有下降线,则为真。
仅适用于折线图或面积图。
drop_lines返回一个 Line 对象,该对象代表折线图或面积图上一系列的下拉线。
仅适用于折线图或面积图。
has_up_down_bars如果折线图有上涨和下跌的条形图,则为真。
仅适用于折线图。
up_bars返回代表折线图上向上条的 DropBars 对象。
仅适用于折线图。
down_bars返回代表折线图上向下条形的 DropBars 对象。
仅适用于折线图。
is_color_varied表示点的颜色是否变化。
图表必须仅包含一个系列。
gap_width返回或设置条形或列簇之间的空间,以条形或列宽度的百分比表示。
此属性的值必须介于 0 到 500 之间。
first_slice_angle获取或设置第一个饼图或圆环图切片的角度,以度为单位(从垂直方向顺时针旋转)。
仅适用于饼图、三维饼图和圆环图,0 到 360。
overlap指定条形和柱形的定位方式。
可以是 -100 到 100 之间的值。
仅适用于二维条形图和二维柱形图。
second_plot_size返回或设置饼图或饼图条形图的次要部分的大小,
占主要饼图大小的百分比。
可以是 5 至 200 之间的值。
split_type返回或设置一个值,该值用于确定哪些数据点位于饼图或饼图的第二个饼图或条形图中
饼图。
split_value返回或设置一个值,该值将用于确定哪些数据点位于第二个饼图或条形图中
饼图中的饼或饼图中的条。
is_auto_split指示阈值是否自动。
bubble_scale获取或设置指定图表组中气泡的比例因子。
它可以是从 0(零)到 300 的整数值,
对应于默认大小的百分比。
仅适用于气泡图。
size_represents获取或设置气泡图上气泡大小所代表的含义。
show_negative_bubbles如果图表组显示负气泡,则为 True。仅适用于气泡图。
doughnut_hole_size返回或设置圆环图组中孔的大小。
孔洞大小以图表大小的百分比表示,介于 10% 到 90% 之间。
explosion打开的饼图切片与饼图中心的距离以饼图直径的百分比表示。
has_radar_axis_labels如果雷达图具有分类轴标签,则为 True。仅适用于雷达图。
has_leader_lines如果系列有引导线,则为真。
leader_lines表示图表上的引线。引线将数据标签连接到数据点。
该对象不是一个集合;没有代表单条引线的对象。
legend_entry根据该系列获取图例条目。
shape_properties获取保存该系列的可视形状属性的 ShapePropertyCollection 对象。

方法

方法描述
move(self, count)将系列向上或向下移动。

例子

from aspose.cells import Workbook
from aspose.cells.charts import ChartMarkerType, ChartType, FormattingType
from aspose.pydrawing import Color

# 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"
seriesIndex = chart.n_series.add("A1:B4", True)
# Setting the data source for the category data of NSeries
chart.n_series.category_data = "C1:C4"
series = chart.n_series[seriesIndex]
# Setting the values of the series.
series.values = "=B1:B4"
# Changing the chart type of the series.
series.type = ChartType.LINE
# Setting marker properties.
series.marker.marker_style = ChartMarkerType.CIRCLE
series.marker.foreground_color_set_type = FormattingType.AUTOMATIC
series.marker.foreground_color = Color.black
series.marker.background_color_set_type = FormattingType.AUTOMATIC
# do your business
# Saving the Excel file
workbook.save("book1.xls")

也可以看看