Class Line

Line class

Encapsulates the object that represents the line format.

public class Line

Properties

NameDescription
BeginArrowLength { get; set; }Specifies the length of the arrowhead for the begin of a line.
BeginArrowWidth { get; set; }Specifies the width of the arrowhead for the begin of a line.
BeginType { get; set; }Specifies an arrowhead for the begin of a line.
CapType { get; set; }Specifies the ending caps.
Color { get; set; }Represents the Color of the line.
CompoundType { get; set; }Specifies the compound line type
DashType { get; set; }Specifies the dash line type
EndArrowLength { get; set; }Specifies the length of the arrowhead for the end of a line.
EndArrowWidth { get; set; }Specifies the width of the arrowhead for the end of a line.
EndType { get; set; }Specifies an arrowhead for the end of a line.
FormattingType { get; set; }Gets or sets format type.
GradientFill { get; }Represents gradient fill.
IsAuto { get; set; }Indicates whether this line style is auto assigned.
IsAutomaticColor { get; }Indicates whether the color of line is automatic assigned.
IsVisible { get; set; }Represents whether the line is visible.
JoinType { get; set; }Specifies the joining caps.
Style { get; set; }Represents the style of the line.
ThemeColor { get; set; }Gets and sets the theme color.
Transparency { get; set; }Returns or sets the degree of transparency of the line as a value from 0.0 (opaque) through 1.0 (clear).
Weight { get; set; }Gets or sets the WeightType of the line.
WeightPt { get; set; }Gets or sets the weight of the line in unit of points.
WeightPx { get; set; }Gets or sets the weight of the line in unit of pixels.

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Charts;
using Aspose.Cells.Drawing;
using System.Drawing;

namespace AsposeCellsExamples
{
    public class DrawingClassLineDemo
    {
        public static void Run()
        {
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];
            
            Cells cells = sheet.Cells;
            cells[0,1].PutValue("Income");
            cells[1,0].PutValue("Company A");
            cells[2,0].PutValue("Company B");
            cells[3,0].PutValue("Company C");
            cells[1,1].PutValue(10000);
            cells[2,1].PutValue(20000);
            cells[3,1].PutValue(30000);
            
            int chartIndex = sheet.Charts.Add(Aspose.Cells.Charts.ChartType.Line, 9, 9, 21, 15);
            Aspose.Cells.Charts.Chart chart = sheet.Charts[chartIndex];
            
            chart.NSeries.Add("B1:B4", true);
            chart.NSeries.CategoryData = "A2:A4";
            
            chart.NSeries[0].Border.Style = LineType.Dot;
            chart.NSeries[0].Border.Color = Color.Red;
            chart.NSeries[0].Marker.MarkerStyle = ChartMarkerType.Triangle;
            chart.NSeries[0].Border.Weight = WeightType.MediumLine;
            
            workbook.Save("LineChartDemo.xlsx");
        }
    }
}

See Also