diff --git a/backend/zeno_backend/processing/chart.py b/backend/zeno_backend/processing/chart.py index 7baf88bb..4a63cb4d 100644 --- a/backend/zeno_backend/processing/chart.py +++ b/backend/zeno_backend/processing/chart.py @@ -34,12 +34,25 @@ def xyc_data(chart: Chart, project: str) -> str: elements: list[dict[str, Any]] = [] if not (isinstance(chart.parameters, XCParameters)): return json.dumps({"table": elements}) + all_metrics = metrics(project) selected_metric = next( (x for x in all_metrics if x.id == chart.parameters.metric), Metric(id=-1, name="count", type="count", columns=[]), ) + selected_slices = slices(project, chart.parameters.slices) + if -1 in chart.parameters.slices: + selected_slices = selected_slices + [ + Slice( + id=-1, + slice_name="All instances", + filter_predicates=FilterPredicateGroup( + predicates=[], join=Join.OMITTED + ), + ) + ] + selected_models = chart.parameters.models for current_slice in selected_slices: for model in selected_models: @@ -82,6 +95,16 @@ def table_data(chart: Chart, project: str) -> str: ) ) selected_slices = slices(project, params.slices) + if -1 in params.slices: + selected_slices = selected_slices + [ + Slice( + id=-1, + slice_name="All instances", + filter_predicates=FilterPredicateGroup( + predicates=[], join=Join.OMITTED + ), + ) + ] selected_models = params.models for current_metric in selected_metrics: @@ -129,6 +152,16 @@ def beeswarm_data(chart: Chart, project: str) -> str: ) ) selected_slices = slices(project, params.slices) + if -1 in params.slices: + selected_slices = selected_slices + [ + Slice( + id=-1, + slice_name="All instances", + filter_predicates=FilterPredicateGroup( + predicates=[], join=Join.OMITTED + ), + ) + ] selected_models = params.models for current_metric in selected_metrics: @@ -175,6 +208,16 @@ def radar_data(chart: Chart, project: str) -> str: ) ) selected_slices = slices(project, params.slices) + if -1 in params.slices: + selected_slices = selected_slices + [ + Slice( + id=-1, + slice_name="All instances", + filter_predicates=FilterPredicateGroup( + predicates=[], join=Join.OMITTED + ), + ) + ] selected_models = params.models for current_metric in selected_metrics: @@ -221,12 +264,33 @@ def heatmap_data(chart: Chart, project: str) -> str: ) x_slice = params.x_channel == SlicesOrModels.SLICES y_slice = params.y_channel == SlicesOrModels.SLICES - selected_x: list[Slice] | list[str] = ( + selected_x = ( slices(project, params.x_values) if x_slice else params.x_values # type: ignore ) + if x_slice and -1 in params.x_values: + selected_x = selected_x + [ + Slice( + id=-1, + slice_name="All instances", + filter_predicates=FilterPredicateGroup( + predicates=[], join=Join.OMITTED + ), + ) + ] + selected_y = ( slices(project, params.y_values) if y_slice else params.y_values # type: ignore ) + if y_slice and -1 in params.y_values: + selected_y = selected_y + [ + Slice( + id=-1, + slice_name="All instances", + filter_predicates=FilterPredicateGroup( + predicates=[], join=Join.OMITTED + ), + ) + ] for current_x in selected_x: for current_y in selected_y: diff --git a/frontend/src/lib/components/chart/chart-page/encoding/chart-encoding/encoding-components/SlicesEncodingDropdown.svelte b/frontend/src/lib/components/chart/chart-page/encoding/chart-encoding/encoding-components/SlicesEncodingDropdown.svelte index c21d01fa..a6930ac4 100644 --- a/frontend/src/lib/components/chart/chart-page/encoding/chart-encoding/encoding-components/SlicesEncodingDropdown.svelte +++ b/frontend/src/lib/components/chart/chart-page/encoding/chart-encoding/encoding-components/SlicesEncodingDropdown.svelte @@ -13,6 +13,7 @@ let options: { value: number; label: string }[] = []; let value = 0; + options.push({ value: -1, label: 'All instances' }); $slices.forEach((s) => { options.push({ value: s.id, label: s.sliceName }); }); diff --git a/frontend/src/lib/components/chart/chart-page/encoding/chart-encoding/encoding-components/SlicesEncodingMultiChoice.svelte b/frontend/src/lib/components/chart/chart-page/encoding/chart-encoding/encoding-components/SlicesEncodingMultiChoice.svelte index b67e28ef..47e19f68 100644 --- a/frontend/src/lib/components/chart/chart-page/encoding/chart-encoding/encoding-components/SlicesEncodingMultiChoice.svelte +++ b/frontend/src/lib/components/chart/chart-page/encoding/chart-encoding/encoding-components/SlicesEncodingMultiChoice.svelte @@ -12,6 +12,7 @@ let options: { value: number; label: string }[] = []; let value: number[] = []; + options.push({ value: -1, label: 'All instances' }); // initial options & values $slices.forEach((s) => { options.push({ value: s.id, label: s.sliceName }); diff --git a/frontend/src/lib/components/chart/chart-types/table/TableRow.svelte b/frontend/src/lib/components/chart/chart-types/table/TableRow.svelte index adddf8c9..64f66564 100644 --- a/frontend/src/lib/components/chart/chart-types/table/TableRow.svelte +++ b/frontend/src/lib/components/chart/chart-types/table/TableRow.svelte @@ -17,7 +17,11 @@ {#if parameters.yChannel === SlicesOrModels.SLICES} - sli.id === row)} /> + {#if row === -1} +

All instances

+ {:else} + sli.id === row)} /> + {/if} {:else} {row} {/if}