TRUECALC
MCP

chart:insert

Inserts a chart.

Parameters

NameTypeRequiredDescription
sheetstringyesThe sheet range is relative to.
range{ from: string; to: string }yesThe rectangle to bind the chart to, as A1 corners.
chartTypestringyesThe chart form to draw, a closed wire vocabulary.
optionsobjectnoRenderer-specific knobs, opaque here on purpose, defaults to {}.

Returns

NameTypeRequiredDescription
chartIdstringyesThe new chart's id.
range{ from: string; to: string }yesCanonicalized top-left/bottom-right corners.
chartTypestringyes

Schema

Request payload, as JSON Schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Payload",
  "type": "object",
  "properties": {
    "sheet": {
      "description": "The sheet `range` is relative to.",
      "type": "string"
    },
    "range": {
      "description": "The rectangle to bind the chart to, as A1 corners.",
      "$ref": "#/$defs/CellRange"
    },
    "chartType": {
      "description": "The chart form to draw, a closed wire vocabulary.",
      "type": "string"
    },
    "options": {
      "description": "Renderer-specific knobs, opaque here on purpose, defaults to `{}`.",
      "type": "object",
      "additionalProperties": true,
      "default": {}
    }
  },
  "required": [
    "sheet",
    "range",
    "chartType"
  ],
  "$defs": {
    "CellRange": {
      "description": "An inclusive rectangle. `from`/`to` may be equal, a single cell.",
      "type": "object",
      "properties": {
        "from": {
          "description": "Top-left cell, e.g. `\"A1\"`.",
          "type": "string"
        },
        "to": {
          "description": "Bottom-right cell, e.g. `\"B3\"`.",
          "type": "string"
        }
      },
      "required": [
        "from",
        "to"
      ]
    }
  }
}

Response payload, as JSON Schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Output",
  "type": "object",
  "properties": {
    "chartId": {
      "description": "The new chart's id.",
      "type": "string"
    },
    "range": {
      "description": "Canonicalized top-left/bottom-right corners.",
      "$ref": "#/$defs/CellRange"
    },
    "chartType": {
      "type": "string"
    }
  },
  "required": [
    "chartId",
    "range",
    "chartType"
  ],
  "$defs": {
    "CellRange": {
      "description": "An inclusive rectangle. `from`/`to` may be equal, a single cell.",
      "type": "object",
      "properties": {
        "from": {
          "description": "Top-left cell, e.g. `\"A1\"`.",
          "type": "string"
        },
        "to": {
          "description": "Bottom-right cell, e.g. `\"B3\"`.",
          "type": "string"
        }
      },
      "required": [
        "from",
        "to"
      ]
    }
  }
}

On this page