Skip to content

Commit 7839023

Browse files
authored
fix(aci): Apply chart zoom on automation history (#103392)
Previously set query parameters that didn't seem to do anything. Moved away from deprecated render component.
1 parent 0f3c91b commit 7839023

File tree

1 file changed

+28
-32
lines changed

1 file changed

+28
-32
lines changed

static/app/views/automations/components/automationStatsChart.tsx

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import styled from '@emotion/styled';
22

33
import {BarChart} from 'sentry/components/charts/barChart';
4-
import ChartZoom from 'sentry/components/charts/chartZoom';
54
import {HeaderTitleLegend} from 'sentry/components/charts/styles';
5+
import {useChartZoom} from 'sentry/components/charts/useChartZoom';
66
import type {DateTimeObject} from 'sentry/components/charts/utils';
77
import LoadingError from 'sentry/components/loadingError';
88
import Panel from 'sentry/components/panels/panel';
@@ -28,6 +28,7 @@ export function AutomationStatsChart({
2828
utc,
2929
}: IssueAlertDetailsProps) {
3030
const organization = useOrganization();
31+
const chartZoomProps = useChartZoom({saveOnZoom: true});
3132
const {
3233
data: fireHistory,
3334
isPending,
@@ -59,37 +60,32 @@ export function AutomationStatsChart({
5960
{isPending && <Placeholder height="200px" />}
6061
{isError && <LoadingError />}
6162
{fireHistory && (
62-
<ChartZoom period={period} start={start} end={end} utc={utc} usePageDate>
63-
{zoomRenderProps => (
64-
<BarChart
65-
{...zoomRenderProps}
66-
isGroupedByDate
67-
showTimeInTooltip
68-
grid={{
69-
left: space(0.25),
70-
right: space(2),
71-
top: space(3),
72-
bottom: 0,
73-
}}
74-
yAxis={{
75-
minInterval: 1,
76-
}}
77-
series={[
78-
{
79-
seriesName: t('Alerts Triggered'),
80-
data:
81-
fireHistory?.map(automation => ({
82-
name: automation.date,
83-
value: automation.count,
84-
})) ?? [],
85-
emphasis: {
86-
disabled: true,
87-
},
88-
},
89-
]}
90-
/>
91-
)}
92-
</ChartZoom>
63+
<BarChart
64+
{...chartZoomProps}
65+
showTimeInTooltip
66+
grid={{
67+
left: space(0.25),
68+
right: space(2),
69+
top: space(3),
70+
bottom: 0,
71+
}}
72+
yAxis={{
73+
minInterval: 1,
74+
}}
75+
series={[
76+
{
77+
seriesName: t('Alerts Triggered'),
78+
data: fireHistory.map(automation => ({
79+
name: automation.date,
80+
value: automation.count,
81+
})),
82+
emphasis: {
83+
disabled: true,
84+
},
85+
animation: false,
86+
},
87+
]}
88+
/>
9389
)}
9490
</StyledPanelBody>
9591
<ChartFooter>

0 commit comments

Comments
 (0)