metricChart.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. import {Fragment, PureComponent} from 'react';
  2. import {browserHistory, WithRouterProps} from 'react-router';
  3. import styled from '@emotion/styled';
  4. import color from 'color';
  5. import type {LineSeriesOption} from 'echarts';
  6. import capitalize from 'lodash/capitalize';
  7. import moment from 'moment';
  8. import momentTimezone from 'moment-timezone';
  9. import {Client} from 'sentry/api';
  10. import Feature from 'sentry/components/acl/feature';
  11. import GuideAnchor from 'sentry/components/assistant/guideAnchor';
  12. import {Button} from 'sentry/components/button';
  13. import {AreaChart, AreaChartSeries} from 'sentry/components/charts/areaChart';
  14. import ChartZoom from 'sentry/components/charts/chartZoom';
  15. import MarkArea from 'sentry/components/charts/components/markArea';
  16. import MarkLine from 'sentry/components/charts/components/markLine';
  17. import EventsRequest from 'sentry/components/charts/eventsRequest';
  18. import LineSeries from 'sentry/components/charts/series/lineSeries';
  19. import SessionsRequest from 'sentry/components/charts/sessionsRequest';
  20. import {
  21. ChartControls,
  22. HeaderTitleLegend,
  23. InlineContainer,
  24. SectionHeading,
  25. SectionValue,
  26. } from 'sentry/components/charts/styles';
  27. import CircleIndicator from 'sentry/components/circleIndicator';
  28. import {
  29. parseStatsPeriod,
  30. StatsPeriodType,
  31. } from 'sentry/components/organizations/pageFilters/parse';
  32. import Panel from 'sentry/components/panels/panel';
  33. import PanelBody from 'sentry/components/panels/panelBody';
  34. import Placeholder from 'sentry/components/placeholder';
  35. import {Tooltip} from 'sentry/components/tooltip';
  36. import Truncate from 'sentry/components/truncate';
  37. import {IconCheckmark, IconClock, IconFire, IconWarning} from 'sentry/icons';
  38. import {t} from 'sentry/locale';
  39. import ConfigStore from 'sentry/stores/configStore';
  40. import {space} from 'sentry/styles/space';
  41. import {DateString, Organization, Project} from 'sentry/types';
  42. import {ReactEchartsRef, Series} from 'sentry/types/echarts';
  43. import {getUtcDateString} from 'sentry/utils/dates';
  44. import {getDuration} from 'sentry/utils/formatters';
  45. import getDynamicText from 'sentry/utils/getDynamicText';
  46. import {MINUTES_THRESHOLD_TO_DISPLAY_SECONDS} from 'sentry/utils/sessions';
  47. import theme from 'sentry/utils/theme';
  48. import toArray from 'sentry/utils/toArray';
  49. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  50. // eslint-disable-next-line no-restricted-imports
  51. import withSentryRouter from 'sentry/utils/withSentryRouter';
  52. import {COMPARISON_DELTA_OPTIONS} from 'sentry/views/alerts/rules/metric/constants';
  53. import {makeDefaultCta} from 'sentry/views/alerts/rules/metric/metricRulePresets';
  54. import {
  55. AlertRuleTriggerType,
  56. MetricRule,
  57. TimePeriod,
  58. } from 'sentry/views/alerts/rules/metric/types';
  59. import {getChangeStatus} from 'sentry/views/alerts/utils/getChangeStatus';
  60. import {AlertWizardAlertNames} from 'sentry/views/alerts/wizard/options';
  61. import {getAlertTypeFromAggregateDataset} from 'sentry/views/alerts/wizard/utils';
  62. import {Incident} from '../../../types';
  63. import {
  64. alertDetailsLink,
  65. alertTooltipValueFormatter,
  66. isSessionAggregate,
  67. SESSION_AGGREGATE_TO_FIELD,
  68. } from '../../../utils';
  69. import {getMetricDatasetQueryExtras} from '../utils/getMetricDatasetQueryExtras';
  70. import {isCrashFreeAlert} from '../utils/isCrashFreeAlert';
  71. import {TimePeriodType} from './constants';
  72. import {
  73. getMetricAlertChartOption,
  74. transformSessionResponseToSeries,
  75. } from './metricChartOption';
  76. type Props = WithRouterProps & {
  77. api: Client;
  78. filter: string[] | null;
  79. interval: string;
  80. organization: Organization;
  81. project: Project;
  82. query: string;
  83. rule: MetricRule;
  84. timePeriod: TimePeriodType;
  85. incidents?: Incident[];
  86. isOnDemandMetricAlert?: boolean;
  87. selectedIncident?: Incident | null;
  88. };
  89. type State = {
  90. height: number;
  91. width: number;
  92. };
  93. function formatTooltipDate(date: moment.MomentInput, format: string): string {
  94. const {
  95. options: {timezone},
  96. } = ConfigStore.get('user');
  97. return momentTimezone.tz(date, timezone).format(format);
  98. }
  99. function getRuleChangeSeries(
  100. rule: MetricRule,
  101. data: AreaChartSeries[]
  102. ): LineSeriesOption[] {
  103. const {dateModified} = rule;
  104. if (!data.length || !data[0].data.length || !dateModified) {
  105. return [];
  106. }
  107. const seriesData = data[0].data;
  108. const seriesStart = new Date(seriesData[0].name).getTime();
  109. const ruleChanged = new Date(dateModified).getTime();
  110. if (ruleChanged < seriesStart) {
  111. return [];
  112. }
  113. return [
  114. {
  115. type: 'line',
  116. markLine: MarkLine({
  117. silent: true,
  118. animation: false,
  119. lineStyle: {color: theme.gray200, type: 'solid', width: 1},
  120. data: [{xAxis: ruleChanged}],
  121. label: {
  122. show: false,
  123. },
  124. }),
  125. markArea: MarkArea({
  126. silent: true,
  127. itemStyle: {
  128. color: color(theme.gray100).alpha(0.42).rgb().string(),
  129. },
  130. data: [[{xAxis: seriesStart}, {xAxis: ruleChanged}]],
  131. }),
  132. data: [],
  133. },
  134. ];
  135. }
  136. class MetricChart extends PureComponent<Props, State> {
  137. state = {
  138. width: -1,
  139. height: -1,
  140. };
  141. ref: null | ReactEchartsRef = null;
  142. /**
  143. * Syncs component state with the chart's width/heights
  144. */
  145. updateDimensions = () => {
  146. const chartRef = this.ref?.getEchartsInstance?.();
  147. if (!chartRef) {
  148. return;
  149. }
  150. const width = chartRef.getWidth();
  151. const height = chartRef.getHeight();
  152. if (width !== this.state.width || height !== this.state.height) {
  153. this.setState({
  154. width,
  155. height,
  156. });
  157. }
  158. };
  159. handleRef = (ref: ReactEchartsRef): void => {
  160. if (ref && !this.ref) {
  161. this.ref = ref;
  162. this.updateDimensions();
  163. }
  164. if (!ref) {
  165. this.ref = null;
  166. }
  167. };
  168. handleZoom = (start: DateString, end: DateString) => {
  169. const {location} = this.props;
  170. browserHistory.push({
  171. pathname: location.pathname,
  172. query: {
  173. start,
  174. end,
  175. },
  176. });
  177. };
  178. renderChartActions(
  179. totalDuration: number,
  180. criticalDuration: number,
  181. warningDuration: number,
  182. waitingForDataDuration: number,
  183. isOnDemandMetricAlert?: boolean
  184. ) {
  185. const {rule, organization, project, timePeriod, query} = this.props;
  186. const {buttonText, ...props} = makeDefaultCta({
  187. orgSlug: organization.slug,
  188. projects: [project],
  189. rule,
  190. timePeriod,
  191. query,
  192. });
  193. const resolvedPercent =
  194. (100 *
  195. Math.max(
  196. totalDuration - waitingForDataDuration - criticalDuration - warningDuration,
  197. 0
  198. )) /
  199. totalDuration;
  200. const criticalPercent = 100 * Math.min(criticalDuration / totalDuration, 1);
  201. const warningPercent = 100 * Math.min(warningDuration / totalDuration, 1);
  202. const waitingForDataPercent =
  203. 100 *
  204. Math.min(
  205. (waitingForDataDuration - criticalDuration - warningDuration) / totalDuration,
  206. 1
  207. );
  208. const isOnDemandAlertWihtoutData =
  209. isOnDemandMetricAlert && waitingForDataDuration === totalDuration;
  210. return (
  211. <StyledChartControls>
  212. <StyledInlineContainer>
  213. {isOnDemandAlertWihtoutData ? (
  214. <Fragment>
  215. <GuideAnchor
  216. disabled={false}
  217. target="empty_on_demand_chart"
  218. position="right"
  219. >
  220. <OnDemandNoDataWrapper>
  221. {t(
  222. 'This alert lacks historical data due to filters for which we don’t routinely extract metrics.'
  223. )}
  224. </OnDemandNoDataWrapper>
  225. </GuideAnchor>
  226. </Fragment>
  227. ) : (
  228. <Fragment>
  229. <SectionHeading>{t('Summary')}</SectionHeading>
  230. <StyledSectionValue>
  231. <ValueItem>
  232. <IconCheckmark color="successText" isCircled />
  233. {resolvedPercent ? resolvedPercent.toFixed(2) : 0}%
  234. </ValueItem>
  235. <ValueItem>
  236. <IconWarning color="warningText" />
  237. {warningPercent ? warningPercent.toFixed(2) : 0}%
  238. </ValueItem>
  239. <ValueItem>
  240. <IconFire color="errorText" />
  241. {criticalPercent ? criticalPercent.toFixed(2) : 0}%
  242. </ValueItem>
  243. {waitingForDataPercent > 0 && (
  244. <StyledTooltip
  245. underlineColor="gray200"
  246. showUnderline
  247. title={t(
  248. 'The time spent waiting for metrics matching the filters used.'
  249. )}
  250. >
  251. <ValueItem>
  252. <IconClock />
  253. {waitingForDataPercent.toFixed(2)}%
  254. </ValueItem>
  255. </StyledTooltip>
  256. )}
  257. </StyledSectionValue>
  258. </Fragment>
  259. )}
  260. </StyledInlineContainer>
  261. {!isSessionAggregate(rule.aggregate) && (
  262. <Feature features={['discover-basic']}>
  263. <Button size="sm" {...props}>
  264. {buttonText}
  265. </Button>
  266. </Feature>
  267. )}
  268. </StyledChartControls>
  269. );
  270. }
  271. renderChart(
  272. loading: boolean,
  273. timeseriesData?: Series[],
  274. minutesThresholdToDisplaySeconds?: number,
  275. comparisonTimeseriesData?: Series[]
  276. ) {
  277. const {
  278. router,
  279. selectedIncident,
  280. interval,
  281. filter,
  282. incidents,
  283. rule,
  284. organization,
  285. timePeriod: {start, end},
  286. } = this.props;
  287. const {width} = this.state;
  288. const {dateModified, timeWindow} = rule;
  289. if (loading || !timeseriesData) {
  290. return this.renderEmpty();
  291. }
  292. const handleIncidentClick = (incident: Incident) => {
  293. router.push(
  294. normalizeUrl({
  295. pathname: alertDetailsLink(organization, incident),
  296. query: {alert: incident.identifier},
  297. })
  298. );
  299. };
  300. const {
  301. criticalDuration,
  302. warningDuration,
  303. totalDuration,
  304. waitingForDataDuration,
  305. chartOption,
  306. } = getMetricAlertChartOption({
  307. timeseriesData,
  308. rule,
  309. incidents,
  310. selectedIncident,
  311. isOnDemandMetricAlert: this.props.isOnDemandMetricAlert,
  312. handleIncidentClick,
  313. });
  314. const comparisonSeriesName = capitalize(
  315. COMPARISON_DELTA_OPTIONS.find(({value}) => value === rule.comparisonDelta)?.label ||
  316. ''
  317. );
  318. const additionalSeries: LineSeriesOption[] = [
  319. ...(comparisonTimeseriesData || []).map(({data: _data, ...otherSeriesProps}) =>
  320. LineSeries({
  321. name: comparisonSeriesName,
  322. data: _data.map(({name, value}) => [name, value]),
  323. lineStyle: {color: theme.gray200, type: 'dashed', width: 1},
  324. itemStyle: {color: theme.gray200},
  325. animation: false,
  326. animationThreshold: 1,
  327. animationDuration: 0,
  328. ...otherSeriesProps,
  329. })
  330. ),
  331. ...getRuleChangeSeries(rule, timeseriesData),
  332. ];
  333. const queryFilter =
  334. filter?.join(' ') + t(' over ') + getDuration(rule.timeWindow * 60);
  335. const percentOfWidth =
  336. width >= 1151
  337. ? 15
  338. : width < 1151 && width >= 700
  339. ? 14
  340. : width < 700 && width >= 515
  341. ? 13
  342. : width < 515 && width >= 300
  343. ? 12
  344. : 8;
  345. const truncateWidth = (percentOfWidth / 100) * width;
  346. return (
  347. <ChartPanel>
  348. <StyledPanelBody withPadding>
  349. <ChartHeader>
  350. <HeaderTitleLegend>
  351. {AlertWizardAlertNames[getAlertTypeFromAggregateDataset(rule)]}
  352. </HeaderTitleLegend>
  353. </ChartHeader>
  354. <ChartFilters>
  355. <StyledCircleIndicator size={8} />
  356. <Filters>{rule.aggregate}</Filters>
  357. <Truncate value={queryFilter ?? ''} maxLength={truncateWidth} />
  358. </ChartFilters>
  359. {getDynamicText({
  360. value: (
  361. <ChartZoom
  362. router={router}
  363. start={start}
  364. end={end}
  365. onZoom={zoomArgs => this.handleZoom(zoomArgs.start, zoomArgs.end)}
  366. onFinished={() => {
  367. // We want to do this whenever the chart finishes re-rendering so that we can update the dimensions of
  368. // any graphics related to the triggers (e.g. the threshold areas + boundaries)
  369. this.updateDimensions();
  370. }}
  371. >
  372. {zoomRenderProps => (
  373. <AreaChart
  374. {...zoomRenderProps}
  375. {...chartOption}
  376. showTimeInTooltip
  377. minutesThresholdToDisplaySeconds={minutesThresholdToDisplaySeconds}
  378. forwardedRef={this.handleRef}
  379. additionalSeries={additionalSeries}
  380. tooltip={{
  381. formatter: seriesParams => {
  382. // seriesParams can be object instead of array
  383. const pointSeries = toArray(seriesParams);
  384. const {marker, data: pointData, seriesName} = pointSeries[0];
  385. const [pointX, pointY] = pointData as [number, number];
  386. const pointYFormatted = alertTooltipValueFormatter(
  387. pointY,
  388. seriesName ?? '',
  389. rule.aggregate
  390. );
  391. const isModified =
  392. dateModified && pointX <= new Date(dateModified).getTime();
  393. const startTime = formatTooltipDate(moment(pointX), 'MMM D LT');
  394. const {period, periodLength} = parseStatsPeriod(interval) ?? {
  395. periodLength: 'm',
  396. period: `${timeWindow}`,
  397. };
  398. const endTime = formatTooltipDate(
  399. moment(pointX).add(
  400. parseInt(period, 10),
  401. periodLength as StatsPeriodType
  402. ),
  403. 'MMM D LT'
  404. );
  405. const comparisonSeries =
  406. pointSeries.length > 1
  407. ? pointSeries.find(
  408. ({seriesName: _sn}) => _sn === comparisonSeriesName
  409. )
  410. : undefined;
  411. const comparisonPointY = comparisonSeries?.data[1] as
  412. | number
  413. | undefined;
  414. const comparisonPointYFormatted =
  415. comparisonPointY !== undefined
  416. ? alertTooltipValueFormatter(
  417. comparisonPointY,
  418. seriesName ?? '',
  419. rule.aggregate
  420. )
  421. : undefined;
  422. const changePercentage =
  423. comparisonPointY === undefined
  424. ? NaN
  425. : ((pointY - comparisonPointY) * 100) / comparisonPointY;
  426. const changeStatus = getChangeStatus(
  427. changePercentage,
  428. rule.thresholdType,
  429. rule.triggers
  430. );
  431. const changeStatusColor =
  432. changeStatus === AlertRuleTriggerType.CRITICAL
  433. ? theme.red300
  434. : changeStatus === AlertRuleTriggerType.WARNING
  435. ? theme.yellow300
  436. : theme.green300;
  437. return [
  438. `<div class="tooltip-series">`,
  439. isModified &&
  440. `<div><span class="tooltip-label"><strong>${t(
  441. 'Alert Rule Modified'
  442. )}</strong></span></div>`,
  443. `<div><span class="tooltip-label">${marker} <strong>${seriesName}</strong></span>${pointYFormatted}</div>`,
  444. comparisonSeries &&
  445. `<div><span class="tooltip-label">${comparisonSeries.marker} <strong>${comparisonSeriesName}</strong></span>${comparisonPointYFormatted}</div>`,
  446. `</div>`,
  447. `<div class="tooltip-footer">`,
  448. `<span>${startTime} &mdash; ${endTime}</span>`,
  449. comparisonPointY !== undefined &&
  450. Math.abs(changePercentage) !== Infinity &&
  451. !isNaN(changePercentage) &&
  452. `<span style="color:${changeStatusColor};margin-left:10px;">${
  453. Math.sign(changePercentage) === 1 ? '+' : '-'
  454. }${Math.abs(changePercentage).toFixed(2)}%</span>`,
  455. `</div>`,
  456. '<div class="tooltip-arrow"></div>',
  457. ]
  458. .filter(e => e)
  459. .join('');
  460. },
  461. }}
  462. />
  463. )}
  464. </ChartZoom>
  465. ),
  466. fixed: <Placeholder height="200px" testId="skeleton-ui" />,
  467. })}
  468. </StyledPanelBody>
  469. {this.renderChartActions(
  470. totalDuration,
  471. criticalDuration,
  472. warningDuration,
  473. waitingForDataDuration,
  474. this.props.isOnDemandMetricAlert
  475. )}
  476. </ChartPanel>
  477. );
  478. }
  479. renderEmpty(placeholderText = '') {
  480. return (
  481. <ChartPanel>
  482. <PanelBody withPadding>
  483. <TriggerChartPlaceholder>{placeholderText}</TriggerChartPlaceholder>
  484. </PanelBody>
  485. </ChartPanel>
  486. );
  487. }
  488. render() {
  489. const {
  490. api,
  491. rule,
  492. organization,
  493. timePeriod,
  494. project,
  495. interval,
  496. query,
  497. location,
  498. isOnDemandMetricAlert,
  499. } = this.props;
  500. const {aggregate, timeWindow, environment, dataset} = rule;
  501. // Fix for 7 days * 1m interval being over the max number of results from events api
  502. // 10k events is the current max
  503. if (
  504. timePeriod.usingPeriod &&
  505. timePeriod.period === TimePeriod.SEVEN_DAYS &&
  506. interval === '1m'
  507. ) {
  508. timePeriod.start = getUtcDateString(
  509. // -5 minutes provides a small cushion for rounding up minutes. This might be able to be smaller
  510. moment(moment.utc(timePeriod.end).subtract(10000 - 5, 'minutes'))
  511. );
  512. }
  513. // If the chart duration isn't as long as the rollup duration the events-stats
  514. // endpoint will return an invalid timeseriesData dataset
  515. const viableStartDate = getUtcDateString(
  516. moment.min(
  517. moment.utc(timePeriod.start),
  518. moment.utc(timePeriod.end).subtract(timeWindow, 'minutes')
  519. )
  520. );
  521. const viableEndDate = getUtcDateString(
  522. moment.utc(timePeriod.end).add(timeWindow, 'minutes')
  523. );
  524. const queryExtras = getMetricDatasetQueryExtras({
  525. organization,
  526. location,
  527. dataset,
  528. newAlertOrQuery: false,
  529. });
  530. return isCrashFreeAlert(dataset) ? (
  531. <SessionsRequest
  532. api={api}
  533. organization={organization}
  534. project={project.id ? [Number(project.id)] : []}
  535. environment={environment ? [environment] : undefined}
  536. start={viableStartDate}
  537. end={viableEndDate}
  538. query={query}
  539. interval={interval}
  540. field={SESSION_AGGREGATE_TO_FIELD[aggregate]}
  541. groupBy={['session.status']}
  542. >
  543. {({loading, response}) =>
  544. this.renderChart(
  545. loading,
  546. transformSessionResponseToSeries(response, rule),
  547. MINUTES_THRESHOLD_TO_DISPLAY_SECONDS
  548. )
  549. }
  550. </SessionsRequest>
  551. ) : (
  552. <EventsRequest
  553. api={api}
  554. organization={organization}
  555. query={query}
  556. environment={environment ? [environment] : undefined}
  557. project={project.id ? [Number(project.id)] : []}
  558. interval={interval}
  559. comparisonDelta={rule.comparisonDelta ? rule.comparisonDelta * 60 : undefined}
  560. start={viableStartDate}
  561. end={viableEndDate}
  562. yAxis={aggregate}
  563. includePrevious={false}
  564. currentSeriesNames={[aggregate]}
  565. partial={false}
  566. queryExtras={queryExtras}
  567. referrer="api.alerts.alert-rule-chart"
  568. useOnDemandMetrics={isOnDemandMetricAlert}
  569. >
  570. {({loading, timeseriesData, comparisonTimeseriesData}) =>
  571. this.renderChart(loading, timeseriesData, undefined, comparisonTimeseriesData)
  572. }
  573. </EventsRequest>
  574. );
  575. }
  576. }
  577. export default withSentryRouter(MetricChart);
  578. const ChartPanel = styled(Panel)`
  579. margin-top: ${space(2)};
  580. `;
  581. const ChartHeader = styled('div')`
  582. margin-bottom: ${space(3)};
  583. `;
  584. const StyledChartControls = styled(ChartControls)`
  585. display: flex;
  586. justify-content: space-between;
  587. flex-wrap: wrap;
  588. `;
  589. const StyledInlineContainer = styled(InlineContainer)`
  590. grid-auto-flow: column;
  591. grid-column-gap: ${space(1)};
  592. `;
  593. const StyledCircleIndicator = styled(CircleIndicator)`
  594. background: ${p => p.theme.formText};
  595. height: ${space(1)};
  596. margin-right: ${space(0.5)};
  597. `;
  598. const ChartFilters = styled('div')`
  599. font-size: ${p => p.theme.fontSizeSmall};
  600. font-family: ${p => p.theme.text.family};
  601. color: ${p => p.theme.textColor};
  602. display: inline-grid;
  603. grid-template-columns: repeat(3, max-content);
  604. align-items: center;
  605. `;
  606. const Filters = styled('span')`
  607. margin-right: ${space(1)};
  608. `;
  609. const StyledSectionValue = styled(SectionValue)`
  610. display: grid;
  611. grid-template-columns: repeat(4, auto);
  612. gap: ${space(1.5)};
  613. margin: 0 0 0 ${space(1.5)};
  614. `;
  615. const OnDemandNoDataWrapper = styled(SectionValue)`
  616. margin: 0;
  617. `;
  618. const ValueItem = styled('div')`
  619. display: grid;
  620. grid-template-columns: repeat(2, auto);
  621. gap: ${space(0.5)};
  622. align-items: center;
  623. font-variant-numeric: tabular-nums;
  624. text-underline-offset: ${space(4)};
  625. `;
  626. /* Override padding to make chart appear centered */
  627. const StyledPanelBody = styled(PanelBody)`
  628. padding-right: 6px;
  629. `;
  630. const TriggerChartPlaceholder = styled(Placeholder)`
  631. height: 200px;
  632. text-align: center;
  633. padding: ${space(3)};
  634. `;
  635. const StyledTooltip = styled(Tooltip)`
  636. text-underline-offset: ${space(0.5)} !important;
  637. `;