diff --git a/locust/webui/src/components/LineChart/LineChart.types.ts b/locust/webui/src/components/LineChart/LineChart.types.ts index ddd73782b7..42d6e43162 100644 --- a/locust/webui/src/components/LineChart/LineChart.types.ts +++ b/locust/webui/src/components/LineChart/LineChart.types.ts @@ -18,7 +18,7 @@ export interface ILineChart { } export interface ILineChartZoomEvent { - batch?: { start: number; end: number }[]; + batch?: { start: number; startValue: number; end: number }[]; } export interface ILineChartMarkers { diff --git a/locust/webui/src/components/LineChart/LineChart.utils.ts b/locust/webui/src/components/LineChart/LineChart.utils.ts index f63a6a77ba..65dabe76e4 100644 --- a/locust/webui/src/components/LineChart/LineChart.utils.ts +++ b/locust/webui/src/components/LineChart/LineChart.utils.ts @@ -91,13 +91,6 @@ export const createOptions = >({ scatterplot, }: ILineChart) => ({ title: { text: title }, - dataZoom: [ - { - type: 'inside', - start: 0, - end: 100, - }, - ], tooltip: { trigger: 'axis', formatter: (params?: ILineChartTooltipFormatterParams[] | null) => { @@ -138,11 +131,11 @@ export const createOptions = >({ right: 10, feature: { dataZoom: { - show: true, title: { zoom: 'Zoom Select', back: 'Zoom Reset', }, + yAxisIndex: false, }, saveAsImage: { name: title.replace(/\s+/g, '_').toLowerCase() + '_' + new Date().getTime() / 1000, @@ -176,21 +169,14 @@ export const onChartZoom = (chart: ECharts) => (datazoom: unknown) => { return; } - const [{ start, end }] = batch; - const isZoomed = start > 0 && end < 100; + const [{ start, startValue, end }] = batch; + const isZoomed = (start > 0 && end <= 100) || startValue > 0; chart.setOption({ dataZoom: [ - { - type: 'inside', - start, - end, - }, { type: 'slider', show: isZoomed, - start, - end, }, ], });