Skip to content

Commit

Permalink
add an offset to y-axis label in linechart
Browse files Browse the repository at this point in the history
  • Loading branch information
rita-morozova committed Nov 7, 2023
1 parent 12c5eb5 commit 972299e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/polaris-viz/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

<!-- ## Unreleased -->
## Unreleased

### Changed

- Added an offset to y-axis labels for `<LineChart />` to accommodate variations in font rendering

## [9.16.0] - 2023-10-17

Expand Down
3 changes: 2 additions & 1 deletion packages/polaris-viz/src/components/LineChart/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {
import {
ChartMargin,
ANNOTATIONS_LABELS_OFFSET,
Y_AXIS_LABEL_OFFSET,
CROSSHAIR_ID,
} from '../../constants';
import {VisuallyHiddenRows} from '../VisuallyHiddenRows';
Expand Down Expand Up @@ -316,7 +317,7 @@ export function Chart({

<YAxis
ticks={ticks}
width={yAxisLabelWidth}
width={yAxisLabelWidth + Y_AXIS_LABEL_OFFSET}
textAlign="right"
ariaHidden
x={yAxisBounds.x}
Expand Down
1 change: 1 addition & 0 deletions packages/polaris-viz/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const DEFAULT_LEGEND_HEIGHT = 24;
export const DEFAULT_LEGEND_WIDTH = 29;
export const BAR_CONTAINER_TEXT_HEIGHT = 48;
export const ANNOTATIONS_LABELS_OFFSET = 10;
export const Y_AXIS_LABEL_OFFSET = 2;
export const TOOLTIP_BG_OPACITY = 0.8;
export const COLLAPSED_ANNOTATIONS_COUNT = 3;
export const PREVIEW_ICON_SIZE = 12;
Expand Down

0 comments on commit 972299e

Please sign in to comment.