Skip to content

Vega-Lite Regression: docs list option labels as the Domain, and the assembler passes the invalid value through — chart renders blank #50

Description

@nishide-dev

Summary

Following the generated Vega-Lite reference docs for the Regression template produces a spec that renders as a completely blank chart, with no error at assemble time or render time.

Two defects combine here:

  1. Docs list option labels, not accepted values. In docs/reference-vegalite.md, the Domain column for discrete properties is generated from o.label (see optionDomain() in scripts/gen-chart-reference.ts, case 'discrete'). For regressionMethod it prints Linear, Logarithmic, Exponential, Power, Quadratic, Polynomial, while the accepted values are actually linear, log, exp, pow, quad, poly.
  2. The assembler passes unrecognized discrete values through unvalidated. regressionDef.instantiate in packages/flint-js/src/vegalite/templates/scatter.ts copies chartProperties.regressionMethod verbatim into the Vega-Lite regression transform. Vega-Lite rejects "Logarithmic" as a regression method, and the chart renders blank.

The docs intro says "Non-applicable parameters are safe to pass; the assembler ignores them", which sets the expectation that property inputs are validated or safely handled — an invalid value silently producing an empty chart is surprising, especially for agent-driven callers.

Repro

import { assembleVegaLite } from "flint-chart"; // 0.2.0

const spec = assembleVegaLite({
  data: { values: [
    { flops: 1.2e20, loss: 2.81 }, { flops: 7.0e20, loss: 2.42 },
    { flops: 2.8e21, loss: 2.34 }, { flops: 5.4e21, loss: 2.11 },
  ]},
  semantic_types: { flops: "Quantity", loss: "Quantity" },
  chart_spec: {
    chartType: "Regression",
    encodings: { x: { field: "flops" }, y: { field: "loss" } },
    // value taken verbatim from the Domain column of docs/reference-vegalite.md
    chartProperties: { regressionMethod: "Logarithmic" },
  },
});

Emitted transform:

"transform": [{ "regression": "loss", "on": "flops", "method": "Logarithmic" }]

Rendering this spec with standard Vega-Lite tooling (vl2svg, Vega-Lite v6) yields a blank image. Changing method to "log" renders correctly, confirming the value mismatch is the only problem.

Expected

Either (ideally both):

  • gen-chart-reference.ts prints the accepted value for discrete domains (e.g. `linear`, `log`, …), keeping the label as secondary text if desired.
  • The assembler validates discrete property values against the template's options and throws a clear error (or maps known labels to values) instead of emitting an invalid backend spec.

Environment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions