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

feat: Display stickiness data as percentages along with count #29030

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Sriram-bk
Copy link
Contributor

Problem

Update the stickiness insight to display the data as a percentage instead of the absolute account.

Closes #16342

Changes

Before

Screenshot 2025-02-20 at 4 41 14 PM

After

Screenshot 2025-02-20 at 4 38 38 PM

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

Visually tested locally.

@Sriram-bk Sriram-bk requested a review from a team February 20, 2025 21:42
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR adds percentage display functionality alongside absolute counts for stickiness insights, improving data visualization and interpretation.

  • Added percentage calculation in ValueColumnItem showing (value/count * 100).toFixed(1)% alongside original count values
  • Modified dataSorter in InsightsTable to handle stickiness data sorting by percentage (value/count)
  • Added showPercentView prop to LineGraph component to transform data points into percentages and format y-axis with % signs
  • Updated tooltip display in LineGraph to show both percentage and absolute values for stickiness data

4 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

formatPropertyValueForDisplay
{isStickiness ? (
<div>
<div>{((item.data[index] / item.count) * 100).toFixed(1)}%</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Potential division by zero if item.count is 0. Add a check to handle this case.

Suggested change
<div>{((item.data[index] / item.count) * 100).toFixed(1)}%</div>
<div>{item.count ? ((item.data[index] / item.count) * 100).toFixed(1) : '0'}%</div>

Copy link
Contributor

github-actions bot commented Feb 20, 2025

Size Change: +10 B (0%)

Total Size: 9.71 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 9.71 MB +10 B (0%)

compressed-size-action

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.

Show stickiness as percentage in addition to absolute count
1 participant