Skip to content
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

feat(bullet): new design style and implementation #2156

Merged
merged 91 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
6c9856e
WIP
markov00 May 11, 2023
31d1e37
WIP
markov00 May 11, 2023
413c5da
Add examples
markov00 May 11, 2023
ff43ac7
small refactoring
markov00 May 12, 2023
d62885d
wip
markov00 May 12, 2023
0c65470
WIP
markov00 May 15, 2023
fc86ed0
WIP
markov00 May 15, 2023
f874a4c
fix: remove erroneous render code
nickofthyme Aug 4, 2023
34ac5ff
feat: improve end/top label positioning
nickofthyme Aug 4, 2023
7b829fa
feat(bullet): add global title and description
nickofthyme Aug 7, 2023
2c3cf1d
feat(bullet): angular implementation with fixes
nickofthyme Aug 31, 2023
21f591a
rename story files
nickofthyme Aug 31, 2023
f414884
minor tweaks
nickofthyme Aug 31, 2023
b9dae6f
refactor: lift panel scales to top selector
nickofthyme Sep 22, 2023
d61cde6
feat: active value sync with tooltip
nickofthyme Sep 25, 2023
216b819
Merge branch 'main' into bullet-redesign
nickofthyme Sep 25, 2023
e1d5e94
chore: update active panel value logic
nickofthyme Sep 27, 2023
8b30007
Merge branch 'main' into bullet-redesign
nickofthyme Sep 27, 2023
4e4d3af
fix: add locale to bullet chart
nickofthyme Sep 27, 2023
f956bc4
feat: add target tick to metric fallback
nickofthyme Sep 28, 2023
1b13e86
chore: improve target styles
nickofthyme Sep 28, 2023
ef441ac
feat: discretize color band lookup
nickofthyme Sep 28, 2023
92c0809
chore: improve api
nickofthyme Sep 28, 2023
4aed2d4
fix: tick zIndex and debug renders
nickofthyme Sep 29, 2023
0196476
chore: improve active value logic
nickofthyme Sep 30, 2023
968f8e3
chore: update chart api changes
nickofthyme Sep 30, 2023
3e58ad3
fix: prettier formatting
nickofthyme Sep 30, 2023
4956d4b
fix: active value logic constraints
nickofthyme Oct 1, 2023
b182119
chore: add default tick/value formatting
nickofthyme Oct 2, 2023
679af77
test: vrt diffs test
nickofthyme Oct 2, 2023
4ae4b01
fix: target alignment on vertical metric
nickofthyme Oct 2, 2023
b1c6a43
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Oct 2, 2023
23d315e
chore: deprecate Goal chart type
nickofthyme Oct 4, 2023
0169cc8
refactor: merge angular size into subtypes
nickofthyme Oct 4, 2023
8700054
chore: add BulletGraphStyle export and update api
nickofthyme Oct 4, 2023
e3be8cb
chore: rm unused files
nickofthyme Oct 4, 2023
0cc4e63
Merge remote-tracking branch 'origin/bullet-redesign' into bullet-red…
nickofthyme Oct 4, 2023
0f55d12
Merge branch 'main' into bullet-redesign
nickofthyme Oct 17, 2023
09bb493
chore: configure tooltip value labels from spec
nickofthyme Oct 17, 2023
8458ff4
chore: fix errors with metric and subtype changes
nickofthyme Oct 17, 2023
c187ea9
fix: logical errors with measureText util
nickofthyme Oct 17, 2023
0a3db83
chore: update api changes
nickofthyme Oct 17, 2023
04c46c5
chore: remove package font family assignment
nickofthyme Oct 17, 2023
30de52f
chore: remove default letterSpacing
nickofthyme Oct 17, 2023
3b989ad
chore: restore debounce timer
nickofthyme Oct 17, 2023
189d244
chore: add back font-family
nickofthyme Oct 17, 2023
9217803
chore: minor tweaks and fixes
nickofthyme Oct 18, 2023
0131671
fix: add border on angular variants
nickofthyme Oct 18, 2023
cdea1ac
fix: render value bar from 0 for angular subtype
nickofthyme Oct 18, 2023
77ba793
fix: render value bar from 0 for horizontal subtype
nickofthyme Oct 18, 2023
9cf2668
fix: render value bar from 0 for vertical subtype
nickofthyme Oct 18, 2023
19358ac
fix: overflow issue with min domain > 0
nickofthyme Oct 18, 2023
0b95b0f
chore: reset vrt screenshots
nickofthyme Oct 18, 2023
248756a
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Oct 18, 2023
ddf7310
test: skip bullet tests in all.test and add manual tests
nickofthyme Oct 18, 2023
b64f4e4
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Oct 18, 2023
9027138
Merge branch 'main' into bullet-redesign
nickofthyme Oct 26, 2023
acbdea9
chore: revert tick render order over value bar
nickofthyme Oct 26, 2023
0504bb4
Merge remote-tracking branch 'origin/bullet-redesign' into bullet-red…
nickofthyme Oct 26, 2023
eb7b8ef
refactor: domain to be generic unordered
nickofthyme Oct 29, 2023
2ade1e4
refactor: color scale logic
nickofthyme Nov 5, 2023
cb35afe
feat: add domain nicing and desired ticks options
nickofthyme Nov 5, 2023
3c096ea
feat: allow custom tick placements
nickofthyme Nov 5, 2023
242e4e8
fix: prevent 0 tick count from user
nickofthyme Nov 5, 2023
e97ba5d
fix: type errors in legacy domain
nickofthyme Nov 6, 2023
af89acf
fix: tooltip color selection
nickofthyme Nov 6, 2023
0481f8e
chore: remove bullet bgColor in favor of theme bgColor
nickofthyme Nov 6, 2023
f32a7bc
chore: add zero baseline tick baseline
nickofthyme Nov 6, 2023
98e260f
chore: add fallback color for values outside of color domain
nickofthyme Nov 6, 2023
96ff84e
feat: add logic to match metric to bullet
nickofthyme Nov 6, 2023
2507dd7
Merge branch 'main' into bullet-redesign
nickofthyme Nov 6, 2023
d8dec1f
fix: last tick placement with negative polarity domains
nickofthyme Nov 6, 2023
d48615b
fix: zero tick showing on end of domain
nickofthyme Nov 6, 2023
759a088
chore: use valueLabels in metric titles
nickofthyme Nov 7, 2023
f10ca1b
test: add vrt, fix optionsKnob e2e mock
nickofthyme Nov 7, 2023
a0f3e43
Merge branch 'main' into bullet-redesign
nickofthyme Nov 7, 2023
4804d09
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Nov 7, 2023
6830e0c
chore: remove stale vrt, revet goal chart changes
nickofthyme Nov 7, 2023
14ab450
test: color band story and add vrt
nickofthyme Nov 8, 2023
f342969
fix: vrt error
nickofthyme Nov 8, 2023
fae1abe
chore: update bullet api exports
nickofthyme Nov 8, 2023
784c7b7
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Nov 8, 2023
d4bea27
Merge branch 'main' into bullet-redesign
nickofthyme Nov 8, 2023
1a237a7
chore: add resize parameter to bullet stories
nickofthyme Nov 8, 2023
65cf0ef
test: add tests for bullet as metric
nickofthyme Nov 8, 2023
b65657a
Merge remote-tracking branch 'origin/bullet-redesign' into bullet-red…
nickofthyme Nov 8, 2023
6f3f509
test: remove only [update-vrt]
nickofthyme Nov 8, 2023
b285521
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Nov 8, 2023
0d1328a
fix: object mock type bad arguments
nickofthyme Nov 8, 2023
e345ebf
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Nov 8, 2023
6bbfcd2
Merge branch 'main' into bullet-redesign
nickofthyme Nov 8, 2023
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
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = {
'@typescript-eslint/no-unsafe-call': 0, // seems to have issues with default import types
'@typescript-eslint/unbound-method': 1,
'@typescript-eslint/no-redeclare': 0, // we use to declare enum type and object with the same name
'@typescript-eslint/no-shadow': 0, // we use shadow mostly within the canvas renderer function when we need a new context
'@typescript-eslint/no-shadow': 0,
'@typescript-eslint/quotes': 0,
'@typescript-eslint/no-unsafe-argument': 1,
'unicorn/consistent-function-scoping': 1,
Expand All @@ -89,7 +89,7 @@ module.exports = {
'unicorn/number-literal-case': 0, // use prettier lower case preference
'global-require': 1,
'import/no-dynamic-require': 1,
'no-shadow': 1,
'no-shadow': ['warn', { allow: ['ctx'] }], // allow replacing ctx in canvas renderer functions, too tedious to rename at each level
'react/no-array-index-key': 1,
'react/prefer-stateless-function': 1,
'react/require-default-props': 0,
Expand Down
2 changes: 1 addition & 1 deletion e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface StoryGroupInfo {
/**
* Groups to skip in all vrt.
*/
const groupsToSkip: Set<string> = new Set(['Components/Tooltip']);
const groupsToSkip: Set<string> = new Set(['Components/Tooltip', 'Bullet Graph']);

/**
* Stories to skip in all vrt based by group.
Expand Down
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
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.
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
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.
38 changes: 38 additions & 0 deletions e2e/tests/bullet_stories.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { test } from '@playwright/test';

import { common } from '../page_objects/common';

test.describe('Bullet stories', () => {
test('renders single bullet', async ({ page }) => {
await common.expectChartAtUrlToMatchScreenshot(page)('http://localhost:9001/?path=/story/bullet-graph--single');
});

test('renders angular bullet', async ({ page }) => {
await page.setViewportSize({ width: 785, height: 800 });
await common.expectChartAtUrlToMatchScreenshot(page)('http://localhost:9001/?path=/story/bullet-graph--angular');
});

test('renders single row bullet', async ({ page }) => {
await page.setViewportSize({ width: 850, height: 800 });
await common.expectChartAtUrlToMatchScreenshot(page)('http://localhost:9001/?path=/story/bullet-graph--single-row');
});

test('renders single column bullet', async ({ page }) => {
await common.expectChartAtUrlToMatchScreenshot(page)(
'http://localhost:9001/?path=/story/bullet-graph--single-column',
);
});

test('renders grid bullet', async ({ page }) => {
await page.setViewportSize({ width: 785, height: 1000 });
await common.expectChartAtUrlToMatchScreenshot(page)('http://localhost:9001/?path=/story/bullet-graph--grid');
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"@semantic-release/npm": "^9.0.1",
"@semantic-release/release-notes-generator": "^10.0.3",
"@storybook/react": "^6.3.7",
"@types/chroma-js": "^2.0.0",
"@types/chroma-js": "^2.4.2",
"@types/classnames": "^2.2.7",
"@types/color": "^3.0.1",
"@types/core-js": "^2.5.2",
Expand Down
101 changes: 82 additions & 19 deletions packages/charts/api/charts.api.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/charts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"@popperjs/core": "^2.11.8",
"bezier-easing": "^2.1.0",
"chroma-js": "^2.1.0",
"chroma-js": "^2.4.2",
"classnames": "^2.2.6",
"d3-array": "^1.2.4",
"d3-cloud": "^1.2.5",
Expand Down
5 changes: 5 additions & 0 deletions packages/charts/src/_reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
svg text {
letter-spacing: normal !important;
}

html,
body {
font-family: Inter, BlinkMacSystemFont, Helvetica, Arial, sans-serif !important;
}
74 changes: 74 additions & 0 deletions packages/charts/src/chart_types/bullet_graph/chart_state.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React, { RefObject } from 'react';

import { BulletGraphRenderer } from './renderer/canvas';
import { canDisplayChartTitles } from './selectors/can_display_chart_titles';
import { getTooltipAnchor } from './selectors/get_tooltip_anchor';
import { getTooltipInfo } from './selectors/get_tooltip_info';
import { isTooltipVisible } from './selectors/is_tooltip_visible';
import { ChartType } from '../../chart_types';
import { DEFAULT_CSS_CURSOR } from '../../common/constants';
import { LegendItem } from '../../common/legend';
import { Tooltip } from '../../components/tooltip/tooltip';
import { BackwardRef, GlobalChartState, InternalChartState } from '../../state/chart_state';
import { InitStatus } from '../../state/selectors/get_internal_is_intialized';
import { LegendItemLabel } from '../../state/selectors/get_legend_items_labels';

const EMPTY_MAP = new Map();
const EMPTY_LEGEND_LIST: LegendItem[] = [];
const EMPTY_LEGEND_ITEM_LIST: LegendItemLabel[] = [];

/** @internal */
export class BulletGraphState implements InternalChartState {
chartType = ChartType.BulletGraph;
getChartTypeDescription = () => 'Bullet Graph';
chartRenderer = (containerRef: BackwardRef, forwardStageRef: RefObject<HTMLCanvasElement>) => (
<>
<BulletGraphRenderer forwardStageRef={forwardStageRef} />
<Tooltip getChartContainerRef={containerRef} />
</>
);

isInitialized = () => InitStatus.Initialized;
isBrushAvailable = () => false;
isBrushing = () => false;
isChartEmpty = () => false;
getLegendItems = () => EMPTY_LEGEND_LIST;
getLegendItemsLabels = () => EMPTY_LEGEND_ITEM_LIST;
getLegendExtraValues = () => EMPTY_MAP;
getPointerCursor = () => DEFAULT_CSS_CURSOR;
isTooltipVisible(globalState: GlobalChartState) {
return isTooltipVisible(globalState);
}

getTooltipInfo(globalState: GlobalChartState) {
return getTooltipInfo(globalState);
}

getTooltipAnchor(globalState: GlobalChartState) {
return getTooltipAnchor(globalState);
}

eventCallbacks = () => {};
getProjectionContainerArea = () => ({ width: 0, height: 0, top: 0, left: 0 });
getMainProjectionArea = () => ({ width: 0, height: 0, top: 0, left: 0 });
getBrushArea = () => null;
getDebugState = () => ({});
getSmallMultiplesDomains() {
return {
smHDomain: [],
smVDomain: [],
};
}

canDisplayChartTitles(globalState: GlobalChartState) {
return canDisplayChartTitles(globalState);
}
}
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { angularBullet, horizontalBullet, verticalBullet } from './sub_types';
import { Color, Colors } from '../../../../common/colors';
import { Ratio } from '../../../../common/geometry';
import { cssFontShorthand } from '../../../../common/text_utils';
import { withContext, clearCanvas } from '../../../../renderers/canvas';
import { A11ySettings } from '../../../../state/selectors/get_accessibility_config';
import { renderDebugPoint, renderDebugRect } from '../../../xy_chart/renderer/canvas/utils/debug';
import { ActiveValue } from '../../selectors/get_active_values';
import { BulletDimensions } from '../../selectors/get_panel_dimensions';
import { BulletGraphSpec, BulletGraphSubtype } from '../../spec';
import {
BulletGraphStyle,
HEADER_PADDING,
SUBTITLE_FONT,
SUBTITLE_FONT_SIZE,
SUBTITLE_LINE_HEIGHT,
TARGET_FONT,
TARGET_FONT_SIZE,
TITLE_FONT,
TITLE_FONT_SIZE,
TITLE_LINE_HEIGHT,
VALUE_FONT,
VALUE_FONT_SIZE,
} from '../../theme';

/** @internal */
export function renderBulletGraph(
ctx: CanvasRenderingContext2D,
dpr: Ratio,
props: {
debug: boolean;
spec?: BulletGraphSpec;
a11y: A11ySettings;
dimensions: BulletDimensions;
activeValues: (ActiveValue | null)[][];
style: BulletGraphStyle;
backgroundColor: Color;
},
) {
const { debug, style, dimensions, activeValues, spec, backgroundColor } = props;
withContext(ctx, (ctx) => {
ctx.scale(dpr, dpr);
clearCanvas(ctx, backgroundColor);

// clear only if need to render metric or no spec available
if (!spec || dimensions.shouldRenderMetric) {
return;
}

// render each Small multiple
ctx.fillStyle = backgroundColor;

// layout.headerLayout.forEach((row, rowIndex) =>
dimensions.rows.forEach((row, rowIndex) =>
row.forEach((bulletGraph, columnIndex) => {
if (!bulletGraph) return;
const { panel, multiline } = bulletGraph;
withContext(ctx, (ctx) => {
const verticalAlignment = dimensions.layoutAlignment[rowIndex]!;
const activeValue = activeValues?.[rowIndex]?.[columnIndex];

if (debug) {
renderDebugRect(ctx, panel);
}

// move into the panel position
ctx.translate(panel.x, panel.y);

// paint right border
ctx.strokeStyle = style.border;
// TODO: check paddings
if (row.length > 1 && columnIndex < row.length - 1) {
ctx.beginPath();
ctx.moveTo(panel.width, 0);
ctx.lineTo(panel.width, panel.height);
ctx.stroke();
}

if (dimensions.rows.length > 1 && columnIndex < dimensions.rows.length) {
ctx.beginPath();
ctx.moveTo(0, panel.height);
ctx.lineTo(panel.width, panel.height);
ctx.stroke();
}

// this helps render the header without considering paddings
ctx.translate(HEADER_PADDING.left, HEADER_PADDING.top);

// Title
ctx.fillStyle = props.style.textColor;
ctx.textBaseline = 'top';
ctx.textAlign = 'start';
ctx.font = cssFontShorthand(TITLE_FONT, TITLE_FONT_SIZE);
bulletGraph.title.forEach((titleLine, lineIndex) => {
const y = lineIndex * TITLE_LINE_HEIGHT;
ctx.fillText(titleLine, 0, y);
});

// Subtitle
if (bulletGraph.subtitle) {
const y = verticalAlignment.maxTitleRows * TITLE_LINE_HEIGHT;
ctx.font = cssFontShorthand(SUBTITLE_FONT, SUBTITLE_FONT_SIZE);
ctx.fillText(bulletGraph.subtitle, 0, y);
}

// Value
ctx.textBaseline = 'alphabetic';
ctx.font = cssFontShorthand(VALUE_FONT, VALUE_FONT_SIZE);
if (!multiline) ctx.textAlign = 'end';
{
const y =
verticalAlignment.maxTitleRows * TITLE_LINE_HEIGHT +
verticalAlignment.maxSubtitleRows * SUBTITLE_LINE_HEIGHT +
(multiline ? TARGET_FONT_SIZE : 0);
const x = multiline ? 0 : bulletGraph.header.width - bulletGraph.targetWidth;
ctx.fillText(bulletGraph.value, x, y);
}

// Target
ctx.font = cssFontShorthand(TARGET_FONT, TARGET_FONT_SIZE);
if (!multiline) ctx.textAlign = 'end';
{
const x = multiline ? bulletGraph.valueWidth : bulletGraph.header.width;
const y =
verticalAlignment.maxTitleRows * TITLE_LINE_HEIGHT +
verticalAlignment.maxSubtitleRows * SUBTITLE_LINE_HEIGHT +
(multiline ? TARGET_FONT_SIZE : 0);
ctx.fillText(bulletGraph.target, x, y);
}

ctx.translate(-HEADER_PADDING.left, -HEADER_PADDING.top);

const { graphArea } = bulletGraph;

if (spec.subtype !== BulletGraphSubtype.horizontal) {
ctx.strokeStyle = style.border;
ctx.beginPath();
ctx.moveTo(HEADER_PADDING.left, graphArea.origin.y);
ctx.lineTo(panel.width - HEADER_PADDING.right, graphArea.origin.y);
ctx.stroke();
}

withContext(ctx, (ctx) => {
ctx.translate(graphArea.origin.x, graphArea.origin.y);

if (spec.subtype === BulletGraphSubtype.horizontal) {
horizontalBullet(ctx, bulletGraph, style, backgroundColor, activeValue);
} else if (spec.subtype === BulletGraphSubtype.vertical) {
verticalBullet(ctx, bulletGraph, style, backgroundColor, activeValue);
} else {
angularBullet(ctx, bulletGraph, style, backgroundColor, spec, debug, activeValue);
}
});

if (debug) {
withContext(ctx, (ctx) => {
ctx.translate(graphArea.origin.x, graphArea.origin.y);
renderDebugRect(
ctx,
{
...graphArea.size,
x: 0,
y: 0,
},
0,
{ color: Colors.Transparent.rgba },
);
renderDebugPoint(ctx, 0, 0);
renderDebugPoint(ctx, graphArea.size.width / 2, graphArea.size.height / 2);
});
}
});
}),
);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

/** @internal */
export const TARGET_SIZE = 40;

/** @internal */
export const TARGET_STROKE_WIDTH = 3;

/** @internal */
export const BULLET_SIZE = 32;

/** @internal */
export const BAR_SIZE = 12;

/** @internal */
export const TICK_WIDTH = 1;

/** @internal */
export const MIN_TICK_COUNT = 3;

/** @internal */
export const MAX_TICK_COUNT = 8;

/** @internal */
export const HOVER_SLOP = 20;

/** @internal */
export const TICK_INTERVAL = 100;

/** @internal */
export const ANGULAR_TICK_INTERVAL = 120;
Loading