Skip to content

Colour settings on three charts are unconstrained strings, so a mistyped colour aborts the run inside plotly #7252

Description

@kz930

What happened?

Three chart settings take a colour but are declared as plain strings, so the schema is {"type":"string"} with no pattern and the form renders a free-text box. What is legal is stated only in @JsonPropertyDescription("must be a valid CSS color or hex color string").

Operator Setting Reaches plotly as
LineChartOpDesc (LineConfig) Line Color line={'color': …} on go.Scatter
ContinuousErrorBandsOpDesc (BandConfig) Fill Color, plus the inherited Line Color fillcolor=…
FigureFactoryTableOpDesc Font Color font_colors=[…] on ff.create_table

Generating each module from main and executing it: red renders; #ggg and 1 fail with ValueError: Invalid value of type 'builtins.str' received for the 'color' property of scatter.line; nosuchcolor fails the same way on the table's font. Nothing checks the value before the run, and the error names a plotly property rather than the field the user filled in.

Expected: the field states what it accepts in a way the form can enforce. An enum will not do — plotly takes 3- and 6-digit hex, rgb/rgba/hsl/hsla/hsv/hsva, var(--…) and 148 CSS names — but a pattern derived from ColorValidator in _plotly_utils/basevalidators.py covers all of those and rejects the values above. Empty should stay legal: every one of these paths omits the colour argument when the field is blank.

How to reproduce?

  1. Chain a source with two numeric columns into Line Chart and configure one line.
  2. Type #ggg into that line's Line Color.
  3. Run — the operator fails with the error below; red succeeds.

Version/Branch

1.3.0-incubating-SNAPSHOT (main)

Relevant log output

ValueError: Invalid value of type 'builtins.str' received for the 'color' property of scatter.line
    Received value: '#ggg'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions