Line类

Line类

封装表示行格式的对象。

Line 类型公开以下成员:

属性

属性描述
compound_type指定复合线类型
dash_type规定虚线类型
cap_type指定结束大写。
join_type指定连接端。
begin_type指定线的开头的箭头。
end_type指定线末端的箭头。
begin_arrow_length指定线起点箭头的长度。
end_arrow_length指定线末端箭头的长度。
begin_arrow_width指定线起点箭头的宽度。
end_arrow_width指定线末端箭头的宽度。
theme_color获取并设置主题颜色。
color代表线条的颜色。
transparency返回或设置线条的透明度,范围是 0.0(不透明)到 1.0(透明)。
style代表线条的风格。
weight获取或设置该行的 WeightType
weight_pt获取或设置线的粗细(以点为单位)。
weight_px获取或设置线条的粗细(以像素为单位)。
formatting_type获取或设置格式类型。
is_automatic_color指示是否自动分配线条颜色。
is_visible表示该线是否可见。
is_auto指示此线条样式是否自动分配。
gradient_fill代表渐变填充。

例子

from aspose.cells import Workbook
from aspose.cells.charts import ChartMarkerType, ChartType
from aspose.cells.drawing import LineType, WeightType
from aspose.pydrawing import Color

workbook = Workbook()
sheet = workbook.worksheets[0]
cells = sheet.cells
cells.get(0, 1).put_value("Income")
cells.get(1, 0).put_value("Company A")
cells.get(2, 0).put_value("Company B")
cells.get(3, 0).put_value("Company C")
cells.get(1, 1).put_value(10000)
cells.get(2, 1).put_value(20000)
cells.get(3, 1).put_value(30000)
chartIndex = sheet.charts.add(ChartType.LINE, 9, 9, 21, 15)
chart = sheet.charts[chartIndex]
# Add series
chart.n_series.add("A2:B4", True)
# Set category data
chart.n_series.category_data = "=Sheet1!$A$2:$A$4"
# Applying a dotted line style on the lines of an NSeries
chart.n_series[0].border.style = LineType.DOT
chart.n_series[0].border.color = Color.red
# Applying a triangular marker style on the data markers of an NSeries
chart.n_series[0].marker.marker_style = ChartMarkerType.TRIANGLE
# Setting the weight of all lines in an NSeries to medium
chart.n_series[0].border.weight = WeightType.MEDIUM_LINE

也可以看看