Skip to content

Commit

Permalink
filter_raw_data
Browse files Browse the repository at this point in the history
  • Loading branch information
epompeii committed Dec 21, 2024
1 parent 001a55a commit d3216a7
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions services/console/src/components/console/perf/plot/line/LinePlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,15 @@ const line_plot = (props: Props) => {
}

let metrics_found = false;
const raw_data = json_perf.results.map((result, index) => {
const data = perf_result(result, index, props.perfActive);
if ((data?.line_data?.length ?? 0) > 0) {
metrics_found = true;
}
return data;
});
const raw_data = json_perf.results
.map((result, index) => {
const data = perf_result(result, index, props.perfActive);
if ((data?.line_data?.length ?? 0) > 0) {
metrics_found = true;
}
return data;
})
.filter((data) => data);

const raw_units = get_units(json_perf);
const [x_axis_kind, x_axis_scale_type, x_axis_label] = get_x_axis(
Expand Down Expand Up @@ -377,36 +379,40 @@ const scale_data = (
...raw_data.map((data) =>
Math.min(
// The primary metric series
Math.min(...data.line_data.map((datum) => datum.value ?? MAX)),
Math.min(...data.line_data?.map((datum) => datum.value ?? MAX)),
// The lower value series, if active
props.lower_value()
? Math.min(...data.line_data.map((datum) => datum.lower_value ?? MAX))
? Math.min(
...data.line_data?.map((datum) => datum.lower_value ?? MAX),
)
: MAX,
// The upper value series, if active
props.upper_value()
? Math.min(...data.line_data.map((datum) => datum.upper_value ?? MAX))
? Math.min(
...data.line_data?.map((datum) => datum.upper_value ?? MAX),
)
: MAX,
// The lower boundary series, if active
props.lower_boundary()
? Math.min(
...data.line_data.map((datum) => datum.lower_limit ?? MAX),
...data.skipped_lower_data.map((datum) => datum.y ?? MAX),
...data.line_data?.map((datum) => datum.lower_limit ?? MAX),
...data.skipped_lower_data?.map((datum) => datum.y ?? MAX),
)
: MAX,
// The upper boundary series, if active
props.upper_boundary()
? Math.min(
...data.line_data.map((datum) => datum.upper_limit ?? MAX),
...data.skipped_upper_data.map((datum) => datum.y ?? MAX),
...data.line_data?.map((datum) => datum.upper_limit ?? MAX),
...data.skipped_upper_data?.map((datum) => datum.y ?? MAX),
)
: MAX,
// The lower alert series
Math.min(
...data.lower_alert_data.map((datum) => datum.lower_limit ?? MAX),
...data.lower_alert_data?.map((datum) => datum.lower_limit ?? MAX),
),
// The upper alert series
Math.min(
...data.upper_alert_data.map((datum) => datum.upper_limit ?? MAX),
...data.upper_alert_data?.map((datum) => datum.upper_limit ?? MAX),
),
),
),
Expand Down

0 comments on commit d3216a7

Please sign in to comment.