[]
Sheets.Sparklines.Sparkline
• new Sparkline(row?
, column?
, dataReference?
, dataOrientation?
, type?
, setting?
)
Represents a Sparkline class.
Name | Type | Description |
---|---|---|
row? |
number |
The row index. |
column? |
number |
The column index. |
dataReference? |
Range |
The data range to which the sparkline refers. |
dataOrientation? |
DataOrientation |
The orientation of the data range. |
type? |
SparklineType |
The type of sparkline. |
setting? |
SparklineSetting |
The setting of the sparkline. |
• column: number
Gets the column index.
• row: number
Gets the row index.
▸ clone(): Sparkline
Clones a sparkline.
The cloned sparkline.
▸ data(value?
): any
Gets or sets the data object.
example
//This example uses the data method.
activeSheet.suspendPaint();
activeSheet.setValue(1, 0, 10);
activeSheet.setValue(2, 0, 0);
activeSheet.setValue(3, 0, -3);
activeSheet.setValue(4, 0, -5);
activeSheet.setValue(0, 0, 1);
activeSheet.setValue(0, 1, 2);
activeSheet.setValue(0, 2, 4);
activeSheet.setValue(0, 3, 8);
activeSheet.setValue(0, 4, 6);
activeSheet.setValue(0, 5, new Date(2014, 1, 1));
activeSheet.setValue(1, 5, new Date(2014, 9, 1));
activeSheet.setValue(2, 5, new Date(2014, 7, 1));
activeSheet.setValue(3, 5, new Date(2014, 5, 1));
activeSheet.setValue(4, 5, new Date(2014, 3, 1));
var sparkline = activeSheet.setSparkline(5, 0, new GC.Spread.Sheets.Range(0, 0, 5, 5), GC.Spread.Sheets.Sparklines.DataOrientation.horizontal, GC.Spread.Sheets.Sparklines.SparklineType.line, new GC.Spread.Sheets.Sparklines.SparklineSetting(), new GC.Spread.Sheets.Range(0, 5, 5, 1), GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.data(new GC.Spread.Sheets.Range(0, 0, 5, 5));
sparkline.sparklineType(GC.Spread.Sheets.Sparklines.SparklineType.line);
sparkline.setting(new GC.Spread.Sheets.Sparklines.SparklineSetting());
sparkline.dateAxisData(new GC.Spread.Sheets.Range(0, 5, 5, 1));
sparkline.dataOrientation(GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.dateAxisOrientation(GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.row = 5;
sparkline.column = 0;
sparkline.displayDateAxis(true);
activeSheet.resumePaint();
Name | Type | Description |
---|---|---|
value? |
Range |
The sparkline data. |
any
If no value is set, returns the data object; otherwise, returns the sparkline.
▸ dataOrientation(value?
): any
Gets or sets the data orientation.
example
//This example uses the vertical data and the date range to create the sparkline.
var setting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
setting.options.showMarkers = true;
setting.options.displayXAxis = true;
activeSheet.suspendPaint();
activeSheet.setValue(1, 0, 10);
activeSheet.setValue(2, 0, 0);
activeSheet.setValue(3, 0, -3);
activeSheet.setValue(4, 0, -5);
activeSheet.setValue(0, 0, 1);
activeSheet.setValue(0, 1, 2);
activeSheet.setValue(0, 2, 4);
activeSheet.setValue(0, 3, 8);
activeSheet.setValue(0, 4, 6);
activeSheet.setValue(0, 5, new Date(2014, 1, 1));
activeSheet.setValue(1, 5, new Date(2014, 9, 1));
activeSheet.setValue(2, 5, new Date(2014, 7, 1));
activeSheet.setValue(3, 5, new Date(2014, 5, 1));
activeSheet.setValue(4, 5, new Date(2014, 3, 1));
var sparkline = activeSheet.setSparkline(5, 0, new GC.Spread.Sheets.Range(0, 0, 5, 5), GC.Spread.Sheets.Sparklines.DataOrientation.horizontal, GC.Spread.Sheets.Sparklines.SparklineType.line, setting, new GC.Spread.Sheets.Range(0, 5, 5, 1), GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.dataOrientation(GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.displayDateAxis(true);
activeSheet.resumePaint();
activeSheet.addSpan(5, 0, 4, 3, null);
Name | Type | Description |
---|---|---|
value? |
DataOrientation |
The sparkline data orientation. |
any
If no value is set, returns the sparkline data orientation; otherwise, returns the sparkline.
▸ dateAxisData(value?
): any
Gets or sets the date axis data object.
example
//This example uses the dateAxisData method.
activeSheet.suspendPaint();
activeSheet.setValue(1, 0, 10);
activeSheet.setValue(2, 0, 0);
activeSheet.setValue(3, 0, -3);
activeSheet.setValue(4, 0, -5);
activeSheet.setValue(0, 0, 1);
activeSheet.setValue(0, 1, 2);
activeSheet.setValue(0, 2, 4);
activeSheet.setValue(0, 3, 8);
activeSheet.setValue(0, 4, 6);
activeSheet.setValue(0, 5, new Date(2014, 1, 1));
activeSheet.setValue(1, 5, new Date(2014, 9, 1));
activeSheet.setValue(2, 5, new Date(2014, 7, 1));
activeSheet.setValue(3, 5, new Date(2014, 5, 1));
activeSheet.setValue(4, 5, new Date(2014, 3, 1));
var sparkline = activeSheet.setSparkline(5, 0, new GC.Spread.Sheets.Range(0, 0, 5, 5), GC.Spread.Sheets.Sparklines.DataOrientation.horizontal, GC.Spread.Sheets.Sparklines.SparklineType.line, new GC.Spread.Sheets.Sparklines.SparklineSetting(), new GC.Spread.Sheets.Range(0, 5, 5, 1), GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.data(new GC.Spread.Sheets.Range(0, 0, 5, 5));
sparkline.sparklineType(GC.Spread.Sheets.Sparklines.SparklineType.line);
sparkline.setting(new GC.Spread.Sheets.Sparklines.SparklineSetting());
sparkline.dateAxisData(new GC.Spread.Sheets.Range(0, 5, 5, 1));
sparkline.dataOrientation(GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.dateAxisOrientation(GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.row = 5;
sparkline.column = 0;
sparkline.displayDateAxis(true);
activeSheet.resumePaint();
Name | Type | Description |
---|---|---|
value? |
Range |
The sparkline date axis data. |
any
If no value is set, returns the sparkline date axis data; otherwise, returns the sparkline.
▸ dateAxisOrientation(value?
): any
Gets or sets the date axis orientation.
example
//This example uses vertical data with horizontal dates to create a sparkline.
var setting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
setting.options.showMarkers = true;
setting.options.displayXAxis = true;
activeSheet.suspendPaint();
activeSheet.setValue(1, 0, 10);
activeSheet.setValue(2, 0, 0);
activeSheet.setValue(3, 0, -3);
activeSheet.setValue(4, 0, -5);
activeSheet.setValue(0, 0, 1);
activeSheet.setValue(0, 1, 2);
activeSheet.setValue(0, 2, 4);
activeSheet.setValue(0, 3, 8);
activeSheet.setValue(0, 4, 6);
activeSheet.setValue(0, 5, new Date(2014, 1, 1));
activeSheet.setValue(1, 5, new Date(2014, 9, 1));
activeSheet.setValue(2, 5, new Date(2014, 7, 1));
activeSheet.setValue(3, 5, new Date(2014, 5, 1));
activeSheet.setValue(4, 5, new Date(2014, 3, 1));
activeSheet.setValue(11, 0, new Date(2014, 1, 1));
activeSheet.setValue(11, 1, new Date(2014, 9, 1));
activeSheet.setValue(11, 2, new Date(2014, 7, 1));
activeSheet.setValue(11, 3, new Date(2014, 5, 1));
activeSheet.setValue(11, 4, new Date(2014, 3, 1));
var sparkline = activeSheet.setSparkline(5, 0, new GC.Spread.Sheets.Range(0, 0, 5, 5), GC.Spread.Sheets.Sparklines.DataOrientation.vertical, GC.Spread.Sheets.Sparklines.SparklineType.line, setting, new GC.Spread.Sheets.Range(11, 0, 1, 5), GC.Spread.Sheets.Sparklines.DataOrientation.horizontal);
sparkline.dataOrientation(GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.dateAxisOrientation(GC.Spread.Sheets.Sparklines.DataOrientation.horizontal);
sparkline.displayDateAxis(true);
activeSheet.resumePaint();
activeSheet.addSpan(5, 0, 4, 3, null);
Name | Type | Description |
---|---|---|
value? |
DataOrientation |
The sparkline date axis orientation. |
any
If no value is set, returns the sparkline date axis orientation; otherwise, returns the sparkline.
▸ displayDateAxis(value?
): any
Gets or sets a value that indicates whether to display the date axis.
example
//This example uses the vertical data and the date range to create the sparkline.
var setting = new GC.Spread.Sheets.Sparklines.SparklineSetting();
setting.options.showMarkers = true;
setting.options.displayXAxis = true;
activeSheet.suspendPaint();
activeSheet.setValue(1, 0, 10);
activeSheet.setValue(2, 0, 0);
activeSheet.setValue(3, 0, -3);
activeSheet.setValue(4, 0, -5);
activeSheet.setValue(0, 0, 1);
activeSheet.setValue(0, 1, 2);
activeSheet.setValue(0, 2, 4);
activeSheet.setValue(0, 3, 8);
activeSheet.setValue(0, 4, 6);
activeSheet.setValue(0, 5, new Date(2014, 1, 1));
activeSheet.setValue(1, 5, new Date(2014, 9, 1));
activeSheet.setValue(2, 5, new Date(2014, 7, 1));
activeSheet.setValue(3, 5, new Date(2014, 5, 1));
activeSheet.setValue(4, 5, new Date(2014, 3, 1));
var sparkline = activeSheet.setSparkline(5, 0, new GC.Spread.Sheets.Range(0, 0, 5, 5), GC.Spread.Sheets.Sparklines.DataOrientation.horizontal, GC.Spread.Sheets.Sparklines.SparklineType.line, setting, new GC.Spread.Sheets.Range(0, 5, 5, 1), GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.dataOrientation(GC.Spread.Sheets.Sparklines.DataOrientation.vertical);
sparkline.displayDateAxis(true);
activeSheet.resumePaint();
activeSheet.addSpan(5, 0, 4, 3, null);
Name | Type | Description |
---|---|---|
value? |
boolean |
Whether to display the date axis. |
any
If no value is set, returns whether to display the date axis; otherwise, returns the sparkline.
▸ group(value?
): any
Gets or sets the sparkline group.
Name | Type | Description |
---|---|---|
value? |
SparklineGroup |
The sparkline group. |
any
If no value is set, returns the sparkline group; otherwise, returns the sparkline.
▸ paintSparkline(ctx
, x
, y
, w
, h
): void
Paints the sparkline in the specified area.
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D |
The canvas's two-dimensional context. |
x |
number |
x-coordinate relative to the canvas. |
y |
number |
y-coordinate relative to the canvas. |
w |
number |
The width of the cell that contains the sparkline. |
h |
number |
The height of the cell that contains the sparkline. |
void
▸ setting(value?
): any
Gets or sets the sparkline setting of the cell.
Name | Type | Description |
---|---|---|
value? |
SparklineSetting |
The sparkline setting. |
any
If no value is set, returns the sparkline setting; otherwise, returns the sparkline.
▸ sparklineType(value?
): any
Gets or sets the type of the sparkline.
Name | Type | Description |
---|---|---|
value? |
SparklineType |
The sparkline type. |
any
If no value is set, returns the sparkline type; otherwise, returns the sparkline.