[]
        
(Showing Draft Content)

GC.Spread.Sheets.Sparklines.Sparkline

Class: Sparkline

Sheets.Sparklines.Sparkline

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Sparkline(row?, column?, dataReference?, dataOrientation?, type?, setting?)

Represents a Sparkline class.

Parameters

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.

Properties

column

column: number

Gets the column index.


row

row: number

Gets the row index.

Methods

clone

clone(): Sparkline

Clones a sparkline.

Returns

Sparkline

The cloned sparkline.


data

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();

Parameters

Name Type Description
value? Range The sparkline data.

Returns

any

If no value is set, returns the data object; otherwise, returns the sparkline.


dataOrientation

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);

Parameters

Name Type Description
value? DataOrientation The sparkline data orientation.

Returns

any

If no value is set, returns the sparkline data orientation; otherwise, returns the sparkline.


dateAxisData

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();

Parameters

Name Type Description
value? Range The sparkline date axis data.

Returns

any

If no value is set, returns the sparkline date axis data; otherwise, returns the sparkline.


dateAxisOrientation

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);

Parameters

Name Type Description
value? DataOrientation The sparkline date axis orientation.

Returns

any

If no value is set, returns the sparkline date axis orientation; otherwise, returns the sparkline.


displayDateAxis

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);

Parameters

Name Type Description
value? boolean Whether to display the date axis.

Returns

any

If no value is set, returns whether to display the date axis; otherwise, returns the sparkline.


group

group(value?): any

Gets or sets the sparkline group.

Parameters

Name Type Description
value? SparklineGroup The sparkline group.

Returns

any

If no value is set, returns the sparkline group; otherwise, returns the sparkline.


paintSparkline

paintSparkline(ctx, x, y, w, h): void

Paints the sparkline in the specified area.

Parameters

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.

Returns

void


setting

setting(value?): any

Gets or sets the sparkline setting of the cell.

Parameters

Name Type Description
value? SparklineSetting The sparkline setting.

Returns

any

If no value is set, returns the sparkline setting; otherwise, returns the sparkline.


sparklineType

sparklineType(value?): any

Gets or sets the type of the sparkline.

Parameters

Name Type Description
value? SparklineType The sparkline type.

Returns

any

If no value is set, returns the sparkline type; otherwise, returns the sparkline.