Skip to content
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

Allow multi hover on metric graphs (v2) #1077

Merged
merged 8 commits into from Mar 15, 2023

Conversation

bryce-fitzsimons
Copy link
Member

This is a rework of the following PR:
#1075

It uses an external state rather than internal messaging between graphs. It also bases external state on date rather than X position, which allows for graphs that my have different X axes. It also enables northstar hover sync.

@github-actions
Copy link

github-actions bot commented Mar 14, 2023

Your preview environment pr-1077-bttf has been deployed.

Preview environment endpoints are available at:

scaleLinear<number>({
domain: [
0,
Math.max(...data.map((d) => Math.min(d.v * 2, d.v + (d.s ?? 0) * 2))),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to support binomial here again?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not specifically no. d.v (datapoint's value) will capture what we need for a binomial variable.

Comment on lines +86 to +118
<>
{type === "binomial" ? (
<div className={styles.val}>
<em>n</em>: {Math.round(d.v)}
{smoothBy === "week" && (
<sub style={{ fontWeight: "normal", fontSize: 8 }}> smooth</sub>
)}
</div>
) : (
<>
<div className={styles.val}>
{method === "sum" ? `Σ` : `μ`}:{" "}
{formatConversionRate(type, d.v as number)}
{smoothBy === "week" && (
<sub style={{ fontWeight: "normal", fontSize: 8 }}> smooth</sub>
)}
</div>
{"s" in d && method === "avg" && (
<div className={styles.secondary}>
{`σ`}: {formatConversionRate(type, d.s)}
{smoothBy === "week" && (
<sub style={{ fontWeight: "normal", fontSize: 8 }}> smooth</sub>
)}
</div>
)}
<div className={styles.secondary}>
<em>n</em>: {Math.round(d.c)}
</div>
</>
)}
<div className={styles.date}>{date(d.d as Date)}</div>
</>
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tooltip contents are pretty difficult to parse, not sure if it's because of the existing Datapoint and how it has properties like v, s, etc. I think this function probably warrants an explanation comment that maybe includes an example of the output.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decided to push this out a bit since it will probably change again once we address ratio metrics.

Copy link
Contributor

@tinahollygb tinahollygb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-reviewed. I see the eslint disable has been removed, thanks for that. ✅

Copy link
Contributor

@lukesonnet lukesonnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

<>
{type === "binomial" ? (
<div className={styles.val}>
<em>n</em>: {Math.round(d.v)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed offline, technically you don't need to round this as it could show the smoothing better, but it could also be confusing for some users, so I think rounding makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i think rounding makes most sense from a UI perspective. It's weird to say that on Wednesday we had 3.62 users convert.

@bryce-fitzsimons bryce-fitzsimons merged commit cb8e007 into main Mar 15, 2023
@bryce-fitzsimons bryce-fitzsimons deleted the allow-multi-hover-on-metric-graphs-2 branch March 15, 2023 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants