You can create a vari sparkline using the VARISPARKLINE formula and cell values.


The vari sparkline has the following options:
| Option | Description |
| variance | A number or reference that represents the bar length, such as 2 or "A1". |
| reference | A number or reference that represents the location of the reference line, such as 0 or "A2". This setting is optional. The default value is 0. |
| mini | A number or reference that represents the minimum value of the sparkline, such as -5 or "A3". This setting is optional. The default value is -1. |
| maxi | A number or reference that represents the maximum value of the sparkline, such as 5 or "A4". This setting is optional. The default value is 1. |
| mark | A number or reference that represents the position of the mark line, such as 3 or "A5". This setting is optional. |
| tickunit | A number or reference that represents a tick unit, such as 1 or "A6". This setting is optional. The default value is 0. |
| legend | A boolean that represents whether to display the text. The default is optional. The default value is FALSE. |
| colorPositive | A string that represents the color sheme for variance and is larger than reference. This setting is optional. The default value is "green". |
| colorNegative | A string that represents the color scheme for variance and is smaller than reference. This setting is optional. The default value is "red". |
| vertical | A boolean that represents whether to display the sparkline vertically. This setting is optional. The default value is FALSE. |
The vari sparkline formula has the following format:
=VARISPARKLINE(variance, reference, mini, maxi, mark, tickunit, legend, colorPositive, colorNegative, vertical)
The following code creates vari sparklines.
| JavaScript |
Copy Code
|
|---|---|
activeSheet.setFormula(0,1,'=VARISPARKLINE(3,0,-5,5,0.5,0.5,TRUE,"green","red",FALSE)'); activeSheet.setFormula(0,0,'=VARISPARKLINE(-3,3,-5,5,0.5,0.5,TRUE,"green","red",TRUE)'); |
|