ChartTitle Object (JavaScript API for Excel)
Represents a chart title object of a chart.
Properties
| Property | Type | Description | Req. Set |
|---|---|---|---|
| overlay | bool | Boolean value representing if the chart title will overlay the chart or not. | 1.1 |
| text | string | Represents the title text of a chart. | 1.1 |
| visible | bool | A boolean value the represents the visibility of a chart title object. | 1.1 |
See property access examples.
Relationships
| Relationship | Type | Description | Req. Set |
|---|---|---|---|
| format | ChartTitleFormat | Represents the formatting of a chart title, which includes fill and font formatting. Read-only. | 1.1 |
Methods
None
Method Details
Property access examples
Get the text of Chart Title from Chart1.
Excel.run(function (ctx) {
var chart = ctx.workbook.worksheets.getItem("Sample").charts.getItem("Chart1");
chart.load('title/text');
return ctx.sync()
.then(function () {
console.log("Chart title is '" + chart.title.text + "'");
})
}).catch(errorHandler);
Set the text of Chart Title for Chart1 to "My Chart" and make it show on top of the chart without overlaying.
Excel.run(function (ctx) {
var chart = ctx.workbook.worksheets.getItem("Sample").charts.getItem("Chart1");
chart.title.text = "My Chart";
chart.title.visible = true;
chart.title.overlay = false;
return ctx.sync()
.then(function () {
console.log("Chart title has been updated");
})
}).catch(errorHandler);