Line class

Line class

Encapsulates the object that represents the line format.

The Line type exposes the following members:

Properties

PropertyDescription
compound_typeSpecifies the compound line type
dash_typeSpecifies the dash line type
cap_typeSpecifies the ending caps.
join_typeSpecifies the joining caps.
begin_typeSpecifies an arrowhead for the begin of a line.
end_typeSpecifies an arrowhead for the end of a line.
begin_arrow_lengthSpecifies the length of the arrowhead for the begin of a line.
end_arrow_lengthSpecifies the length of the arrowhead for the end of a line.
begin_arrow_widthSpecifies the width of the arrowhead for the begin of a line.
end_arrow_widthSpecifies the width of the arrowhead for the end of a line.
theme_colorGets and sets the theme color.
colorRepresents the Color of the line.
transparencyReturns or sets the degree of transparency of the line as a value from 0.0 (opaque) through 1.0 (clear).
styleRepresents the style of the line.
weightGets or sets the WeightType of the line.
weight_ptGets or sets the weight of the line in unit of points.
weight_pxGets or sets the weight of the line in unit of pixels.
formatting_typeGets or sets format type.
is_automatic_colorIndicates whether the color of line is automatic assigned.
is_visibleRepresents whether the line is visible.
is_autoIndicates whether this line style is auto assigned.
gradient_fillRepresents gradient fill.

Example

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

See Also