Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can create an area sparkline using the AreaSparkline formula and cell values.
Image Removed
The area sparkline formula has the following options:通过AREASPARKLINE函数可以创建面积函数迷你图
Image Added
AREASPARKLINE函数有以下这些参数:

Option

Description

Points

A cell range. Invalid numbers are ignored.

Min

A number that represents the minimum value of the sparkline. This setting is optional.

Max

A number that represents the maximum value of the sparkline. This setting is optional.

Line1

A number that represents a horizontal line's vertical position. This setting is optional.

Line2

A number that represents a second horizontal line's vertical position. This setting is optional.

ColorPositive

A string that represents the area color of positive values. This setting is optional.

ColorNegative

A string that represents the area color of negative values. This setting is optional.

...

表示一片数据区域,例如 "D1:D6"。如果这片区域中哪个单元格的值不是一个合法的数字,那么会它的值被视为0。

Min

(可选的参数)迷你图的值域下限。 这片区域的最小值和你设置的值域下限中更小的起作用。 默认值是这片数据区域的最小值。

Max

(可选参数)迷你图的值域上限。这片区域中的最大值和你设置的值域上限中更大的起作用。默认值是这篇数据区域的最大值。

Line1

(可选参数)表示一个水平线在垂直方向的位置的值;默认情况下是不存在的这根线的。

Line2

(可选参数)表示另外一个水平线在垂直方向的位置的值;默认情况下也是不存在这根线的。

ColorPositive

(可选参数)表示值是正数的区域填充颜色;默认值是"#787878"。

ColorNegative

(可选参数)表示值是负数的区域填充颜色;默认值是"#CB0000"。

你可以通过面积函数创建一个面积函数迷你图。比如:

=AREASPARKLINE(points, min, max, line1, line2, colorPositive, colorNegative) Using Code
This example creates an area sparkline.

...

JavaScript

...

Copy Code

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

Code Block
languagejs
titleJavaScript
activeSheet.addSpan(6, 0, 3, 4);
activeSheet.setValue(0, 0, 10);
activeSheet.setValue(1, 0, 5);
activeSheet.setValue(2, 0, 25);
activeSheet.setValue(3, 0, -5);
activeSheet.setValue(4, 0, 17);
activeSheet.setValue(5, 0, 1);
activeSheet.setFormula(6, 0, '=AREASPARKLINE(A1:A6,-15,15,5,-5,"red","green")'); 
activeSheet.setColumnWidth(0, 80);
activeSheet.setColumnWidth(1, 80);
activeSheet.setColumnWidth(2, 80);
activeSheet.setColumnWidth(3, 80);

...

 

See Also

setFormula Method