Skip to content

sdk: add first-class support for vars #286

Description

@myme

Plot exposes data, colors, title, caption and friends, but nothing for vars/. Every var write goes through api_create plus four api_write calls:

p.api_create("/vars/min-days")
p.api_write("/vars/min-days/format", ",.0f")
p.api_write("/vars/min-days/type", "number")
p.api_write("/vars/min-days/about", "Days until the soonest expiry")
p.api_write("/vars/min-days/value", "70")

Order matters as well: format has to exist before value, because the formatted text is computed at the moment the value lands. Get it backwards and the var renders with whatever default it was created with. Nothing in the SDK hints at that.

Something like p.vars["min-days"] = 70, with optional format/type/about, would cover the common case. Since vars are the natural way to put KPIs next to a chart, they feel like they belong in the typed surface rather than in raw path writes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions