ChartLineFormat Object (JavaScript API for Excel)

Enapsulates the formatting options for line elements.

Properties

Property Type Description Req. Set
color string HTML color code representing the color of lines in the chart. 1.1

See property access examples.

Relationships

None

Methods

Method Return Type Description Req. Set
clear() void Clear the line format of a chart element. 1.1

Method Details

clear()

Clear the line format of a chart element.

Syntax

chartLineFormatObject.clear();

Parameters

None

Returns

void

Examples

Clear the line format of the major gridlines on value axis of the Chart named "Chart1"

Excel.run(function (ctx) { 
    var gridlines = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1").axes.valueAxis.majorGridlines;    
    gridlines.format.line.clear();
    return ctx.sync().then(function() {
            console.log("Chart Major Gridlines Format Cleared");
    });
}).catch(function(error) {
        console.log("Error: " + error);
        if (error instanceof OfficeExtension.Error) {
            console.log("Debug info: " + JSON.stringify(error.debugInfo));
        }
});

Property access examples

Set chart major gridlines on value axis to be red.

Excel.run(function (ctx) {
    var gridlines = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1").axes.valueAxis.majorGridlines;
    gridlines.format.line.color = "#FF0000";
    return ctx.sync().then(function () {
        console.log("Chart Gridlines Color Updated");
    });
}).catch(function (error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

results matching ""

    No results matching ""