转至元数据结尾
转至元数据起始

子弹函数迷你图是一种可以在一小片地方展示大量数据的迷你图。

通过BulletSparkline函数可以创建子弹函数迷你图

BulletSparkline函数有以下参数:

Option

Description

Measure

类型为数字或者引用,表示测量条的长度,例如 5 或者 "A1"。

Target

类型为数值或者引用,表示目标线的位置,例如 7 或者 "A2"。

Maxi

类型为数值或者引用,表示这个迷你图中的最大值,例如 10 或者 "A3"。

Good

(可选参数)类型为数值或者引用,表示好值条的长度,例如 3 或者 "A4";默认值是0.

Bad

(可选参数)类型为数值或者引用,表示坏值条的长度,例如 1 或者 "A5";默认值是0。

Forecast

(可选参数)类型为数值或者引用,表示预测值线的长度,例如 8 或者 "A6";默认值是0。

Tickunit

(可选参数)类型为数值或者引用,表示刻度单位,例如 1 或者 "A7";默认值是0。

ColorScheme

(可选参数)类型为颜色字符串,表示主体颜色的字符串,主体颜色会生成一组颜色来展示这个迷你图。默认值是 "#A0A0A0"。

Vertical

(可选参数)类型为布尔值,表示是否让箱线函数迷你图垂直显示;默认值是false,也就是默认是水平显示。

你可以通过子弹函数创建一个子弹函数迷你图,例如 
=BULLETSPARKLINE(measure, target, maxi, good?, bad?, forecast?, tickunit?, colorScheme?, vertical?)

下面代码展示了如何创建子弹函数迷你图

JavaScript
activeSheet.addSpan(0, 0, 1, 4);
activeSheet.getCell(0, 0, GC.Spread.Sheets.SheetArea.viewport).value("Employee KPI").font("20px Arial").hAlign(GC.Spread.Sheets.HorizontalAlign.center).vAlign(GC.Spread.Sheets.VerticalAlign.center);
var table1 = activeSheet.tables.add("table1", 1, 0, 7, 4, GC.Spread.Sheets.Tables.TableThemes.light12);
table1.filterButtonVisible(false);
activeSheet.setValue(1, 0, "Name");
activeSheet.setValue(1, 1, "Forecast");
activeSheet.setValue(1, 2, "Actuality");
activeSheet.setValue(1, 3, "Diagram");
activeSheet.setValue(2, 0, "Employee 1");
activeSheet.setValue(2, 1, 6);
activeSheet.setValue(2, 2, 6);
activeSheet.setValue(3, 0, "Employee 2");
activeSheet.setValue(3, 1, 8);
activeSheet.setValue(3, 2, 7);
activeSheet.setValue(4, 0, "Employee 3");
activeSheet.setValue(4, 1, 6);
activeSheet.setValue(4, 2, 4);
activeSheet.setValue(5, 0, "Employee 4");
activeSheet.setValue(5, 1, 7);
activeSheet.setValue(5, 2, 9);
activeSheet.setValue(6, 0, "Employee 5");
activeSheet.setValue(6, 1, 6);
activeSheet.setValue(6, 2, 8);
activeSheet.setValue(7, 0, "Employee 6");
activeSheet.setValue(7, 1, 8);
activeSheet.setValue(7, 2, 7);
activeSheet.setFormula(2, 3, '=BULLETSPARKLINE(C3,7,10,8,5,B3,1');
activeSheet.setFormula(3, 3, '=BULLETSPARKLINE(C4,7,10,8,5,B4,1');
activeSheet.setFormula(4, 3, '=BULLETSPARKLINE(C5,7,10,8,5,B5,1');
activeSheet.setFormula(5, 3, '=BULLETSPARKLINE(C6,7,10,8,5,B6,1');
activeSheet.setFormula(6, 3, '=BULLETSPARKLINE(C7,7,10,8,5,B7,1');
activeSheet.setFormula(7, 3, '=BULLETSPARKLINE(C8,7,10,8,5,B8,1');
activeSheet.setRowHeight(0, 50);
for (var i = 1; i < 8; i++) {
    activeSheet.setRowHeight(i, 40);
}
activeSheet.setColumnWidth(0, 100);
activeSheet.setColumnWidth(1, 100);
activeSheet.setColumnWidth(2, 100);
activeSheet.setColumnWidth(3, 200);

See Also

setFormula Method

  • 无标签