Page MenuHomePhabricator

Chart wizard: show chart preview as the chart values are configured
Open, HighPublic

Description

Background

In order to make creating the chart process more intuitive, we need to add the ability for users to preview before submitting the chart.

Technical notes

As noted in T425608, the JCChartContentView class is used for rendering chart pages, which feeds the JSON to the #chart parser function. All this means is getting a preview from JavaScript should be pretty simple.

Requirements
  • Add a preview area to the UI (already done in r1275553)
  • Add the JSON blob to the Vue data store
  • When changes are made to any field (say on change or blur, not input), we trigger another parse request, and let JCChartContentView handle the rest
  • Errors and what not can be shown directly in the preview as they are given by JCChartContentView.
    • If needed and deemed helpful, we could have the preview handler fire a JS hook (or whatever) to tell the Vue app which fields to highlight as erroneous (but this may be fragile and unnecessary)

Acceptance criteria

  • After making changes to any field in the form, the preview should be updated accordingly.
  • For now, errors surfaced by the chart rendering are only shown in the preview panel, and not necessarily also in the form.

Event Timeline

MusikAnimal subscribed.

I'll fill this out as we learn how to tackle it

MusikAnimal changed the task status from Open to In Progress.May 7 2026, 3:29 AM
MusikAnimal renamed this task from Visual mode: add chart preview to Chart wizard: add chart preview.Sat, May 9, 6:20 PM
HMonroy renamed this task from Chart wizard: add chart preview to Chart wizard: show chart preview as the chart values as configured.Tue, May 12, 1:31 AM

Going to come back to this (or Harumi can) once more fields are added. There's a chartDefinition computed ref in the store that ChartPreview can watch for changes to, then run the action=parse request and inject the resultant HTML into the preview container. I suppose we need an additional watcher for the source ref in the store, such that when that's changed, all other fields are cleared. This could go in a component but the store will always have access to all fields, so it might be better off placed there.

MusikAnimal changed the task status from In Progress to Open.Tue, May 12, 2:16 AM
HMonroy renamed this task from Chart wizard: show chart preview as the chart values as configured to Chart wizard: show chart preview as the chart values are configured.Tue, May 12, 2:17 AM

@HMonroy and I decided it's easier for us to develop by editing an existing chart, that way we have something to preview upfront. Given that, I think this can be worked on now.