Shopify / polaris-viz

A collection of React and React native components that compose Shopify's data visualization system
https://polaris-viz.shopify.com
Other
325 stars 24 forks source link

[Bug] Spark Line Chart 0 Data Height and Gradient is Inconsistent #1519

Closed clairedeboer closed 1 month ago

clairedeboer commented 1 year ago

Bug summary

Screenshot 2023-04-10 at 3 11 56 PM

The charts with 0 data have a line height and extra gradient that is not consistent with the charts that have data.

I think this needs to be fixed is Polaris Viz. We investigated the issue and it is happening in Polaris Viz as well as in web leading me to think that it needs to be fixed in Polaris Viz. https://shopify.slack.com/archives/CNB58FZ34/p1679407433716979

Expected behavior

Charts with 0 data should be consistent with charts that do have data.

Actual behavior

The chart for Online store conversion rate has 0 data but the line doesn't align with the Average order value chart which starts at 0 and the gradient is different.

Steps to reproduce the problem

  1. First step: Choose a small shop such as the default shop in Spin
  2. Second step: Go to this url: https://admin.web.web-minimal-u0qa.claire-deboer.us.spin.dev/store/shop1/marketing?attributionModel=last_click_non_direct

Reduced test case

The best way to get your bug fixed is to provide a reduced test case. This CodeSandbox template is a great starting point.

Specifications

Or run npx envinfo --system --binaries --browsers --npmPackages react,react-dom,@shopify/polaris-viz to provide specifications on your environment including version numbers, browser, device, and operating system.

Paste the results here:

System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 505.27 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.19.1 - /opt/dev/sh/nvm/versions/node/v16.19.1/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.19.3 - /opt/dev/sh/nvm/versions/node/v16.19.1/bin/npm
    Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
  Browsers:
    Safari: 16.3
  npmPackages:
    react: ^18.2.0 => 18.2.0 
    react-dom: ^18.2.0 => 18.2.0 
envex commented 1 year ago

This is a shot in the dark, but I think the charts aren't lining up because Session, AOV and Total sales have comparison data that is likely making the yAxis values larger.

So what's happening is the 0 value with no comparison data is rendering the 0 line half way up the container instead of along the bottom.