---
title: "chart.insert: Insert Chart — Sheet kit command — Kition"
description: "Inserts a chart of a range (default: the current region; several areas side by side, such as A1:A5,C1:D5, chart together) with a type, title and position, and answers the new chart's id for chart.* commands. The first row names the series and the first column holds the categories when it is text, when the corner cell is blank, or when it holds dates; a scatter chart takes the first column as X. A combo chart is clustered columns and lines (the first series columns, the others lines) unless seriesTypes says otherwise; a waterfall marks as totals only the points listed in totals."
canonical: "https://developer.kition.ai/docs/kits/sheet/commands/chart.insert"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/sheet/commands/chart.insert](https://developer.kition.ai/docs/kits/sheet/commands/chart.insert)

# chart.insert

**Insert Chart.** Inserts a chart of a range (default: the current region; several areas side by side, such as A1:A5,C1:D5, chart together) with a type, title and position, and answers the new chart's id for chart.* commands. The first row names the series and the first column holds the categories when it is text, when the corner cell is blank, or when it holds dates; a scatter chart takes the first column as X. A combo chart is clustered columns and lines (the first series columns, the others lines) unless seriesTypes says otherwise; a waterfall marks as totals only the points listed in totals.

- Kit: Sheet 0.1.0 (.xlsx (and opens .xlsm, .xls, .xltx, .csv, .ods, .xlsb)); reference: [Sheet kit commands](https://developer.kition.ai/docs/kits/sheet.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `at` | `string` | no | like H2 |
| `height` | `number` | no |  |
| `range` | `string` | no | cells in A1 notation such as B2 or B2:D10, optionally with a sheet (Sheet2!A1); default: the selection |
| `secondary` | `integer[]` | no | type: combo: the series (by index from 0) drawn against a second value axis |
| `seriesTypes` | `string[]` | no | type: combo: each series' type in order (column, stackedColumn, bar, line, lineMarkers, area, scatter); series not listed: the first column, the others line |
| `subtype` | `"clustered" \| "stacked" \| "stacked100" \| "markers"` | no |  |
| `title` | `string` | no |  |
| `totals` | `integer[]` | no | type: waterfall: the points (by index from 0) set as totals, drawn from the axis with their own value, such as [0, 8] for an opening and a closing balance |
| `type` | `"column" \| "bar" \| "line" \| "pie" \| "doughnut" \| "area" \| "scatter" \| "bubble" \| "radar" \| "combo" \| "histogram" \| "waterfall" \| "funnel" \| "treemap" \| "sunburst" \| "boxWhisker" \| "stock"` | no |  |
| `width` | `number` | no |  |

## Call through sheet_run

```text
sheet_run {
  "path": "<file>.xlsx",
  "steps": [{ "command": "chart.insert" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `at`, `height`, `range`, `secondary`, `seriesTypes`, `subtype`, `title`, `totals`, `type`, `width`. sheet_run answers the step’s result in `completed[i].result`.

## Result

The kit gives no result schema for this command.

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "at": {
      "description": "like H2",
      "type": "string"
    },
    "height": {
      "type": "number"
    },
    "range": {
      "description": "cells in A1 notation such as B2 or B2:D10, optionally with a sheet (Sheet2!A1); default: the selection",
      "type": "string"
    },
    "secondary": {
      "description": "type: combo: the series (by index from 0) drawn against a second value axis",
      "items": {
        "type": "integer"
      },
      "type": "array"
    },
    "seriesTypes": {
      "description": "type: combo: each series' type in order (column, stackedColumn, bar, line, lineMarkers, area, scatter); series not listed: the first column, the others line",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "subtype": {
      "enum": [
        "clustered",
        "stacked",
        "stacked100",
        "markers"
      ],
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "totals": {
      "description": "type: waterfall: the points (by index from 0) set as totals, drawn from the axis with their own value, such as [0, 8] for an opening and a closing balance",
      "items": {
        "type": "integer"
      },
      "type": "array"
    },
    "type": {
      "enum": [
        "column",
        "bar",
        "line",
        "pie",
        "doughnut",
        "area",
        "scatter",
        "bubble",
        "radar",
        "combo",
        "histogram",
        "waterfall",
        "funnel",
        "treemap",
        "sunburst",
        "boxWhisker",
        "stock"
      ],
      "type": "string"
    },
    "width": {
      "type": "number"
    }
  },
  "type": "object"
}
```

Generated from the command list of @kition/sheet-darwin-arm64@0.1.0 and the kit itself (sheet_commands through @kition/cli@0.1.1, built from KitionAI/kition-sheet@82f13b2).
