Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ $echBadgeTextColor: #07101f;
flex-shrink: 0;
flex-grow: 0;

padding-block: 0px;
padding-inline: 8px;
padding-block: 2px;
padding-inline: 10px;

border: 1px solid transparent;
border-radius: 2px;
border-radius: 9999px;

font-size: inherit;
line-height: inherit;
Expand Down
3 changes: 3 additions & 0 deletions packages/charts/src/chart_types/metric/renderer/dom/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import type { Color } from '../../../../common/colors';
/** @internal */
export const BADGE_BORDER = 1;

/** @internal */
export const BADGE_PADDING_BLOCK = 2;

const ICON_MARGIN = 4;

interface BadgeProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { BADGE_BORDER } from './badge';
import { BADGE_BORDER, BADGE_PADDING_BLOCK } from './badge';
import type { TextParts } from './text_processing';
import { getTextParts } from './text_processing';
import { DEFAULT_FONT_FAMILY } from '../../../../common/default_theme_attributes';
Expand Down Expand Up @@ -308,7 +308,7 @@ function computeMetricTextLayout(

// If there is a badge, we add the padding to the extra height
const hasBadge = !!(datum?.extra && 'badgeColor' in datum?.extra && datum?.extra?.badgeColor);
const badgeHeight = hasBadge ? BADGE_BORDER * 2 : 0;
const badgeHeight = hasBadge ? (BADGE_BORDER + BADGE_PADDING_BLOCK) * 2 : 0;
// We assume that the extra element is taking one line
const extraHeight = sizes.extraFontSize * LINE_HEIGHT + badgeHeight;
const valueHeight = sizes.valueFontSize * LINE_HEIGHT;
Expand Down