Sheet kit command

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))
Changes the document
yes

Parameters

Parameters of chart.insert
NameTypeRequiredDescription
atstringnolike H2
heightnumberno
rangestringnocells in A1 notation such as B2 or B2:D10, optionally with a sheet (Sheet2!A1); default: the selection
secondaryinteger[]notype: combo: the series (by index from 0) drawn against a second value axis
seriesTypesstring[]notype: 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
titlestringno
totalsinteger[]notype: 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
widthnumberno

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/[email protected] and the kit itself (sheet_commands through @kition/[email protected], built from KitionAI/kition-sheet@82f13b2). As data: commands.jsonl.