-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UA: Adding FunnelChartNext #1733
base: main
Are you sure you want to change the base?
Conversation
8316d3e
to
2dc5f46
Compare
size-limit report 📦
|
c72c654
to
7af7534
Compare
Looks good to me. A few things:
|
how do we specify what the summary % is? is it just the bottom of the funnel?
are all the rates calculated in the front end? This is informational because we need to be able to have an open and closed funnel with different session counts that calculate different rates (without needing to introduce different metrics) Yes, those are calculated on the front-end, but if the API will give us those values, we can just accept strings/numbers. how would the comparisons look? No clue. Any thoughts @pabmtl not important: but in the example, it looks like the reached next step and dropped off are flipped Can you post a screenshot of what's flipped? |
This sounds good to me. Just to clarify: For a visualization like this, the API should only need to provide the count values (i.e., |
@pabmtl I'm not seeing updated steps. Also, the hover interaction being in the entire section is how the tooltips work on all the other charts, so I don't think we want to deviate from that. |
@envex here's a screenshot |
7af7534
to
f75c242
Compare
Ahh, the labels and everything we set via web, so if they're wrong in storybook that's fine, we can change them when we implement in web. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will go through the code soon, but from 🎩
- it feels a bit weird when both these tooltips show up, or at least when they overlap
- Is it intentional there's no tooltip on the first 100% bar?
- Sparkchart isn't showing up for me with just today's data
- Can we check accessibility handling? Right now tabbing through the main chart just goes to the connectors. I don't see an aria-label on the spark one
- The text gets a bit squishy at small widths and will be worse in some other languages/with other values. Any thoughts?
Going to look into this. I'm thinking we shouldn't try and use the same
Yes
I'll dig in
According to the Figma it should truncate, but we can run it by UX |
According to the Figma it should truncate, but we can run it by UX I think updating to the new labels will help with this. |
Those secondary hovers on the transition portion can also be removed, we should keep them as part of the code as a prop if marketing needs to use them and have them show by default with no interactions |
Those labels will come from the API, we don't do any conversion, so if the labels in the API aren't changing we won't get any new benefit. |
@MeredithCastile mentioned that this was already in progress. I'll circle back with her when she gets back.
…On Wed, Oct 16, 2024 at 1:02 PM Matt Vickers ***@***.***> wrote:
The text gets a bit squishy at small widths and will be worse in some
other languages/with other values. Any thoughts?
According to the Figma
<https://www.figma.com/design/zYBKEXuelQ4eSSkyhuc9s7/%E2%9A%A1%EF%B8%8F-FUNNEL-UPDATES?node-id=717-19863&node-type=frame&t=pi3sMx4AU2ywAJCv-0>
it should truncate, but we can run it by UX
I think updating to the new labels will help with this.
Those labels will come from the API, we don't do any conversion, so if the
labels in the API aren't changing we won't get any new benefit.
—
Reply to this email directly, view it on GitHub
<#1733 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AN6Z4NRGZU4E2BDCM2B6Q63Z32L3RAVCNFSM6AAAAABPMGJOOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJXGQYTKMBWGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
*Pablo Boerr*
Staff Product Designer
[image: Shopify]
<https://www.shopify.com/?utm_medium=salessignatures&utm_source=hs_email>
|
@pabmtl Awesome! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments from a first pass, but will need to go over this again later, when you've responded to the first comments.
I didn't leave this comment everywhere, but let's move out the pixel values, colours and constants currently at the top of files into a constants file for this chart.
Related to our chat yesterday: what do you think about making a new directory for this chart (and possibly future others) that's called experimental or something, so we indicate to any other consumers of the repo that the chart and API are unstable? Could also indicate that in the changelog
Can we add any tests that would be helpful?
@@ -0,0 +1,3 @@ | |||
export function calculateDropOff(value: number, nextValue: number) { | |||
return ((nextValue - value) / value) * 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should calculate this in the viz or if it should be passed in 🤔 I'm fine with keeping it as is for now, but maybe something to consider for a more refined version of the chart. I'm wondering if the dropoff might ever be calculated differently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked about getting this from the API but Willie suggested we keep it on the front-end (for now at least).
rawValue: number, | ||
yScale: ScaleLinear<number, number>, | ||
) { | ||
const rawHeight = Math.abs(yScale(rawValue) - yScale(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll never have a negative bar value, right? I think this might fall apart if we did
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll "clamp" it to MIN_BAR_HEIGHT
if it's negative.
I think in the future we may want to support negative, but for now 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we end up letting users use this for unexpected data, like the example we've seen, we'll need there to be proper handling for negatives.
} | ||
|
||
export function SingleTextLine({ | ||
ariaHidden = false, | ||
color, | ||
dominantBaseline = 'hanging', | ||
fontSize = FONT_SIZE, | ||
fontWeight = 400, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're adding a font weight in the constants, so it feels weird that this is defaulting to a different weight
fontFamily={FONT_FAMILY} | ||
y={y} | ||
x={x} | ||
> | ||
{truncated} | ||
</text> | ||
<title>{text}</title> | ||
{willTruncate && <title>{text}</title>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check our other uses of this to ensure the changes don't break any existing text?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this change it would always display the title so we default to true
. There should be no change aside from my new case that I pass false
to willTruncate
formatPositionForTooltip: (index: number) => TooltipPosition; | ||
} | ||
|
||
export function getTooltipPosition({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There have been some bugs lately with tooltip positions in notebooks and on the dashboard. Can we make sure we test this with the chart further down/to the left and right on the page?
|
||
function formatPositionForTooltip(index: number | null): TooltipPosition { | ||
// Don't render the tooltip for the first bar | ||
if ((index === 0 && xAxisOptions.hide === false) || index == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to check xAxisOptions.hide === false
? Can't we just check the index?
const LINE_GAP = 5; | ||
const LINE_PADDING = 10; | ||
const GROUP_OFFSET = 10; | ||
const LABEL_FONT_SIZE = 12; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could also move these to a constants file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I thought about that but they're only used in this file so moving them felt a little off.
packages/polaris-viz/src/components/FunnelChartNext/components/FunnelChartXAxisLabels.tsx
Outdated
Show resolved
Hide resolved
packages/polaris-viz/src/components/FunnelChartNext/components/FunnelChartXAxisLabels.tsx
Outdated
Show resolved
Hide resolved
d5b36f6
to
53eb2f8
Compare
53eb2f8
to
3ff9400
Compare
What does this implement/fix?
Adding
FunnelChartNext
andSparkFunnelChart
.Eventually
FunnelChartNext
will replace the currentFunnelChart
, but for the sake of speed, we're going to support 2 versions.Figma
Doc
Does this close any currently open issues?
Partially resolves https://github.com/Shopify/core-issues/issues/78198
What do the changes look like?
Also adds a
SparkFunnelChart
for smaller card sizesStorybook link
https://6062ad4a2d14cd0021539c1b-lugmjeekld.chromatic.com/?path=/story/polaris-viz-charts-funnelchartnext--default
Before merging
Check your changes on a variety of browsers and devices.
Update the Changelog's Unreleased section with your changes.
Update relevant documentation, tests, and Storybook.
Make sure you're exporting any new shared Components, Types and Utilities from the top level index file of the package