跳到主要内容

GetChartType

Returns a type of the chart object.

Syntax

expression.GetChartType();

expression - A variable that represents a ApiChart class.

Parameters

This method doesn't have any parameters.

Returns

ChartType

Example

This example shows how to get a type of a chart

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);

const chart = Api.CreateChart('bar3D', [
[200, 240, 280],
[250, 260, 280]
], ['Projected Revenue', 'Estimated Costs'], [2014, 2015, 2016], 4051300, 2347595, 24);

const solidGrey = Api.CreateSolidFill(Api.CreateRGBColor(51, 51, 51));
const solidOrange = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
chart.SetSeriesFill(solidGrey, 0, false);
chart.SetSeriesFill(solidOrange, 1, false);
const chartType = chart.GetChartType();
chart.SetTitle('This chart is of the ' + chartType + ' type', 14);

slide.RemoveAllObjects();
slide.AddObject(chart);