Sparklines
Release: |
4.6 • 5.0 • 5.1 • 5.2 • 5.3 • 5.4 • 6.0 • 6.1 • 6.2 • 6.3 • 6.4 • 6.5 |
---|

The Sparkline Library makes it easy to include miniature simplified plots of a series in a result table cell. To use the library, select File / Add Library... and link the "Sparkline Library.ana"
into your model.
The library contains three functions: Spark_line
, Spark_bars
and Spark_win_loss
. The basic usage for all three is to pass two parameters, e.g.,
Spark_line( series, T )
where «series» is indexed by «T», and «T» corresponds to the horizontal axis of the plot. The result of the call is an image, which automatically displays in a table cell when that is the result. The optional parameters are very similar for the three functions.
The functions
Spark_line( series, T, width, height, lineColor, symbolColor, negColor, highestColor, lowestColor, firstColor, lastColor )
Returns a sparkline plot (i.e., an image) for a 1-D «series» of data. The series is along index «T».
Spark_bars( series, T, width, height, color, negColor, highestColor, lowestColor, firstColor, lastColor )
Returns a sparkline bar plot (i.e., an image) for a 1-D «series» of data. The series is along index «T». Excel calls a sparkline plot of this type a "column style".
Spark_win_loss( series, T, width, height, color, negColor, highestColor, lowestColor, firstColor, lastColor )
Returns a sparkline win-loss plot (i.e., an image) for a 1-D «series» of data. The series is along index «T». A win-loss is used with series containing values that toggle between positive and negative values (positive = win, negative = loss), and show only the sign of «series», usually with a different color for positive and negatives.
Parameters
- «series»: The data depicted in the spark plot. It must be indexed by «T». It can have other indexes, which will result in an array of spark plots.
- «T»: The time-like index that corresponds to the horizontal dimension in the spark plot.
The remaining parameters are optional:
- «width» and «height» are in pixels and specify the size of the sparkline image.
- «lineColor»: Custom color for the line. Color name or color int.
- «symbolColor»: Show a symbol on each data point with the specified color. This can be a single color , or you can vary this along T to specify a different custom color for every symbol. Use Null to hide specific symbols.
- «color»: The color for each bar. This can be a single color , or you can vary this along T to specify a different custom color for each bar. Use Null to hide specific symbols.
The remaining optional color parameters are for convenience. When any of these is specified, it overrides any entry in «symbolColor» for the applicable points.
- «negColor»: Symbol color to be used for negative values in «series».
- «highestColor», «lowestColor»: Symbol color to be used for the Max or Min values in «series».
- «firstColor», «lastColor»: Symbol color to be used for the first (leftmost) and last (rightmost) point.
See Also
- CellBar, CellIcon. You can create related effects in cells with these from the Cell Format Expression attribute. But not that the Spark plot functions are not used from the Cell Format Expression attribute, but rather are results by themselves.
- Icon sets in result table? Is it possible? thread on the Analytica User Forum.
Enable comment auto-refresher