# GC.Spread.Sheets.Sparklines.Sparkline

## Content

# Class: Sparkline

[Sheets](../modules/GC.Spread.Sheets).[Sparklines](../modules/GC.Spread.Sheets.Sparklines).Sparkline

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.Sparklines.Sparkline#constructor)

### Properties

- [column](GC.Spread.Sheets.Sparklines.Sparkline#column)
- [row](GC.Spread.Sheets.Sparklines.Sparkline#row)

### Methods

- [clone](GC.Spread.Sheets.Sparklines.Sparkline#clone)
- [data](GC.Spread.Sheets.Sparklines.Sparkline#data)
- [dataOrientation](GC.Spread.Sheets.Sparklines.Sparkline#dataorientation)
- [dateAxisData](GC.Spread.Sheets.Sparklines.Sparkline#dateaxisdata)
- [dateAxisOrientation](GC.Spread.Sheets.Sparklines.Sparkline#dateaxisorientation)
- [displayDateAxis](GC.Spread.Sheets.Sparklines.Sparkline#displaydateaxis)
- [group](GC.Spread.Sheets.Sparklines.Sparkline#group)
- [paintSparkline](GC.Spread.Sheets.Sparklines.Sparkline#paintsparkline)
- [setting](GC.Spread.Sheets.Sparklines.Sparkline#setting)
- [sparklineType](GC.Spread.Sheets.Sparklines.Sparkline#sparklinetype)

## Constructors

### <a id="constructor" name="constructor"></a> 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`](GC.Spread.Sheets.Range) | The data range to which the sparkline refers. |
| `dataOrientation?` | [`DataOrientation`](../enums/GC.Spread.Sheets.Sparklines.DataOrientation) | The orientation of the data range. |
| `type?` | [`SparklineType`](../enums/GC.Spread.Sheets.Sparklines.SparklineType) | The type of sparkline. |
| `setting?` | [`SparklineSetting`](GC.Spread.Sheets.Sparklines.SparklineSetting) | The setting of the sparkline. |

## Properties

### <a id="column" name="column"></a> column

• **column**: `number`

Gets the column index.

___

### <a id="row" name="row"></a> row

• **row**: `number`

Gets the row index.

## Methods

### <a id="clone" name="clone"></a> clone

▸ **clone**(): [`Sparkline`](GC.Spread.Sheets.Sparklines.Sparkline)

Clones a sparkline.

#### Returns

[`Sparkline`](GC.Spread.Sheets.Sparklines.Sparkline)

The cloned sparkline.

___

### <a id="data" name="data"></a> 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`](GC.Spread.Sheets.Range) | The sparkline data. |

#### Returns

`any`

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

___

### <a id="dataorientation" name="dataorientation"></a> 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`](../enums/GC.Spread.Sheets.Sparklines.DataOrientation) | The sparkline data orientation. |

#### Returns

`any`

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

___

### <a id="dateaxisdata" name="dateaxisdata"></a> 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`](GC.Spread.Sheets.Range) | The sparkline date axis data. |

#### Returns

`any`

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

___

### <a id="dateaxisorientation" name="dateaxisorientation"></a> 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`](../enums/GC.Spread.Sheets.Sparklines.DataOrientation) | The sparkline date axis orientation. |

#### Returns

`any`

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

___

### <a id="displaydateaxis" name="displaydateaxis"></a> 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.

___

### <a id="group" name="group"></a> group

▸ **group**(`value?`): `any`

Gets or sets the sparkline group.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | [`SparklineGroup`](GC.Spread.Sheets.Sparklines.SparklineGroup) | The sparkline group. |

#### Returns

`any`

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

___

### <a id="paintsparkline" name="paintsparkline"></a> 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` | <i>x</i>-coordinate relative to the canvas. |
| `y` | `number` | <i>y</i>-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`

___

### <a id="setting" name="setting"></a> setting

▸ **setting**(`value?`): `any`

Gets or sets the sparkline setting of the cell.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | [`SparklineSetting`](GC.Spread.Sheets.Sparklines.SparklineSetting) | The sparkline setting. |

#### Returns

`any`

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

___

### <a id="sparklinetype" name="sparklinetype"></a> sparklineType

▸ **sparklineType**(`value?`): `any`

Gets or sets the type of the sparkline.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | [`SparklineType`](../enums/GC.Spread.Sheets.Sparklines.SparklineType) | The sparkline type. |

#### Returns

`any`

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