Skip to main content
On this page

Kater CLI Present and share chart

kater chart edit

Changes a saved chart by what you did to it, not by the whole chart.

Give the commands in the order to apply them and the revision you read. The server works out the chart’s file, so the same commands leave the same file whoever sends them. The commands are one change in the chart’s history: the answer names it in change, and kater undo takes it back. The command refuses the change when the chart changed after you read it, and nothing is written.

Examples

Terminal window
# Keep the spend_mix chart in a file
kater chart read connections/snowflake_prod_connection/workspaces/ad_reporting/spend_mix --json > spend_mix_read.json
# Make it a bar chart, titled by what it shows
jq '{expected_revision: .definition.revision, commands: [{type: "set-kind", kind: "bar"}, {type: "set-title", label: "Spend by platform"}]}' spend_mix_read.json > spend_mix_edit.json
# Apply both commands as one change
kater chart edit connections/snowflake_prod_connection/workspaces/ad_reporting/spend_mix --request-file spend_mix_edit.json

Arguments

ArgumentDescription
<object>The chart: its key, such as duckdb_sample/shop/top_regions_chart, or in a person’s folder, duckdb_sample/users/<user id>/shop/top_regions_chart; as <workspace>/<name>, such as shop/top_regions_chart; its workspace’s folder and its name, such as connections/<connection>/workspaces/shop/top_regions_chart; or its id, rel1_…. Required unless --request-file is given.

Options

OptionDescription
--request-file <file>The commands and the revision you read, as JSON. Give - to read it from standard input. See The request.

It also takes the global options anywhere on the line, and --help.

The request

FieldWhat it holds
commandsWhat was done, each one an object whose type says which, applied in order. The chart is checked after the last one, so a change of kind may be followed by the commands that fill the new kind’s roles.
expected_revisionThe chart’s revision from kater chart read.

The commands

typeWhat it does
set-title, set-descriptionSets the chart’s label or description. null takes it away.
set-presentationSets the chart’s look: presentation, an object of the settings to change. {"legend": false} hides the legend. A setting with a null value is taken away.
reset-presentationTakes away the settings named in keys, or all of them when keys is left out.
set-kindMakes the chart another kind. Each role that the new kind shares keeps its fields, each value keeps the settings the new kind reads, and the chart keeps the settings the new kind lists as controls, such as a series’ colours.
set-bindingsPuts the bindings in a role, such as category, values or tooltip. A field has one place on the chart: put in this role, it leaves the role it held.
set-seriesSets the own options of the value at index: label, mark, point, axis and stack.
set-templateSets the words of a Text chart.
repointMakes the chart read another query, the source.
hide-column, show-columnHides a table’s column, or shows it again as the last one. The chart still reads every row of its query.
remove-gone-fieldsRepairs a chart that reads a field its query no longer has: the chart stops reading the field, and loses its filter and its sort on it. kater chart read answers the chart’s cause, with repair where this command can save the chart. Every other command on such a chart is refused.

The answer holds the chart’s definition, its problems, the change and before_text, the chart’s file as it was before.

See also