-
Notifications
You must be signed in to change notification settings - Fork 27
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
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.
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?
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.
@envex does this need any rethinking based on recent tooltip changes?
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 don't think so because this handles tooltips on it's own, not like the other charts.
Probably good to just spot check that it works fine on mobile and chart further down/to the left and right on the page
like you mentioned above.
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
53eb2f8
to
3ff9400
Compare
b98270e
to
9a2cee4
Compare
9a2cee4
to
587d4e2
Compare
@mollerjorge My understanding is that the tooltip percentages are the differences between the numbers in the tooltips, not the total chart numbers.
For this one, why don't you think we should show the dropoff section in the first tooltip? We don't show it in the last section because there's no dropoff at the last step, but there's a dropoff in the first step. |
@mollerjorge I paired with Pablo on the labels yesterday and just pushed up some changes that should make the labels more friendly on smaller screen sizes (font get's smaller and formatted values are hidden) |
0fdfa56
to
2e92b22
Compare
I see now, each bar chart has its own dropoff. What was a bit confusing to me was that I thought of it like this "ok I'm hovering over the first step in the funnel, why is there a dropoff here if its the first step? I was expecting to read the dropoff on the second bar" But I guess that's fine because the dropoff comes with each bar. Regarding the percentages, what does 87,62% mean in the screenshot I sent? 🤔 |
@mollerjorge I think (and it's been a while since I originally wrote it) is: We only calculate the dropoff: So our dropoff percentage is The
|
@michaelnesen the Funnel spark, truncation is too big, should be a lot smaller |
color={PERCENTAGE_COLOR} | ||
fontWeight={600} | ||
targetWidth={drawableWidth} | ||
fontSize={24} |
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 use a const for this and will it be different at different sizes at all?
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 confirm with Pablo 👀
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.
The main percentage font size is the same on different card sizes
} | ||
|
||
.Row { | ||
font-size: 12px; |
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 we want this to be a different size on mobile?
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.
Is this changing?
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.
Based off the Figma the tooltip size looks the same. I think Pablo has some thoughts but he is out. Just looking at some other charts, it doesn't look like font size change in tooltips on mobile, I can make a note about this and revisit with Pablo unless you have any strong opinions.
packages/polaris-viz/src/components/FunnelChartNext/components/Tooltip/Tooltip.tsx
Outdated
Show resolved
Hide resolved
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.
@envex does this need any rethinking based on recent tooltip changes?
packages/polaris-viz/src/components/shared/FunnelChartSegment/components/ScaledSegment.tsx
Outdated
Show resolved
Hide resolved
packages/polaris-viz/src/components/shared/FunnelChartSegment/components/ScaledSegment.tsx
Outdated
Show resolved
Hide resolved
3ab1c5a
to
c76072e
Compare
Added an animation for the scaled segment!
The chart container has a min-height property of 40px for spark charts that comes from the theme. In web, we override this property so it shouldn't be a problem
Added a tooltip for the scale icon 👍 |
9e2a5e8
to
57f2180
Compare
26e02c9
to
82dc4b4
Compare
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.
Almost there!
On this PR let's:
- finish cleaning up the types/names - remove references to xAxisLabels, remove tooltipLabels from the spark chart
Followup:
- Add tests for all new components that did not have them added on this PR
- Add error states for both charts - as far as I can see that wasn't done
packages/polaris-viz/src/components/SparkFunnelChart/SparkFunnelChart.tsx
Outdated
Show resolved
Hide resolved
packages/polaris-viz/src/components/FunnelChartNext/components/FunnelChartXAxisLabels.tsx
Outdated
Show resolved
Hide resolved
v1.0.0-funnel-chart-next-beta.1 v1.0.0-funnel-chart-next-beta.2 v1.0.0-funnel-chart-next-beta.3 Export SparkFunnelChart v1.0.0-funnel-chart-next-beta.4 Tweak tooltips
a482eb8
to
fe55d53
Compare
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.
🚢
let's make sure we add tests as a followup
I also had a comment back in October about handling negatives. Can you look into whether it will be possible for merchants to get into that state with this chart and if so, what we need to do?
@carysmills thanks for the reviews, here's a recap of what's done and the follow ups for future reference: RecapIn this PR
Follow ups |
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
Note
Have a sync with Pablo to finalize x axis labels on smaller screen sizes
Does this close any currently open issues?
Partially resolves https://github.com/Shopify/core-issues/issues/78198
What do the changes look like?
With scaling:
Also adds a
SparkFunnelChart
for smaller card sizesStorybook link
https://6062ad4a2d14cd0021539c1b-trqraxynco.chromatic.com/
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