Description
Summary / Background
Discussions regarding migrating the underlying plots' engine from Vega
to Plotly
were recently re-started (see iterative/dvc-render#7) due to several plots-related issues appearing in vscode-dvc
(e.g. iterative/vscode-dvc#4530, iterative/vscode-dvc#4532, iterative/vscode-dvc#3837 and there are more). Initial scoping of that issue (re-)highlighted the current difference between the three product's UI/data processing. These three images show the "same" plot across the 3 products:
An initial step in scoping the migration effort was to implement zoom/pan functionality to Vega plots within the VS Code extension (iterative/vscode-dvc#4629). The immediate feedback provided was "But this needs to be available in Studio too!". Again (and unfortunately), that is no simple task because all three products take such different approaches. A simple template update can not simply be plugged in.
Another example of unified changes being difficult was plots per step being added in both Studio (https://github.com/iterative/studio/pull/7342) + VS Code (iterative/vscode-dvc#4372). It should also be noted that the slider is currently unavailable via the CLI output.
In order to make unified changes across the product easier we need to standardise.
Scope
As a first step to fixing the above problems, we are going to standardise the appearance of plots provided by built-in dvc-render
templates across the three product's UIs.
Forcing the UIs to converge will give insights into the code. Those insights will enable us to refactor and move towards a standardised approach for dealing with plots/their data. As we remove legacy code/processes we will be able to iterate quicker on plot changes and not get bogged down every time we want to do something as simple as change a template.
At a minimum, we should display the same legend for each plot and we should also have the same underlying data in each plot.
Assumptions
- The overall approach is up for debate.
- There is business appetite to be able to iterate quicker in the future.
- There is business appetite to have three standardised product UIs.
- Do not need to attempt to improve the HTML produced by the CLI.
- Usage of custom templates is low enough not to worry about being backwards compatible with user-defined custom templates.
Open Questions
- Can we split out parts of
dvc-render
into JSON + Typescript + move into DVC? 👈🏻 This should become clearer as we get further into the process. - Can top-level bar plots have multiple data sources? How should they be treated?
Blockers / Dependencies
None yet.
General Approach
(after discussing with @dberenbaum)
- Match CLI/Studio appearance to VS Code plot.
- Add extra template anchors to the baseline templates and docs. These will include color, stroke dash and shape mappings along with a field to group data (equivalent of the current rev field used by DVC to render plots). I.e.
<DVC_METRIC_COLOR>
/<DVC_METRIC_STROKE_DASH>
/<DVC_METRIC_SHAPE>
/<DVC_METRIC_GROUP_BY>
- Fill the anchors in each of the products based on.
- Repeat colors for the CLI when > 7 have been selected.
- Delay combining code for now.
- Add
<DVC_METRIC_ROW>
for bar charts and only use<DVC_METRIC_SHAPE>
for scatter plots.
Steps
- Propose new template format (
plots
: standardise across DVC/Studio/VS Code dvc-render#142) -
dvc-render
changes to render new templates via CLI (plots
: standardise across DVC/Studio/VS Code dvc-render#142) - DVC changes to render new templates (
plots
: standardise across DVC/Studio/VS Code #9931) - DVC changes to provide updated data to VS Code (
plots
: standardise across DVC/Studio/VS Code #9931) - VS Code changes to accept new template and data (Bump min DVC version to 3.33.0 (standardise plots across products) vscode-dvc#4734)
- Studio changes to update data processing and UI (https://github.com/iterative/studio/pull/8242 + https://github.com/iterative/studio/pull/8301 + https://github.com/iterative/studio/pull/8340)
- Document changes (
plots
: standardise across DVC/Studio/VS Code dvc.org#4978) - Update
dvc-render
indvclive
(plots
: standardise across DVC/Studio/VS Code (update dependencies) dvclive#747)
Note: Took a detour to add tests to Studio and do some refactoring before attempting to make the required changes. All the PRs are linked to this issue.