# GC.Spread.Sheets.DataCharts.DataChartManager

## Content

# Class: DataChartManager

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

## Table of contents

### Constructors

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

### Methods

- [add](GC.Spread.Sheets.DataCharts.DataChartManager#add)
- [all](GC.Spread.Sheets.DataCharts.DataChartManager#all)
- [clear](GC.Spread.Sheets.DataCharts.DataChartManager#clear)
- [get](GC.Spread.Sheets.DataCharts.DataChartManager#get)
- [remove](GC.Spread.Sheets.DataCharts.DataChartManager#remove)
- [zIndex](GC.Spread.Sheets.DataCharts.DataChartManager#zindex)

## Constructors

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

• **new DataChartManager**()

Represents a datachart manager that managers all datacharts in a sheet.

## Methods

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

▸ **add**(`name`, `x`, `y`, `width`, `height`, `type`): [`DataChart`](GC.Spread.Sheets.DataCharts.DataChart)

Adds a datachart to the sheet.

**`example`**
```javascript
//This example shows how to add a datachart.
var datachart = activeSheet.datacharts.add('datachart1', 250, 20, 480, 300, GC.Spread.Sheets.DataCharts.DataChartType.column);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The name of the datachart that will be added to the sheet. |
| `x` | `number` | The x location of the datachart. |
| `y` | `number` | The y 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. |

#### Returns

[`DataChart`](GC.Spread.Sheets.DataCharts.DataChart)

The datachart that has been added to the sheet.

___

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

▸ **all**(): [`DataChart`](GC.Spread.Sheets.DataCharts.DataChart)[]

get all data charts.

**`example`**
```javascript
activeSheet.datacharts.add('DataChart1', 0, 20, 480, 300, GC.Spread.Sheets.DataCharts.DataChartType.column);
activeSheet.datacharts.add('DataChart2', 500, 20, 480, 300, GC.Spread.Sheets.DataCharts.DataChartType.pie);
var dataCharts = activeSheet.datacharts.all();
for (var i = 0; i &lt; dataCharts.length; i++) {
    alert("Name of dataChart " + i + " is:  " + dataCharts[i].name())
}
```

#### Returns

[`DataChart`](GC.Spread.Sheets.DataCharts.DataChart)[]

get all data charts.

___

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

▸ **clear**(): `void`

remove all data charts.

#### Returns

`void`

___

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

▸ **get**(`name`): [`DataChart`](GC.Spread.Sheets.DataCharts.DataChart)

get a data charts by name.

**`example`**
```javascript
activeSheet.datacharts.add('DataChart1', 0, 20, 480, 300, GC.Spread.Sheets.DataCharts.DataChartType.column);
//button
$("#button1").click(function () {
 var dataChart = activeSheet.datacharts.get("DataChart1");
});
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | data chart name. |

#### Returns

[`DataChart`](GC.Spread.Sheets.DataCharts.DataChart)

get a data charts by name.

___

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

▸ **remove**(`name`): `void`

remove a data charts by name.

**`example`**
```javascript
activeSheet.datacharts.add('DataChart1', 0, 20, 480, 300, GC.Spread.Sheets.DataCharts.DataChartType.column);
//button
$("#button1").click(function () {
     activeSheet.resumePaint();
     activeSheet.datacharts.remove("DataChart1");
     activeSheet.repaint();
});
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | data chart name. |

#### Returns

`void`

___

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

▸ **zIndex**(`name`, `zIndex?`): `any`

Gets or sets the z-index of chart.

**`example`**
```javascript
activeSheet.datacharts.add('DataChart1', 200, 20, 480, 300, GC.Spread.Sheets.DataCharts.DataChartType.column);
activeSheet.datacharts.add('DataChart2', 0, 20, 480, 300, GC.Spread.Sheets.DataCharts.DataChartType.pie);
activeSheet.datacharts.zIndex('DataChart1', 897);
activeSheet.datacharts.zIndex('DataChart2', 890);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | The name of the chart. |
| `zIndex?` | `number` | The z-index of the chart. |

#### Returns

`any`

If the parameter 'zIndex' is null or undefined,it will return the z-index of the chart with the indicate name.
