SimpleBarChart horizontal bars are truncated when trend indicators are present
Closed this issue · 1 comments
Bug summary
The width of the trend indicator is being subtracted from the length of the bar in <HorizontalBars>
, which causes bars with a trend indicator to be rendered at an incorrect scale.
![Screenshot 2023-06-28 at 16 15 54](https://private-user-images.githubusercontent.com/4888172/249616639-54f3a383-dafb-4642-b53e-10519af71ff0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1MTUyMjQsIm5iZiI6MTcyMDUxNDkyNCwicGF0aCI6Ii80ODg4MTcyLzI0OTYxNjYzOS01NGYzYTM4My1kYWZiLTQ2NDItYjUzZS0xMDUxOWFmNzFmZjAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MDlUMDg0ODQ0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9M2Y1NDllYzkxMmViOTM2MTg0YzUyMzM2MmEyMGIzYTUzMTFjODM3YWFmYmY1MjMwYWRjNDI1MTkxODRhNzU5YSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.m5f-PIYi-vYg8FPucokdA0R2_eQDeiwZielkN42Su9c)
Expected behavior
The horizontal scale of the chart should take trend indicators into account, instead of subtracting the width of the trend indicator (when present) from a horizontal bar.
Actual behavior
The horizontal scale is calculated without trend indicators, and bars that have a trend indicator are shortened by an amount equal to the width of the trend indicator. This can cause bars that represent the same value to have different lengths:
Steps to reproduce the problem
- Create a
<SimpleBarChart>
that has a couple of data points with the same value - Add a trend indicator for one of the data points
- The bars will be different sizes even though they represent equivalent values
Reduced test case
In the following CodeSandbox, all three bars have equivalent values but the bars with trend indicators are rendered at a different size:
https://codesandbox.io/s/trend-indicator-scale-issue-c5chmv?file=/src/index.tsx
Specifications
- Polaris-Viz version number:
9.4
- Browser: Chrome
- Device: MacBook Pro M1 Pro
- Operating System: macOS Ventura 13.4