[ENHANCEMENT] timeserieschart: add per-query stack override#670
[ENHANCEMENT] timeserieschart: add per-query stack override#670SoWieMarkus wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a per-query stack?: boolean override to the Time Series Chart plugin so individual queries can opt in/out of stacking regardless of the global visual stacking setting, and wires this through the model + UI + series transformation logic.
Changes:
- Extends query settings (TS model, CUE schema, Go SDK) with
stack?: boolean. - Adds a Stack override control to the Query Settings editor.
- Updates series generation to prefer per-query stack override over global
visual.stack.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| timeserieschart/src/VisualOptionsEditor.tsx | Minor adjustment in visual stack option update line. |
| timeserieschart/src/utils/data-transform.ts | Implements per-query stack override logic in getTimeSeries() and moves getCommonTimeScale import. |
| timeserieschart/src/TimeSeriesChartPanel.tsx | Moves getTimeSeriesValues import to @perses-dev/core. |
| timeserieschart/src/TimeSeriesChartBase.tsx | Moves getCommonTimeScale import to @perses-dev/core. |
| timeserieschart/src/time-series-chart-model.ts | Adds stack?: boolean to QuerySettingsOptions. |
| timeserieschart/src/QuerySettingsEditor.tsx | Adds Stack override UI (Switch) and plumbing for query settings updates. |
| timeserieschart/sdk/go/time-series.go | Adds stack field to Go SDK query settings struct. |
| timeserieschart/schemas/time-series.cue | Adds stack?: bool to the CUE schema. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -90,7 +92,7 @@ export function getTimeSeries( | |||
| datasetIndex, | |||
| name: formattedName, | |||
| color: paletteColor, | |||
| stack: visual.stack === 'all' ? visual.stack : undefined, | |||
| stack: shouldStack ? 'all' : undefined, | |||
| yAxisIndex: yAxisIndex, | |||
There was a problem hiding this comment.
@SoWieMarkus, I can also confirm that the tooltip is not working anymore when it is stacked after your changes. I tested manually.
There was a problem hiding this comment.
Can you explain what exactly is not working anymore? I know there are issues with the tooltip when stacking is enabled, but that an issue that was there before my change.
Signed-off-by: Markus Wieland <markus.wieland@sap.com>
Co-authored-by: Akshay Iyyadurai Balasundaram <akshay.iyyadurai.balasundaram@sap.com> Signed-off-by: Markus Wieland <44964229+SoWieMarkus@users.noreply.github.com>
Co-authored-by: Akshay Iyyadurai Balasundaram <akshay.iyyadurai.balasundaram@sap.com> Signed-off-by: Markus Wieland <44964229+SoWieMarkus@users.noreply.github.com>
Co-authored-by: Akshay Iyyadurai Balasundaram <akshay.iyyadurai.balasundaram@sap.com> Signed-off-by: Markus Wieland <44964229+SoWieMarkus@users.noreply.github.com>
703a5b3 to
f694f67
Compare
…port structure Signed-off-by: Markus Wieland <markus.wieland@sap.com>
8179d5a to
64c38af
Compare
Signed-off-by: Markus Wieland <markus.wieland@sap.com>
@ibakshay The short answer: it doesn't change it. The per-query
(I added test cases for that) So any query that doesn't set the per-query In theory you could further extend this feature by adding a |

Description
Adds a per-query
stackoverride to the Time Series Chart plugin, allowing individual queries to opt in or out of stacking regardless of the global visual stack setting. This mirrors the behavior of Grafana/Plutono, where stacking can be controlled at the series level.What changed:
stack?: boolfield toQuerySettingsOptionsin the model, CUE schema, and Go SDKStackSwitch in theQuerySettingsEditorgetTimeSeries()indata-transform.tsto prefer the per-querystackflag over the globalvisual.stack === 'all'when setgetCommonTimeScaleandgetTimeSeriesValuesimports from@perses-dev/componentsto@perses-dev/core(because not available in@perses-dev/components? Can revert that change ofc)Open question:
The drawing order of stacked series depends on the order queries are defined. This could be relevant now since time series can overlap. But if they are not stacked it's the same. So just a thought. A dedicated
zIndexfield inQuerySettingsOptionscould give explicit control over this - though it only matters at higher opacity values anyway.Also in Grafana / Plutono the Stacking Option is a boolean. I didn't want to adjust that since that would be a breaking change, but might also be something to consider.
Screenshots
Query 1 excluded from stacking.
Query 1 included again in stacking.
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes