Shopify/polaris-viz

Prevent decimal numbers in yaxis

gil-- opened this issue · 3 comments

gil-- commented

Feature request summary

Currently, Polaris charts show decimals in the yaxis even if no source data is in decimal form. An example is views where you'll never have 1.5 views but the y-axis still shows 0.5 or 1.5.

Would be great if there was a simple way to easily force whole numbers on the yaxis via yAxisOptions. Currently if I round the values to the nearest whole, I get duplicates like 0, 1,1, 2, 2, etc.

Example

CleanShot 2023-05-23 at 12 58 52@2x
envex commented

@gil-- Can you try setting integersOnly: true in yAxisOptions?

yAxisOptions={{
   integersOnly: true
}}
gil-- commented

@envex Thanks that worked! Sorry I missed that in the documentation.

envex commented

All good, glad I could help!