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(insights): allow customizing result colors with data color themes #26862

Merged
merged 159 commits into from
Jan 2, 2025

Conversation

thmsobrmlr
Copy link
Contributor

@thmsobrmlr thmsobrmlr commented Dec 12, 2024

Problem

Users want to be able to customize the colors in insights. Most often this is because multiple insights on the same dashboard should have the same color for the same values. See #23093 and #17593. But there are other use cases as well:

The ability to control the themes and colours of insights and dashboards would be helpful to contextualise them to end users, eg Blue for B2B , green for B2C etc.

Changes

This PR is the unstacked version of #26238, #26296, #26350 & #26522, with a recent version of master merged in and some fixes.

Summary of changes:

  • Everything is behind feature flag insight-colors for now.
  • You can edit the color of results in most trend and funnel insight visualizations, by opening a modal from the gear icon in the result table.
  • The colors are associated with the result either by name e.g. the breakdown value 'pizza' for the first series or by rank e.g. the third result.
  • You can create new themes in the settings area and also select a default theme there.
  • The theme for an individual insight can be specified with dataColorTheme prop on the insight query (no UI, yet).

Known shortcomings:

  • Colors that were set while not being in edit mode aren't persisted. This isn't addressed here as this is a broader issue that also affects other settings aside from colors.
  • There's no UI for setting the theme of an individual insight, yet.
  • Other insight types and visualizations don't support customizable colors yet e.g. world map trends, time-to-convert funnel, retention, lifecycle
  • The series indicator doesn't show the right color yet. This is due to existing issues with the indicator that were to unwieldy to fix in this PR.

How did you test this code?

Tested manually and added some automatic tests

@thmsobrmlr thmsobrmlr requested a review from a team December 16, 2024 16:18
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

16 snapshot changes in total. 0 added, 16 modified, 0 deleted:

  • chromium: 0 added, 16 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@PostHog PostHog deleted a comment from posthog-bot Dec 28, 2024
@thmsobrmlr thmsobrmlr removed the stale label Dec 28, 2024
thmsobrmlr and others added 2 commits December 31, 2024 13:04
# Conflicts:
#	frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom--light.png
#	frontend/__snapshots__/scenes-other-settings--settings-project--dark.png
#	frontend/__snapshots__/scenes-other-settings--settings-project--light.png
#	frontend/__snapshots__/scenes-other-settings--settings-project-with-replay-features--dark.png
#	frontend/__snapshots__/scenes-other-settings--settings-project-with-replay-features--light.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-all-options--dark.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-all-options--light.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-password-only--dark.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-password-only--light.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-github--dark.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-github--light.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-google--dark.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-google--light.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--dark.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--light.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-only--dark.png
#	frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-only--light.png
#	frontend/src/lib/constants.tsx
#	frontend/src/scenes/insights/utils.tsx
#	frontend/src/scenes/teamActivityDescriber.tsx
#	frontend/src/types.ts
#	posthog/migrations/max_migration.txt
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

16 snapshot changes in total. 0 added, 16 modified, 0 deleted:

  • chromium: 0 added, 16 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

)}
</div>
</>
)}
</div>
<ResultCustomizationsModal />
Copy link
Contributor

Choose a reason for hiding this comment

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

should we only show this in Edit mode? since the changes made outside it won't persist

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opted to not do so, since this is also happening for other settings. We should address that in a proper "edit mode" overhaul.

Copy link
Contributor

@anirudhpillai anirudhpillai left a comment

Choose a reason for hiding this comment

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

Looks great! Can't wait to get this into prod.

Just regarding discoverability of the feature (I might have missed other ways to find the modal), maybe we can change this edit icon to be the color glyph/circle so users can both recognise the label by matching the color + know there's something they can click without having to hover over the series
image

…l.tsx

Co-authored-by: Anirudh Pillai <anirudhx5@gmail.com>
@thmsobrmlr
Copy link
Contributor Author

Just regarding discoverability of the feature (I might have missed other ways to find the modal), maybe we can change this edit icon to be the color glyph/circle so users can both recognise the label by matching the color + know there's something they can click without having to hover over the series

Will do! In a follow up though, don't want to resolve merge conflicts any more here :D

@thmsobrmlr thmsobrmlr enabled auto-merge (squash) January 2, 2025 12:05
@thmsobrmlr thmsobrmlr merged commit c3b1949 into master Jan 2, 2025
97 of 99 checks passed
@thmsobrmlr thmsobrmlr deleted the data-color-themes branch January 2, 2025 15:32
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.

3 participants