Skip to content

Commit

Permalink
chore: Add min and max to data for plot.
Browse files Browse the repository at this point in the history
  • Loading branch information
mheggelund committed Oct 3, 2024
1 parent e9d47b1 commit f1610e3
Showing 1 changed file with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
/* eslint-disable max-lines-per-function */
import { GetObjectResultsDto } from '../../../../../../api/generated';
import {
GetObjectResultsDto,
PercentilesDto,
} from '../../../../../../api/generated';
import { ReactECharts, ReactEChartsProps } from '../Echarts/ReactECharts';

interface ExtendedPrecetile extends PercentilesDto {
min: number;
max: number;
}
export const GraphPlot = ({ data }: { data: GetObjectResultsDto }) => {
const PrecentilesMinMax: ExtendedPrecetile = {
min: data.height.min,
p10: data.height.percentiles.p10,
p20: data.height.percentiles.p20,
p30: data.height.percentiles.p30,
p40: data.height.percentiles.p40,
p50: data.height.percentiles.p50,
p60: data.height.percentiles.p60,
p70: data.height.percentiles.p70,
p80: data.height.percentiles.p80,
p90: data.height.percentiles.p90,
max: data.height.max,
};

const option: ReactEChartsProps['option'] = {
tooltip: {
trigger: 'axis',
Expand All @@ -24,13 +45,13 @@ export const GraphPlot = ({ data }: { data: GetObjectResultsDto }) => {
},
yAxis: {
type: 'category',
data: Object.keys(data.height.percentiles),
data: Object.keys(PrecentilesMinMax),
},
series: [
{
name: 'Channel width (m)',
type: 'line',
data: Object.values(data.height.percentiles),
data: Object.values(PrecentilesMinMax),
},
],
};
Expand Down

0 comments on commit f1610e3

Please sign in to comment.