跳到主要内容

GetChartType

返回图表对象的类型。

语法

expression.GetChartType();

expression - 表示 ApiChart 类的变量。

参数

此方法没有任何参数。

返回值

ChartType

示例

如何获取图表的图表类型。

const doc = Api.GetDocument();
const page = doc.GetPage(0);

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

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);

page.AddObject(chart);