Skip to content

Latest commit

 

History

History
76 lines (56 loc) · 2.16 KB

chartlegend.md

File metadata and controls

76 lines (56 loc) · 2.16 KB

ChartLegend

Represents the legend in a chart.

Property Type Description
overlay bool Boolean value for whether the chart legend should overlap with the main body of the chart.
position string Represents the position of the legend on the chart. Possible values are: Top, Bottom, Left, Right, Corner, Custom.
visible bool A boolean value the represents the visibility of a ChartLegend object.

Relationships

Relationship Type Description
format ChartLegendFormat Represents the formatting of a chart legend, which includes fill and font formatting. Read-only.

Methods

Method Return Type Description
load(param: object) void Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.

API Specification

load(param: object)

Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.

Syntax

object.load(param);

Parameters

Parameter Type Description
param object Optional. Accepts parameter and relationship names as delimited string or an array. Or, provide loadOption object.

Returns

void

Examples

Back

Getter and Setter Examples

Get the position of Chart Legend from Chart1

var ctx = new Excel.RequestContext();
var chart = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1");	

var legend = chart.legend;
ctx.load(legend);
ctx.executeAsync().then(function () {
		Console.log(legend.position);
});

Set to show legend of Chart1 and make it on top of the chart.

var ctx = new Excel.RequestContext();
var chart = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1");	

chart.legend.visible = true;
chart.legend.position = "top"; 
chart.legend.overlay = false; 
ctx.executeAsync().then(function () {
		Console.log("Legend Shown ");
});

Back