SpreadJS 13
GC.Spread.Sheets.Shapes Namespace / ShapeStyle type / line Field
In This Topic
    line Field
    In This Topic
    Indicates the line options.
    Syntax
    var instance = new GC.Spread.Sheets.Shapes.ShapeStyle(style);
    var value; // Type: Object
    value = instance.line;
    var line : Object;
    Example
    //This sample sets line color, line style, line width, cap type, join type and line color transparency for the shape.
    var shape = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
    //var shape = sheet.shapes.addConnector("Shape1", GC.Spread.Sheets.Shapes.ConnectorType.straight, 100, 60, 200, 160);
    var oldStyle = shape.style();
    oldStyle.line.color = "red";
    oldStyle.line.lineStyle = GC.Spread.Sheets.Shapes.PresetLineDashStyle.dashDot;
    oldStyle.line.width = 5;
    oldStyle.line.capType = GC.Spread.Sheets.Shapes.LineCapStyle.square;
    oldStyle.line.joinType = GC.Spread.Sheets.Shapes.LineJoinStyle.miter;
    oldStyle.line.transparency = 0.5;
    shape.style(oldStyle);
    
    //This sample sets line color, line style, line width, cap type, join type and line color transparency with formula for the shape.
    var shape = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
    //var shape = sheet.shapes.addConnector("Shape1", GC.Spread.Sheets.Shapes.ConnectorType.straight, 100, 60, 200, 160);
    sheet.setValue(0, 1, "red");
    sheet.setValue(1, 1, 4);
    sheet.setValue(2, 1, 5);
    sheet.setValue(3, 1, 1);
    sheet.setValue(4, 1, 1);
    sheet.setValue(5, 1, 0.5);
    var oldStyle = shape.style();
    oldStyle.line.color = "=Sheet1!B1";
    oldStyle.line.lineStyle = "=Sheet1!B2";
    oldStyle.line.width = "=Sheet1!B3";
    oldStyle.line.capType = "=Sheet1!B4";
    oldStyle.line.joinType = "=Sheet1!B5";
    oldStyle.line.transparency = "=Sheet1!B6";
    shape.style(oldStyle);
    
    //This sample sets line's begin arrowhead style, width, length and end arrowhead style, width, height for the shape.
    var shape = sheet.shapes.addConnector("Shape1", GC.Spread.Sheets.Shapes.ConnectorType.straight, 100, 60, 200, 160);
    var oldStyle = shape.style();
    oldStyle.line.beginArrowheadStyle = GC.Spread.Sheets.Shapes.ArrowheadStyle.triangle;
    oldStyle.line.beginArrowheadWidth = GC.Spread.Sheets.Shapes.ArrowheadWidth.narrow;
    oldStyle.line.beginArrowheadLength = GC.Spread.Sheets.Shapes.ArrowheadLength.short;
    oldStyle.line.endArrowheadStyle = GC.Spread.Sheets.Shapes.ArrowheadStyle.diamond;
    oldStyle.line.endArrowheadWidth = GC.Spread.Sheets.Shapes.ArrowheadWidth.wide;
    oldStyle.line.endArrowheadLength = GC.Spread.Sheets.Shapes.ArrowheadLength.long;
    shape.style(oldStyle);
    See Also

    Reference

    ShapeStyle type