-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(explore): heatmap tooltip trace links #115925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
3dac374
765df36
5866a75
58d6674
10e70fa
32e24c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ import 'echarts/lib/component/tooltip'; | |
| import type {Theme} from '@emotion/react'; | ||
| import {useTheme} from '@emotion/react'; | ||
| import type {TooltipComponentFormatterCallback} from 'echarts'; | ||
| import type {CallbackDataParams} from 'echarts/types/dist/shared'; | ||
| import moment from 'moment-timezone'; | ||
|
|
||
| import type {BaseChart, BaseChartProps} from 'sentry/components/charts/baseChart'; | ||
|
|
@@ -11,6 +12,7 @@ import {t} from 'sentry/locale'; | |
| import type {DataPoint} from 'sentry/types/echarts'; | ||
| import {toArray} from 'sentry/utils/array/toArray'; | ||
| import {getFormattedDate, getTimeFormat} from 'sentry/utils/dates'; | ||
| import {formatAbbreviatedNumber} from 'sentry/utils/formatters'; | ||
|
|
||
| export const CHART_TOOLTIP_VIEWPORT_OFFSET = 20; | ||
|
|
||
|
|
@@ -74,7 +76,7 @@ function defaultMarkerFormatter(value: string) { | |
| return value; | ||
| } | ||
|
|
||
| function getSeriesValue(series: any, offset: number) { | ||
| export function getSeriesValue(series: any, offset: number) { | ||
| if (!series.data) { | ||
| return; | ||
| } | ||
|
|
@@ -113,6 +115,10 @@ export type FormatterOptions = Pick< | |
| * If true seconds will be added to the Axis label time format | ||
| */ | ||
| addSecondsToTimeFormat?: boolean; | ||
| /** | ||
| * Content that IS NOT part of the series data but is shown on the tooltip. | ||
| */ | ||
| extraContent?: (seriesParams: CallbackDataParams) => string | null; | ||
| /** | ||
| * Limit the number of series rendered in the tooltip and display "+X more". | ||
| */ | ||
|
|
@@ -138,6 +144,7 @@ export function getFormatter({ | |
| valueFormatter = defaultValueFormatter, | ||
| nameFormatter = defaultNameFormatter, | ||
| markerFormatter = defaultMarkerFormatter, | ||
| extraContent, | ||
| subLabels = [], | ||
| addSecondsToTimeFormat = false, | ||
| limit, | ||
|
|
@@ -244,16 +251,28 @@ export function getFormatter({ | |
| ); | ||
|
|
||
| if (serie.seriesType === 'heatmap') { | ||
| const zAxisCountValue = (getSeriesValue(serie, 2) ?? 0).toString(); | ||
| const zAxisCountValue = formatAbbreviatedNumber( | ||
| getSeriesValue(serie, 2) ?? 0, | ||
| 4, | ||
| false | ||
| ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heatmap tooltip shows log-transformed Z-axis countsMedium Severity When Additional Locations (1)Reviewed by Cursor Bugbot for commit 3dac374. Configure here.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. going to deal with the log stuff in a different PR after i talk to Will and see how it's being calculated in the backend and how (or if) i'd need to transform it on the frontend. |
||
| const yAxisValue = valueFormatter( | ||
| getSeriesValue(serie, 1), | ||
| serie.seriesName, | ||
| serie | ||
| ); | ||
|
|
||
| acc.series.push( | ||
| `<div><span class="tooltip-label"><strong>${yAxisValue}</strong></span> ${zAxisCountValue}</div>` | ||
| ); | ||
| const additionalContent = extraContent ? extraContent(serie) : null; | ||
|
|
||
| if (additionalContent) { | ||
| acc.series.push( | ||
| `<div><span class="tooltip-label"><strong>${yAxisValue}</strong></span> ${zAxisCountValue}</div><div><span class="tooltip-label tooltip-label-centered">${additionalContent}</span></div>` | ||
| ); | ||
| } else { | ||
| acc.series.push( | ||
| `<div><span class="tooltip-label"><strong>${yAxisValue}</strong></span> ${zAxisCountValue}</div>` | ||
| ); | ||
| } | ||
|
|
||
| return acc; | ||
| } | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.