Skip to content

Commit 66d1e16

Browse files
authored
feat(trends): Add tooltip to trends baselines (#26188)
This adds a tooltip with the baseline values when hovering the baseline marklines on the trends charts.
1 parent ff29038 commit 66d1e16

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

static/app/views/performance/trends/chart.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import ReleaseSeries from 'app/components/charts/releaseSeries';
1010
import TransitionChart from 'app/components/charts/transitionChart';
1111
import TransparentLoadingMask from 'app/components/charts/transparentLoadingMask';
1212
import {getParams} from 'app/components/organizations/globalSelectionHeader/getParams';
13+
import {t} from 'app/locale';
1314
import {EventsStatsData, OrganizationSummary, Project} from 'app/types';
1415
import {Series} from 'app/types/echarts';
1516
import {getUtcToLocalDateObject} from 'app/utils/dates';
@@ -159,12 +160,40 @@ function getIntervalLine(
159160
{coord: [seriesLine, transaction.aggregate_range_1]},
160161
],
161162
];
163+
previousPeriod.markLine.tooltip = {
164+
formatter: () => {
165+
return [
166+
'<div class="tooltip-series tooltip-series-solo">',
167+
'<div>',
168+
`<span class="tooltip-label"><strong>${t('Past Baseline')}</strong></span>`,
169+
// p50() coerces the axis to be time based
170+
tooltipFormatter(transaction.aggregate_range_1, 'p50()'),
171+
'</div>',
172+
'</div>',
173+
'<div class="tooltip-arrow"></div>',
174+
].join('');
175+
},
176+
} as any;
162177
currentPeriod.markLine.data = [
163178
[
164179
{value: 'Present', coord: [seriesLine, transaction.aggregate_range_2]},
165180
{coord: [seriesEnd, transaction.aggregate_range_2]},
166181
],
167182
];
183+
currentPeriod.markLine.tooltip = {
184+
formatter: () => {
185+
return [
186+
'<div class="tooltip-series tooltip-series-solo">',
187+
'<div>',
188+
`<span class="tooltip-label"><strong>${t('Present Baseline')}</strong></span>`,
189+
// p50() coerces the axis to be time based
190+
tooltipFormatter(transaction.aggregate_range_2, 'p50()'),
191+
'</div>',
192+
'</div>',
193+
'<div class="tooltip-arrow"></div>',
194+
].join('');
195+
},
196+
} as any;
168197
periodDividingLine.markLine = {
169198
data: [
170199
{

0 commit comments

Comments
 (0)