跳到主要内容

SetShowPointDataLabel

指定数据标签的显示选项。

语法

expression.SetShowPointDataLabel(nSeriesIndex, nPointIndex, bShowSerName, bShowCatName, bShowVal, bShowPercent);

expression - 表示 ApiChart 类的变量。

参数

名称必需/可选数据类型默认值描述
nSeriesIndex必需number用于构建图表的数据数组中的系列索引。
nPointIndex必需number此系列中的数据点索引。
bShowSerName必需boolean是否显示或隐藏用于构建图表数据的源表列名。
bShowCatName必需boolean是否显示或隐藏用于构建图表数据的源表行名。
bShowVal必需boolean是否显示或隐藏图表数据值。
bShowPercent必需boolean是否显示或隐藏数据值的百分比(适用于堆叠图表类型)。

返回值

boolean

示例

如何使用选项显示特定的图表数据标签。

// Create a chart, set its properties and the visibility of its data labels options.

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.SetVerAxisTitle("USD In Hundred Thousands", 10);
chart.SetHorAxisTitle("Year", 11);
chart.SetTitle("Financial Overview", 13);
chart.SetSize(150 * 36000, 65 * 36000);
chart.SetShowPointDataLabel(1, 0, false, false, true, false);
chart.SetPosition(608400, 1267200);

let fill = Api.CreateSolidFill(Api.CreateRGBColor(51, 51, 51));
chart.SetSeriesFill(fill, 0, false);
fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
chart.SetSeriesFill(fill, 1, false);
page.AddObject(chart);