Skip to content

Commit

Permalink
Merge pull request #1601 from Shopify/rita-morozova/update-y-axis-lab…
Browse files Browse the repository at this point in the history
…el-width

Adds an offset to y-axis label in LineChart
  • Loading branch information
rita-morozova authored Nov 7, 2023
2 parents 28f68f9 + 972299e commit 074cb47
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.17.1] - 2023-11-07

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 074cb47

Please sign in to comment.