# GC.Spread.Sheets.DataCharts.DataChart

## Content

# Class: DataChart

[Sheets](../modules/GC.Spread.Sheets).[DataCharts](../modules/GC.Spread.Sheets.DataCharts).DataChart

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.DataCharts.DataChart#constructor)

### Methods

- [allowMove](GC.Spread.Sheets.DataCharts.DataChart#allowmove)
- [allowResize](GC.Spread.Sheets.DataCharts.DataChart#allowresize)
- [alt](GC.Spread.Sheets.DataCharts.DataChart#alt)
- [canPrint](GC.Spread.Sheets.DataCharts.DataChart#canprint)
- [dynamicMove](GC.Spread.Sheets.DataCharts.DataChart#dynamicmove)
- [dynamicSize](GC.Spread.Sheets.DataCharts.DataChart#dynamicsize)
- [endColumn](GC.Spread.Sheets.DataCharts.DataChart#endcolumn)
- [endColumnOffset](GC.Spread.Sheets.DataCharts.DataChart#endcolumnoffset)
- [endRow](GC.Spread.Sheets.DataCharts.DataChart#endrow)
- [endRowOffset](GC.Spread.Sheets.DataCharts.DataChart#endrowoffset)
- [getChartConfig](GC.Spread.Sheets.DataCharts.DataChart#getchartconfig)
- [height](GC.Spread.Sheets.DataCharts.DataChart#height)
- [isLocked](GC.Spread.Sheets.DataCharts.DataChart#islocked)
- [isSelected](GC.Spread.Sheets.DataCharts.DataChart#isselected)
- [isVisible](GC.Spread.Sheets.DataCharts.DataChart#isvisible)
- [name](GC.Spread.Sheets.DataCharts.DataChart#name)
- [setChartConfig](GC.Spread.Sheets.DataCharts.DataChart#setchartconfig)
- [startColumn](GC.Spread.Sheets.DataCharts.DataChart#startcolumn)
- [startColumnOffset](GC.Spread.Sheets.DataCharts.DataChart#startcolumnoffset)
- [startRow](GC.Spread.Sheets.DataCharts.DataChart#startrow)
- [startRowOffset](GC.Spread.Sheets.DataCharts.DataChart#startrowoffset)
- [width](GC.Spread.Sheets.DataCharts.DataChart#width)
- [x](GC.Spread.Sheets.DataCharts.DataChart#x)
- [y](GC.Spread.Sheets.DataCharts.DataChart#y)

## Constructors

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

• **new DataChart**(`sheet`, `name`, `x`, `y`, `width`, `height`, `type`)

Represents a datachart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `sheet` | [`Worksheet`](GC.Spread.Sheets.Worksheet) | The host sheet of the datachart. |
| `name` | `string` | The name of the datachart. |
| `x` | `number` | The <i>x</i> location of the datachart. |
| `y` | `number` | The <i>y</i> location of the datachart. |
| `width` | `number` | The width of the datachart. |
| `height` | `number` | The height of the datachart. |
| `type` | [`DataChartType`](../enums/GC.Spread.Sheets.DataCharts.DataChartType) | The type of the datachart. |

## Methods

### <a id="allowmove" name="allowmove"></a> allowMove

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

Gets or sets whether to disable moving the data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `boolean` | The setting for whether to disable moving the data chart. |

#### Returns

`any`

If no value is set, returns the setting for whether to disable moving the data chart; otherwise, returns the data chart.

___

### <a id="allowresize" name="allowresize"></a> allowResize

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

Gets or sets whether to disable resizing the data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `boolean` | The setting for whether to disable resizing the data chart. |

#### Returns

`any`

If no value is set, returns the setting for whether to disable resizing the data chart; otherwise, returns the data chart.

___

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

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

Gets or sets the alternative text of the data chart for screen readers.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `string` | The alternative text of the data chart. |

#### Returns

`any`

The alternative text of the data chart.

___

### <a id="canprint" name="canprint"></a> canPrint

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

Gets or sets whether this data chart is printable.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `boolean` | The value that indicates whether this data chart is printable. |

#### Returns

`any`

If no value is set, returns whether this data chart is printable.

___

### <a id="dynamicmove" name="dynamicmove"></a> dynamicMove

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

Gets or sets whether the object moves when hiding or showing, resizing, or moving rows or columns.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `boolean` | The value indicates whether the object moves when hiding or showing, resizing, or moving rows or columns. |

#### Returns

`any`

If no value is set, returns whether this data chart dynamically moves; otherwise, returns the data chart.

___

### <a id="dynamicsize" name="dynamicsize"></a> dynamicSize

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

Gets or sets whether the position of the data chart is fixed. When fixedPosition is true, dynamicMove and dynamicSize are disabled.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `boolean` | The value indicates whether the position of the data chart is fixed. |

#### Returns

`any`

If no value is set, returns whether the position of the data chart is fixed; otherwise, returns the data chart.

___

### <a id="endcolumn" name="endcolumn"></a> endColumn

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

Gets or sets the end column index of the data chart position.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The end column index of the data chart position. |

#### Returns

`any`

If no value is set, returns the end column index of the data chart position; otherwise, returns the data chart.

___

### <a id="endcolumnoffset" name="endcolumnoffset"></a> endColumnOffset

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

Gets or sets the offset relative to the end column of the data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The offset relative to the end column of the data chart. |

#### Returns

`any`

If no value is set, returns the offset relative to the end column of the data chart; otherwise, returns the data chart.

___

### <a id="endrow" name="endrow"></a> endRow

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

Gets or sets the end row index of the data chart position.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The end row index of the data chart position. |

#### Returns

`any`

If no value is set, returns the end row index of the data chart position; otherwise, returns the data chart.

___

### <a id="endrowoffset" name="endrowoffset"></a> endRowOffset

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

Gets or sets the offset relative to the end row of the data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The offset relative to the end row of the data chart. |

#### Returns

`any`

If no value is set, returns the offset relative to the end row of the data chart; otherwise, returns the data chart.

___

### <a id="getchartconfig" name="getchartconfig"></a> getChartConfig

▸ **getChartConfig**(): [`IDataChartConfig`](../interfaces/GC.Spread.Sheets.DataCharts.IDataChartConfig)

get datachart config.

**`example`**
```javascript
var datachart = activeSheet.datacharts.add('datachart1', 250, 20, 480, 300, GC.Spread.Sheets.DataCharts.DataChartType.column);
console.log(datachart.getChartConfig());
```

#### Returns

[`IDataChartConfig`](../interfaces/GC.Spread.Sheets.DataCharts.IDataChartConfig)

The config of the datachart.

___

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

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

Gets or sets the height of a data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The height of a data chart. |

#### Returns

`any`

If no value is set, returns the height of a data chart; otherwise, returns the data chart.

___

### <a id="islocked" name="islocked"></a> isLocked

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

Gets or sets whether this data chart is locked.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `boolean` | The value that indicates whether this data chart is locked. |

#### Returns

`any`

If no value is set, returns whether this data chart is locked; otherwise, returns the data chart.

___

### <a id="isselected" name="isselected"></a> isSelected

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

Gets or sets whether this data chart is selected.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `boolean` | The value that indicates whether this data chart is selected. |

#### Returns

`any`

If no value is set, returns whether this data chart is selected; otherwise, returns the data chart.

___

### <a id="isvisible" name="isvisible"></a> isVisible

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

Gets or sets whether this data chart is visible.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `boolean` | The value that indicates whether this data chart is visible. |

#### Returns

`any`

If no value is set, returns whether this data chart is visible; otherwise, returns the data chart.

___

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

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

Gets the name of the data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `string` | The name of the data chart. |

#### Returns

`any`

If no value is set, returns the name of the data chart; otherwise, returns the data chart.

___

### <a id="setchartconfig" name="setchartconfig"></a> setChartConfig

▸ **setChartConfig**(`config`): `void`

set datachart config.

**`example`**
```javascript
var datachart = activeSheet.datacharts.add('datachart1', 250, 20, 480, 300, GC.Spread.Sheets.DataCharts.DataChartType.column);
var config = datachart.getChartConfig();
config.plots[0].type = GC.Spread.Sheets.DataCharts.DataChartType.line;
datachart.setChartConfig(config);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `config` | [`IDataChartConfig`](../interfaces/GC.Spread.Sheets.DataCharts.IDataChartConfig) | The config of the datachart. |

#### Returns

`void`

___

### <a id="startcolumn" name="startcolumn"></a> startColumn

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

Gets or sets the starting column index of the data chart position.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The starting column index of the data chart position. |

#### Returns

`any`

If no value is set, returns the starting column index of the data chart position; otherwise, returns the data chart.

___

### <a id="startcolumnoffset" name="startcolumnoffset"></a> startColumnOffset

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

Gets or sets the offset relative to the start column of the data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The offset relative to the start column of the data chart. |

#### Returns

`any`

If no value is set, returns the offset relative to the start column of the data chart; otherwise, returns the data chart.

___

### <a id="startrow" name="startrow"></a> startRow

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

Gets or sets the starting row index of the data chart position.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The starting row index of the data chart position. |

#### Returns

`any`

If no value is set, returns the starting row index of the data chart position; otherwise, returns the data chart.

___

### <a id="startrowoffset" name="startrowoffset"></a> startRowOffset

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

Gets or sets the offset relative to the start row of the data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The offset relative to the start row of the data chart. |

#### Returns

`any`

If no value is set, returns the offset relative to the start row of the data chart; otherwise, returns the data chart.

___

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

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

Gets or sets the width of a data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The width of a data chart. |

#### Returns

`any`

If no value is set, returns the width of a data chart; otherwise, returns the data chart.

___

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

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

Gets or sets the horizontal location of the data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The horizontal location of the data chart. |

#### Returns

`any`

If no value is set, returns the horizontal location of the data chart; otherwise, returns the data chart.

___

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

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

Gets or sets the vertical location of the data chart.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `value?` | `number` | The vertical location of the data chart. |

#### Returns

`any`

If no value is set, returns the vertical location of the data chart; otherwise, returns the data chart.
