Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(bi): improve worksheet editing and chart customization (#118626)

Marius Andra12de55109dd3
diff --git a/docs/published/handbook/engineering/data-warehouse.md b/docs/published/handbook/engineering/data-warehouse.md
index a8ae1690d385..6ce95061785e 100644
--- a/docs/published/handbook/engineering/data-warehouse.md
+++ b/docs/published/handbook/engineering/data-warehouse.md
@@ -32,7 +32,7 @@ Returning to a notebook can reuse completed query results from the last two minu
**Business intelligence** lists saved worksheets at `/bi` when the `sql-editor-bi-mode` feature flag is enabled. Search all worksheets or switch to those viewed in the last 30 days. **New worksheet** opens `/bi/new`; selecting a saved worksheet opens `/bi/<short_id>` in edit mode. The project tree's **New → Worksheet** entry opens the same editor. Worksheets retain their insight identities and folder placements, but use their own file subtype and no longer appear in the Product analytics insights list. Legacy `/bi?open_insight=...` links and shared worksheet URLs still open the editor. Business intelligence and SQL keep separate unsaved working copies, and existing SQL editor links with `mode=bi` open in Business intelligence.
-Choose a connection in the **Data** panel, then select a table below it. Certified sources have a checkmark beside their table icon and appear first within their folders, and folders containing certified sources are prioritized. Deprecated sources have a warning icon. Hover over either status icon for details. Deprecated and uncertified sources remain selectable; search preserves the same ordering. **Run** is the first toolbar action, before **Swap rows and columns**.
+Choose a connection in the **Data** panel, then select a table below it. Certified sources have a checkmark beside their table icon and appear in a separate **Certified sources** folder. All table folders can be expanded and collapsed, including while searching. Deprecated sources have a warning icon. Hover over either status icon for details. Deprecated and uncertified sources remain selectable; search preserves the same ordering. **Run** is the first toolbar action, before **Swap rows and columns**.
**Charts** opens chart types and series controls in the right panel. **Analysis** and the visualization settings button replace that panel with their own controls. The panel starts closed. Close it after editing to return to the chart. The Series/Display settings use the same panel and scroll independently. Row filters appear once above the chart; click a filter to edit it. **AND / OR groups** opens the grouping dialog, and **Result filters** opens a popover. The left pane contains the selected source and its dimensions and measures; **Fields** hides or restores it. The toolbar wraps as the worksheet narrows, and the right panel overlays the chart when there is not enough space to dock it. These layout changes apply only to BI worksheets; SQL and other insights retain their existing settings layout.
@@ -40,9 +40,15 @@ Choose a connection in the **Data** panel, then select a table below it. Certifi
Panes share their value scale by default; **Independent value scales** lets each pane scale separately. Charts with a secondary value axis use independent scales. Reference lines can calculate **Within each pane** or **Across the worksheet**; worksheet calculations use all returned marks, including panes beyond the display cap. Panes support up to 24 charts, 1,000 axis values, and 50 measure/color series, with explicit messages when those limits apply. Narrow worksheets stack the panes. Saved worksheets, shared views, and dashboard tiles retain the layout and apply dashboard filters before splitting the result; each pane uses the same query response. Period comparison must be turned off to use panes.
+**Add filter** offers searchable table fields alongside a custom expression option. Value filters retain loaded choices while refreshing so you can select several values without waiting for the list to reload. Closing an untouched custom filter discards it.
+
+Use **Add calculated field** beneath Measures or **+ Field** on a shelf. The editor shows SQL validation progress and infers the return type; you can override the type of a dimension. Cmd+Space (Ctrl+Space on Windows or Linux) opens field autocomplete.
+
+The Series panel accepts custom colors for individual breakdown values. Display settings control value-label placement, background, size, and rotation, and bar spacing can be set to **None** for adjoining bars. The legend-position selector sits beside its label.
+
Single-value filters distinguish selecting **(empty string)** from clearing the input: the former matches an empty value, while the latter removes the condition.
-Date dimensions sort oldest first by default, including in tables; explicit sorts still take precedence. Generated date dimensions retain their result-column identity, including expressions over column names containing spaces. Time charts show years centered below their date ticks. Clicking a bar opens the drill-down options for that result.
+Date dimensions sort oldest first by default, including in tables; explicit sorts still take precedence. Generated date dimensions retain their result-column identity, including expressions over column names containing spaces. Time charts show years at the start of each year below their date ticks, omitting labels that would overlap. Axis settings let you enter a date format such as `MMM YYYY` or `YYYY-MM-DD` and rotate tick labels. Hiding ticks preserves the axis title. Clicking a bar opens the drill-down options for that result.
**Auto update** is off by default and remembers your choice. Selecting a table leaves a blank worksheet, even with auto-update enabled. The blank worksheet offers **Start with daily row count** when a date field is available, or **Start with row count** otherwise. The suggestion adds fields only when clicked and respects auto-update. Identifier fields such as `person_id`, `distinct_id`, and `user_id` appear as measures and default to Count; their shelf menu can convert them to dimensions or change the aggregation. A worksheet with dimensions and no selected measure shows **Count of rows** on its shelf and value axis. Turning auto-update off keeps the current result; **Run** applies pending changes.
@@ -56,7 +62,7 @@ In the BI editor, click scatter points to toggle selection or drag a rectangle i
Drag the right edge of the fields pane to resize it. Docked panes each take at most a quarter of a wide worksheet, leaving at least half the width for the chart. Less frequent worksheet actions, including **Save a copy**, **Save as SQL view**, and **Discard changes**, are in the worksheet actions menu beside **Share**.
-BI usage keeps the existing `sql-editor-bi-mode-selected`, `sql-editor-bi-query-run`, and `sql-editor-bi-query-saved` events. Their properties describe table calculations, Top N, comparisons, formatting, axes, totals, and related/property field counts. The `bi-worksheet-action` event's `action` property defines the funnel: `opened`, `source_selected`, `first_chart`, `saved`, `added_to_dashboard`. The first chart is the first nonempty successful result per editor visit; reruns and failures do not count again. Saved and dashboard steps include `insight_id`. Additional actions record drill-down choices, related-table expansion, and property browsing/search. These events exclude SQL, source names, field names, formulas, search text, filter values, and result contents.
+BI usage keeps the existing `sql-editor-bi-mode-selected`, `sql-editor-bi-query-run`, and `sql-editor-bi-query-saved` events. Their properties describe table calculations, Top N, comparisons, formatting, axes, totals, and related/property field counts. The `bi-worksheet-action` event's `action` property defines the funnel: `opened`, `source_selected`, `first_chart`, `saved`, `added_to_dashboard`. The first chart is the first nonempty successful result per editor visit; reruns and failures do not count again. Saved and dashboard steps include `insight_id`. Additional actions record drill-down choices, related-table expansion, property browsing/search, calculated-field saves, and changed chart-setting keys. These events exclude SQL, source names, field names, formulas, search text, filter values, and result contents.
**Undo** and **Redo** restore shelves, filters, calculations, formatting, chart settings, and worksheet names. The editor keeps the last 100 changes during a visit; opening another worksheet or discarding changes starts a new history. Use Cmd/Ctrl+Z and Cmd/Ctrl+Shift+Z outside text inputs. Undo respects **Auto update**: with it off, click **Run** to refresh results. **Save a copy** creates a separate worksheet and opens it in the editor without changing the original or copying its dashboard placements. Copy failures leave the original and your edits in place. Usage tracking adds `undo`, `redo`, and `copied` actions.
@@ -96,7 +102,7 @@ Pivot tables display every measure beneath nested column headers. Expand or coll
**Hierarchies** in the data pane names an ordered set of dimensions, such as Country → State → City. Create a hierarchy with 2–10 levels, then start it on rows or columns. The level list marks the current field and shows the next levels. Selecting a result offers **Drill to** the next level in the current editor worksheet, retaining parent filters, date range, measures, variables, and formatting. The path above the result offers **Drill up**, removing only filters introduced by that drill. Navigation participates in undo/redo and respects Auto update. Changed or removed hierarchy levels disable an incompatible return path. Outside the editor, the action explicitly opens a new worksheet. Leaf values and levels already on a shelf do not offer another drill action; nested pivot expansion remains available for those shelves. Definitions stay with the saved worksheet and survive **Clear sheet**. **Import from worksheet** copies a hierarchy from an accessible saved worksheet using the same table and connection. The copy is independent: edits do not change the source worksheet or create global fields. Deleting a local calculated field removes its uses from hierarchy levels, dropping definitions with fewer than two remaining levels.
-The **Analysis** card ranks **Top N** categories by a selected measure across the full current date range. **Include "Other"** combines the remaining source rows and re-aggregates them, including averages and distinct counts. Removing the ranking measure turns Top N off. Previous-period comparisons use the current period's category selection. Tables offer a grand total; pivot tables offer row and column grand totals. Both support hierarchy subtotals when an axis has multiple dimensions. Totals re-aggregate source rows; table-calculation cells remain blank on total rows. Summary rows can occupy at most half the result limit, reserving room for detail cells. The BI visualization requests an extra row to determine whether more results exist, then removes it before building tables and charts. Saved SQL and exports retain the worksheet's configured limit. A notice identifies confirmed extra groups. At the 50,000-row execution cap, it instead says more groups may exist because the extra-row probe cannot complete. The **Aggregated rows** limit applies after aggregation, not to scanned source rows. Limited results can make totals, rankings, running totals, and comparisons incomplete; narrow filters or increase the limit where possible.
+The **Analysis** card ranks **Top N** categories by a selected measure across the full current date range. **Include "Other"** combines the remaining source rows and re-aggregates them, including averages and distinct counts. Removing the ranking measure turns Top N off. Previous-period comparisons use the current period's category selection. Tables offer a grand total; pivot tables offer row and column grand totals. Both support hierarchy subtotals when an axis has multiple dimensions. Totals re-aggregate source rows; table-calculation cells remain blank on total rows. Summary rows can occupy at most half the result limit, reserving room for detail cells. The BI visualization requests an extra row to determine whether more results exist, then removes it before building tables and charts. Saved SQL and exports retain the worksheet's configured limit. A notice identifies confirmed extra groups. New worksheets default to 50,000 aggregated rows. At the 50,000-row execution cap, it instead says more groups may exist because the extra-row probe cannot complete. The **Aggregated rows** limit applies after aggregation, not to scanned source rows. Limited results can make totals, rankings, running totals, and comparisons incomplete; narrow filters or increase the limit where possible.
Each measure's **Format and display** dialog sets its label, currency, decimal precision, abbreviation, percentage format, and suffix. Percentage formatting expects fractional values (0.25 displays as 25%); percent-of-total and percent-change calculations produce that scale automatically. Formats persist in saved insights and apply to charts, tables, and pivot cells. The **Charts** panel exposes series style and left/right axis selectors for each measure. Bar, line, and area charts support these mixed styles and axes. **Combine line + bar** assigns two measures to separate axes with bar and line styles.
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index ea4025dd1942..dbebd5b0f608 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -943,7 +943,7 @@ snapshots:
components-hogcharts-barchart--centered-percent-labels--dark:
hash: v1.k794b7964.60f4a628575f2da4319012ef6739295c8770896eda280b524aebff50d922d71f.FLjvfqZnCF-Q0jrowwqqMKyNZs5T2kAEgEipzqzgwD4
components-hogcharts-barchart--centered-percent-labels--light:
- hash: v1.k794b7964.572660477aadfd7d9ee130c2479d3b92ee76de5722d420cc58c330f3f11dfaa2.lqYOYexwYpUW9ih2jrhOSh5eAOGrif4qNgM3h0kJmYU
+ hash: v1.k794b7964.4707dee8b58fdc71b5b881f309cd6cb5bd3e8ca0dd88b74cd4f24f5b0901a2bc.-5aVybx8SIEFBuRNALGRvAmCHnwBzSRSHzLGi0mUJAk
components-hogcharts-barchart--custom-corner-radius--dark:
hash: v1.k794b7964.6372b0bd7515a508d5810e2a9a226b120ee60e9a69338a8b1716a770037d4251.pK-VaT_sJRRdgQo4ou0pVzkEeNHgT60UEMa0K5VKIQg
components-hogcharts-barchart--custom-corner-radius--light:
@@ -1549,9 +1549,9 @@ snapshots:
components-hogcharts-valuelabels--cross-series-overlap-removal--light:
hash: v1.k794b7964.a1862c066978953569c2c3f1e47871cb8a908d750386346ee8f369dcadfb07b2.zlILn4JpYZjujCzoj0yTEE4kAUOOx7N1RUMQOPxHt6w
components-hogcharts-valuelabels--dual-y-axes--dark:
- hash: v1.k794b7964.321570e25db89e5c12afae2d200ddf160069153823bb7b4e921d8f4d25b194c7.g3w8uOfZe7He0S1BquSqSsMfmZh1IYJ40E2fWqsIQrc
+ hash: v1.k794b7964.6059844473ca2a1f55f78dc1507312b9739cedb1f99adfbaa944ede68c31506c.By5NNDUKpB8WeXFaP4GB9USFVlV3VGFlSt47WKzQPGE
components-hogcharts-valuelabels--dual-y-axes--light:
- hash: v1.k794b7964.1dfde748ee41fe261f8f223524fe6affa0db8b5df0f0e8fbb2da1f17ed872ad2.pFDiui4rfGvJ2g_pJF32GbVM0Y3HbS3VHgkEqrsO1_Y
+ hash: v1.k794b7964.dc843fa9b848bb1e8525852b9accc2b4417a068f1eb9e15e0f039c50b358af62.wBYVfGBuXnXaWPb6jC6CaGT-aLJummb8FGrSNuNnsdA
components-hogcharts-valuelabels--hidden-on-auxiliary-series--dark:
hash: v1.k794b7964.56c30b942a282f104cfdb14cfafe76862bd1252b14ed96a60c62cff368ee4d6f.-TIBE9N0EqlTjZQoJNID_We0ityhC7uwZKS0u5UnqDo
components-hogcharts-valuelabels--hidden-on-auxiliary-series--light:
@@ -1564,6 +1564,10 @@ snapshots:
hash: v1.k794b7964.48bc9f70fece54b233f4e666a5207ead54bd6de1dcb9f9fb38c2ed9e39ffee93.-tPJLsJtrWzeuVqVvuREwf-lWd5-IomuJOc3nEFRK3g
components-hogcharts-valuelabels--negative-values--light:
hash: v1.k794b7964.6900557e2f31fcf903023363173cc46f36894bc56a47ab951a71af364ce0805d.jYJoVOPvmPgQBUfSBI_1Ism8Ls1_XwnOBOq2hDIq3QQ
+ components-hogcharts-valuelabels--plain-rotated-labels--dark:
+ hash: v1.k794b7964.d18f92ee70b7c845a6381b02c0a17dc9ab75515295fa8437e2a63195615e6126.GLZuCXzZ74uuV3RIZerEWIDgFTsmDmBs_1834ctU33E
+ components-hogcharts-valuelabels--plain-rotated-labels--light:
+ hash: v1.k794b7964.9bc6ec095cd16ed299da8c0a4b1868bccbf118228b52f39cdfe41a6d25409d63.atzmdCi-CkQzkOoyacw3hSACqRHL78zybFoKPQUEsnc
components-hogcharts-valuelabels--single-series--dark:
hash: v1.k794b7964.73ef899ec3c2c18365125d872564d6658075b0d37aaf80bacc990f4c460e44e7.yizvuYDzc5V0P-vECCQofVUdGpnpnNNkMlC0yet1oOo
components-hogcharts-valuelabels--single-series--light:
@@ -4040,6 +4044,10 @@ snapshots:
hash: v1.k794b7964.198d11e486296652fca6921ecf76d8627a8257f3c94df2a2198919c87b76b502.fMwrM7mMAlzwrf5aFt-6YLfILYVbyM4yu9qhyUT8MbQ
insights-sqlbargraph--horizontal-bar--light:
hash: v1.k794b7964.eb99bf633cae565be567f33a544ce22c9ffe728585e64b1ca23b7933df751e6d.RuuY0Z82oyFutR0tkY7wZGvOH2_oKY-E6mwehd2wky4
+ insights-sqlbargraph--inside-labels-without-gaps--dark:
+ hash: v1.k794b7964.944cf8ad56b1e4250f7f46d23d47b3634de78a504751627c325484bff625d927.5OpSGfN8FuHZHdeEzxkEytdqUYUGngBuHueL72IaZb4
+ insights-sqlbargraph--inside-labels-without-gaps--light:
+ hash: v1.k794b7964.0a5f2e4791114057376c96606730119a6e5ec4625ada33f24c0716919b92a778.4MACtsN628cqmrYXP2w3vwzNHiqg9pgZdil5-p5iQxs
insights-sqlbargraph--stacked-bar--dark:
hash: v1.k794b7964.213a5a22d4f777cf9f8ffa14d648b85b5b1949d0a2c96c476be9011736b5183b.liwM0IzwJRoqi0PSOuGNiaWpcLTPexevSaGc3FyxYHI
insights-sqlbargraph--stacked-bar--light:
@@ -4139,7 +4147,7 @@ snapshots:
insights-trendsbarchart--percent-stack-breakdown--dark:
hash: v1.k794b7964.046f791048d4655c476f51183e9a66407254454b212a5baea3a3b83e064d9158.TzawVdEXdhxkkJI27s7ny79xLx3ShBC9-KnI5VdXr8I
insights-trendsbarchart--percent-stack-breakdown--light:
- hash: v1.k794b7964.9a50b97294d8a7228be13c0064c6809fae331ea4abd560449d750278d00b05bf.1vFNYZKipEwkTlyMenuRnlOxmSu2Gz_Yvv6Q9VUDSIc
+ hash: v1.k794b7964.91fcace334c871ececa9545d73dfcb7d0157e226198204238e15a517da01ff6d.NkyQskFsFGmtWt9HUTlinBrm2oBYqx_EQnLyTPrgg2A
insights-trendslifecyclechart--stacked--dark:
hash: v1.k794b7964.9b7200dbe5ae56c7aca6ea4705dc9543565b3b4787d96e1d4799641ab339fd5b.-IThm9SYaJEibHZKiOXnmHG4OvJjd62mXSmpsvFDVZQ
insights-trendslifecyclechart--stacked--light:
@@ -4151,7 +4159,7 @@ snapshots:
insights-trendslifecyclechart--stacked-with-percentages-on-series--dark:
hash: v1.k794b7964.833750b3bf26d1516d32cb13899c1d6637a564895cf718da7fedff3516812f3d.rK_IJOyIWAQYsu6QJjo5wzgQzzIRQptjvw5--DgcGgM
insights-trendslifecyclechart--stacked-with-percentages-on-series--light:
- hash: v1.k794b7964.92619de568e4891bad499c4bbec51478106e826e9268d520c9d58cc46fc0cc92.KfQLrZQodqqVtTqacVTyEnu7t6hSNqfEaQ9WrqIlXA8
+ hash: v1.k794b7964.bb77d8b6dbf8b2fe971cbebca86d2735878b1425ce49e12f33f797fca9823fb3.JnA4D2Z1OXUhyInPg1mi0IYNu0fB59TdDOZp8__qHCU
insights-trendslifecyclechart--stacked-with-percentages-only-on-series--dark:
hash: v1.k794b7964.aba59a2880cee663ac197ef65540800d35827a906937280063c7f01db88a91fa.NC1SGQY0KYcF5Hc-CWnX9gUqojIeTftIPnxYycK_PWM
insights-trendslifecyclechart--stacked-with-percentages-only-on-series--light:
@@ -4167,7 +4175,7 @@ snapshots:
insights-trendslifecyclechart--unstacked-with-values-on-series--dark:
hash: v1.k794b7964.b6eec3fece56481aa77ce04a7f255edb3690eeab6f260af96c501e10e6adf128.7O58CTU0HEe8N9tlE3Olk2lC-ekHObUn8gWR9nhDjes
insights-trendslifecyclechart--unstacked-with-values-on-series--light:
- hash: v1.k794b7964.6c71c20be15a86766dbaf8ab90692d2a5e4cb41f9f1ad3e59bdaaed6f7d9f332.YtqIx4Sch8iAet_tYxbUKUSavAIRk01NxDUsOjCmsj8
+ hash: v1.k794b7964.316a2ee489dd91f38450f3e2c92a14e395a1348d0034dff54f97247632e1cac1.7J-l-VxzHhZOEtwaFh83ESGJIFgKgJtsuccKZkEDQmw
insights-trendslinechart--area--dark:
hash: v1.k794b7964.31e5f6c5a91bae89b683d6fe6302018c9caa639057c03f349253152df89f737b.j3pAvgT-mPE337hQoem_e1h9SZ9kl_J7vGWdQHnuzA8
insights-trendslinechart--area--light:
@@ -5080,6 +5088,10 @@ snapshots:
hash: v1.k794b7964.2a5d49e70e0d284a65ff0ec671063ba0bf2e60eeb6bbc63715ff2bf7bcbc29d7.XUTByC9kY8ePrW29fgJNIKnHCWvn_Z2ZC07pk5EIsOA
lemon-ui-lemon-color-lemon-color-picker--show-custom-color--light:
hash: v1.k794b7964.9156f2765f1efeea15d870e08faf5d4c90a64f1138ac36296a2f283bf1078b24.WndYB_kQVe68ZUhu048I4qn9K7M1vfxgFC4JP2wM42s
+ lemon-ui-lemon-color-lemon-color-picker--tokens-with-custom-color--dark:
+ hash: v1.k794b7964.43b3acaac780b2d5f2d935ff83a7ee804d517f5e49d0693a2411c136d3254586.pdnrgYLPyrOtRvubVu1TfoWUYdj9JHK0KbDcq_tEiFI
+ lemon-ui-lemon-color-lemon-color-picker--tokens-with-custom-color--light:
+ hash: v1.k794b7964.5f76a70475c12dbb7e8fd79556ac4c6dfa3c200e0b02d5e67b84e733d510726d.vUD8JNJmNVWmRz6Jxkb-ajVrq9RGwIZxYvH5TLkLUwA
lemon-ui-lemon-color-lemon-color-picker--with-unset--dark:
hash: v1.k794b7964.71d425cea0efcec828c973cd33af99174d5b1de4acb16c8ccac3916da87002e2.2P3jzrJ9U2uC7hKK-OogeVGTjiGvBLzxgbw4CXo-b1w
lemon-ui-lemon-color-lemon-color-picker--with-unset--light:
@@ -6690,6 +6702,10 @@ snapshots:
hash: v1.k794b7964.31703656b8a306a7d49b09cc8f656c7c42736668885c84bc98bb313bf1ebf501.mQsSNC-D51SFFN3Ck7nPjwPYTva-iHTshY5Nn4Nprqg
products-autoresearch-training-run-row--run-produced-the-champion--light:
hash: v1.k794b7964.0ca7c29c5445ee44d47a1cef4c7c8f6d331310b0176e173f43530b99079e4e86.tjZPXyNflXDsKIgM8KBKf31qxG5l2W-_GViGBr51tn0
+ products-business-intelligence-chart-years--many-years-narrow--dark:
+ hash: v1.k794b7964.54ae233495f20e81b0fd03abe4649f9147b0d87142b515fce894b1325b57b104.67n9Ipd2-Q0jG4n-8sao7_rHt4kFjQghNhHqbr-vAWQ
+ products-business-intelligence-chart-years--many-years-narrow--light:
+ hash: v1.k794b7964.ebb8d214415fab7dfcd01e65529bad5f550d1f17d92096aafa5b8eaf6c5d5793.O495yEjewwEvP77JbjrF1WXLPPTdkANnfLIV6EEVe1g
products-business-intelligence-chart-years--partial-years--dark:
hash: v1.k794b7964.2a6374590be64f7a06a222b2c702f194a05289115c618d7ec8864a6b62f85631.wJMlvq8tZxD3TVKI8Lt9pHxK7YwHkdHS2QDRpZaqRJo
products-business-intelligence-chart-years--partial-years--light:
@@ -6711,45 +6727,45 @@ snapshots:
products-business-intelligence-pivot-table--multiple-measures-and-hierarchies--light:
hash: v1.k794b7964.f3a5839e83ddc9921b021426487c0f0db66fe969bc1369dd799c98bd83c91c19.e4TqncN8iN7TmyLw5M8lgUEjfSjD2LgrVykUPu1Ws48
products-business-intelligence-scatter--detail-and-color--dark:
- hash: v1.k794b7964.ad2cb47d76ab291b31e84102a821c01dead1ba448950dc9dde6414a24c2891e1.9u-YOJvW_VYRSOtZ6eaZ3zUXPeM0ETlPHRL8ri4BYhs
+ hash: v1.k794b7964.10050e03ee37342a8bf6e58db6149ad8a57aa66d32e5353dd9400dee8d055b30.XTp9ixf5AOcS_sZxzXYYoHvn4OT2xNm0UCHS8cQN1dQ
products-business-intelligence-scatter--detail-and-color--light:
- hash: v1.k794b7964.9496627a852f9a3245aeca8e505e1bbe5f9807a8fb92f7961cecf62f452e42f4.CvZKhdcFlOWzsKWUwyB6tfMCtfl6zFs-xygDpqHBhDA
+ hash: v1.k794b7964.8fbf1d771d9dba7e7f162d5778a7f470a8ce1b51c29b17eeaf1e3fe8092f82d0.6tbRtQQiSWJeZBjzzEeFFB2C7Fp6OUWGHX0Eo92dDPA
products-business-intelligence-scatter--narrow--dark:
- hash: v1.k794b7964.18fc5ffe4152828340b17f3bf5f6c7196cd0a57ca211d61c1d76ba7ff042f593.zIIV4aK8uPfMSpcEYKwiQnEDA2B5W4wvO-SRi5vZHtY
+ hash: v1.k794b7964.f210aec99ed5505e14ead3893d6b11696dae35fdc08d8da146806832c019d74f.ohNl5wh51tk02iIluclo2XKtSgS7G4PVKd6_LRZOG4Y
products-business-intelligence-scatter--narrow--light:
- hash: v1.k794b7964.b5f58da7e2c6183af226ebfcfc67d0d7d80036d9266ae3a7de5fa7bdd94fa5fb.tz297VQb3pwNAw397wzBcKu4l0OKpkhANKH62JnTjx8
+ hash: v1.k794b7964.2aa85e80b0e64c76164ca5ac696cea00ff61d16a4a119e4ba021b7f2a8d59f61.5J0SJxLGKKjnk33_iF5vA9l8uo2MyJVUZeVHI3VHKfg
products-business-intelligence-scatter--read-only--dark:
hash: v1.k794b7964.5272d9fc095372492de4bc666a4fd7c995c2fb3de8c859a48ddbf7dae5094c8b.VCgPn7znPvjkY-Sx_PsctneSMhp8KtDuBPxFoGjYdPA
products-business-intelligence-scatter--read-only--light:
hash: v1.k794b7964.21cf4e3c6d31ac5d3653d176f876dbec5894d2569bd082e4fc5117a7dbe40af3.b-Dnoj2QTxOlUnZTMZuBqQGvSNk2lnMS0V6wnY_Aud0
products-business-intelligence-worksheet-exploration--daily-1500-groups--dark:
- hash: v1.k794b7964.7f24380331923ad18b327e3ee20624a2f67869958b7a45b4d963ea940f708c3e.2c89E8mgVRM284sG-f6EP-1-9vA9Pc-yDcT6Px4OTXc
+ hash: v1.k794b7964.a9a731c1a391684ef5ebda94dfafc99074d21118e477c84834201ea27460aa4f.-doElKwp-rPDGZ8QNpvjdG6uiifbwd3NeFgw1r6--8Y
products-business-intelligence-worksheet-exploration--daily-1500-groups--light:
- hash: v1.k794b7964.576e1c3d4651127152e33cb35a34dcef0969593733ee8247ec076ee629ca9fc4.hO62qLuOIngHf2JV00Vcc_NeBeN5qlnxXW2LF8WHN40
+ hash: v1.k794b7964.002d0bcc72047273815bceee9f5656ccd72ed8e84992fdbb9cb993c9050ad3ad.iG69xHc3oSVsUlLdMQb3Fk4t84mYM8uKiDup8aRpdak
products-business-intelligence-worksheet-exploration--filters-and-hierarchy--dark:
- hash: v1.k794b7964.e4cef51a703ab4a4eca19cef32de8792115a1ed20be34b2c0eda43f30ee5c86f.28n5DnUYRKTSrF16GkVWHnxBaOF_uw42BgG6KlJAHd0
+ hash: v1.k794b7964.5974363600b9065c6589a53cd7f613205cf881ae7a9d13a6dbea34ed83bf3d57.o-efPQJbLWfnixhx6lse6n3ekHXfREFE77EIi6Mwbuc
products-business-intelligence-worksheet-exploration--filters-and-hierarchy--light:
- hash: v1.k794b7964.48882d147bfce92e1c332573e795840718ee53ce08b2dab5559dfa1a8f62d007.jkZzMxS9__f3ii-nOv6FwAEcaQDxYd1gcCsfurMunEw
+ hash: v1.k794b7964.86d47e764dfec6b772d1708de96144b837dc71846ffd783b76472ab9b0b69054.9EPS9lzwpSsYU8-uTMVDqvhcspEiIoq_BOPfUkx1Vcc
products-business-intelligence-worksheet-exploration--narrow--dark:
- hash: v1.k794b7964.f0f4cd878c141ef8154bf82d31674761e5b259a4454019424dc9b8b1c5b24f55.rehU9UOKSjVBkzWe4Zs9K1clF6MhTP46sBb4RDKtAzk
+ hash: v1.k794b7964.cd38dc3c47568c5cb2b7ddfd7202bec3971fb510149b065938dc88cf6279a625.l1fstdH6tN9KE5C5GFChzZ4HaMvIr0i92NrAXaHxyDE
products-business-intelligence-worksheet-exploration--narrow--light:
- hash: v1.k794b7964.eda04f7a69ea0d74d19b756de7a65542770baf7091abfc1c1ce752e9d9078fbf.7fkXcQq-Qhnv7eQYFq6F80KzhBTz2K78QXCSRzzK1kg
+ hash: v1.k794b7964.0133626cbdc69ae362a20c08e8d8234e71144415128f995972cb467d2d4721a1.M1gB-Uc0XGtKQ3VYNOgaxMmgVpWBeZQvIPWR6Bd15BA
products-business-intelligence-worksheet-exploration--nested-panes--dark:
- hash: v1.k794b7964.ee6497cde4249110bdca6252b919b8e76107900790023e9f8735c99a69fb6864.UZifG7uIZv8bmBPYhDg84XdTqEMQgefwwPdNGW7kSHY
+ hash: v1.k794b7964.4d83ac6b394e270357c92a6c571f42d14ff9563a099aa9a6278188fd79e4ddb3.bHOsn51F_DKn3pnpCetwT-ic8NXOw_BAogjhlpkv4dc
products-business-intelligence-worksheet-exploration--nested-panes--light:
- hash: v1.k794b7964.242833e6c2e004cf165010ee3f6c2362cb5fc99ecb1f8e08363bf492221ace9c.T-x-95-nNYHwKjrM9KQfX6sWhEqxTQFKRcw5rdNbmW0
+ hash: v1.k794b7964.0b1b1229451c5cfd2d9a039b3fa9c5c47666f911b88e6bda6082114d396d4ffa.do6Xl5XylNXGY502RjQbonnVrIRX_n0siO4IbacSHwQ
products-business-intelligence-worksheet-exploration--nested-panes-narrow--dark:
- hash: v1.k794b7964.6748f50af33982f6a045dcd3d271419ed4a081cc6657f5988c840b027cef52a4.RdsZrVOfpyY2EkpqsAoID0_h9wsU-lOBqBnW-VQj2Us
+ hash: v1.k794b7964.a38add59164788d6a68c02f4c50a383bc0c95880f7ede0eeb4de9f2528917141.rvQwwh0bVPNic-1O7twAH85RPlACIvJkhFeERXKodT0
products-business-intelligence-worksheet-exploration--nested-panes-narrow--light:
- hash: v1.k794b7964.f34aab41e0195574b3ee516b2f6bd13b778aecf6736fdcccebfbcb5ac793328d.Yu8ckZfcOYNU81Iaj7lzHP6rZ1mM9R1T6sqq4qCYsLQ
+ hash: v1.k794b7964.20c64038f75c37237c51288264f4675a0c5850316e1475bdbd054af20d1ad3ca.TdQSXGC_6gRz_6Px-lY7k5syIhsiftu0HzJ8T_oKpKU
products-business-intelligence-worksheet-exploration--scatter-selection--dark:
- hash: v1.k794b7964.be207bfcc39b5dddbb3811dc16ddb727d43cad39214aa1bdf8e217ba41d63445.v-bpXyyP4M4IskpBb__5i2eO9UNmtoQDBa5VVSOOOls
+ hash: v1.k794b7964.48c217ca29b4df9e3eef8c7687e91f0c75bb61f71cfe0dd9765ef9b4c6ee08a6.LgJINVZ63cnX7-eHHKGCnf5IPT9YPvbVcZgLS8CtyKI
products-business-intelligence-worksheet-exploration--scatter-selection--light:
- hash: v1.k794b7964.a20fd109efc67c7f865613411da730fadc92c2e8806e7536aed0b00aa70444d0.-HpnjY1-TxJ8s86G0Z4ultflLyTlM4BCPsq9WnScckY
+ hash: v1.k794b7964.c1e1924429c65551a33cfb59687b62ef00393b8df063cc05ca83e0ce00caa31d.UkvyWSH7tNONW3wYFeK2HwRsA4Gc5QoKoPkm54nottU
products-business-intelligence-worksheet-exploration--sql-preview--dark:
- hash: v1.k794b7964.54f8eb4ac329765a5e1fec07e5adeefcba0c7f33dd52018d809c9d391d37769d.r9f6H30d5bj6XpQ1aKJvzoRxOnhylVg3vM7RTmx0U9U
+ hash: v1.k794b7964.34b064a1732461d1664c0c9467bc3be7ff85d62d7729f3eff07eb92bbfcda8aa.-t4A93_W-41sdOmdL5-8I9_i7_VQrQdCpd1ZhuVIp3Q
products-business-intelligence-worksheet-exploration--sql-preview--light:
- hash: v1.k794b7964.b8569ec9b2979da3d802f171fcd04928aea1aa553a4dd1839a6542faa543b131.AoZIJ5cizWWPtwLgAoQ-QNJxEgwFa59truknG0aIrCM
+ hash: v1.k794b7964.10f7ecbc7ec65573eb5146d90f532df21bba66a01319bcec32d4b8dd4d4b0caf.GsSiu13Qc7_45QP5ZfbJKeEOHKEcp3jq9U-RZzThb8c
products-business-intelligence-worksheets--worksheets--dark:
hash: v1.k794b7964.415c9082cf92256a775c1f21b314625a10282c76e91ed9373560c7e983aafde4.syfMPTOr1J9lrSDz6M0HWZn25hDTtND6yg9pQ9tP6Ww
products-business-intelligence-worksheets--worksheets--light:
@@ -10079,37 +10095,37 @@ snapshots:
scenes-app-data-warehouse-sql-editor--bi-catalog-snapshot--light:
hash: v1.k794b7964.ccee947706656e7bc3bc4f1c83610196346351067b2e406e222f6021180a92b7.WJlU-aUOOEEMQN9SppIHk6yIPbTrU9VrCOSME-hQAjQ
scenes-app-data-warehouse-sql-editor--bi-catalog-source--dark:
- hash: v1.k794b7964.5063a2ffa4974d3db91d89739d182fb32966b40e54c81642a2f54ed931f82b16.iLFa19kF_o7DrHL0e-0ZDg1DSF-hOzif8fyS1Tz2wsw
+ hash: v1.k794b7964.5c62cb8946a1ccb01f2400d31afd780a5bf56926b6bac6d3d3ebae2530c6d67c.78LmQBqv0S7az94Q-Rozo4w3RvgbX5R8gXyO8NmCvA8
scenes-app-data-warehouse-sql-editor--bi-catalog-source--light:
- hash: v1.k794b7964.967903a38d5ca0e462e2e7dddc8b623b784f32dd23deb6671aa36a615a36ef7f.hrwenBfFV6gOpx1tsOHns2-bYWsliVKNxeP-qQLW834
+ hash: v1.k794b7964.86400c389f9a13855bd2bb7293229b8573f373d81f70289eabea9a1f2559e197.3TkCrLdJjRK6roKtK_NAbVw7LKBbVy12sAfwY9rVL5g
scenes-app-data-warehouse-sql-editor--bi-category-groups--dark:
- hash: v1.k794b7964.4a5b83cb6f2840d3762ad2b56c62dd3c90e376b9cad2850d2d4bce4311299662.jd5yI6fdhWyNgJcNig5J25sW5sSNh6KS--1v_Zcvbug
+ hash: v1.k794b7964.a3f19bf23dc57e375588b0c3ce6bb01d16dd1f67807ed9d0e4474a55a76b4ee0.ImI0AWe7sOpPEz3emsANJFxSFwZcWgKBXo5KjJDA-Jg
scenes-app-data-warehouse-sql-editor--bi-category-groups--light:
- hash: v1.k794b7964.483842bb281a2de62d1b4304c4a9b0fd72ff425086a069afe495936c306e6e60.LuqAnRPfSM59dzSBSDePslc6e8lCPuYROxHfy7X-uOI
+ hash: v1.k794b7964.0882428bf4451b01c3389aaab42230d84a644857a471dc431d72d412da1955c6.MOHTtiYqPlL8qySZX8TCqWl2BQxaswgHm5UCCgldSn0
scenes-app-data-warehouse-sql-editor--bi-combined-measures--dark:
- hash: v1.k794b7964.8a5f24e2f15aefdbad4ffca39f469dabb1c1ca8668a54a0f6084c9c3784fad3d.sU8D8dQj_UBrcuwB9gERI_H7lFJvk0TEQKrwSMtQ76s
+ hash: v1.k794b7964.6d7a2179969c89c608d47f80dd99d9898b1274b538afa5ec78039397674c1d41.aV0MY5EWAMFu9eOIYKnaBOQFDiM5UFefAn17uI66cZM
scenes-app-data-warehouse-sql-editor--bi-combined-measures--light:
- hash: v1.k794b7964.1a7df2fe6d1f727a5a39283e4e7fa0b84de71af16d17ad5506995e85a88df0f3.5TMob9wkvylU2InzLQ2nwle2z2cIVpf_CSJw8jEkCzE
+ hash: v1.k794b7964.97106e3b77ac0ea9ebbf188523ead219f1bfc3887200bd4bf2e4da4d55fe0d79.gaHW-gC_KxTgWN20r2DvJs-Da2HCHvyrL0AIGqa_EWE
scenes-app-data-warehouse-sql-editor--bi-connections--dark:
- hash: v1.k794b7964.20e455e016c0d14b6fa6194e97bfa1efb5a78c4c1d113ed6012dbaf0b9b5b295.Khingq35QCQzbZmdi_X_LfoHXaKGYYhgTUmOnAMiMMw
+ hash: v1.k794b7964.311217387d5e851100f4eb830f80dc97d0c56aafede57a31ae4a6f255f461205.ys-gt0mzKzC_OIp5_xClO4HEUaBkAhK68u1VkYp-_BU
scenes-app-data-warehouse-sql-editor--bi-connections--light:
- hash: v1.k794b7964.8d73e999e9a058168f643dc3a86cfb1b966b91b7764b1b79adc18a025d8dcf33.RCVSaONQAq_CExJ6ZXYVHF4GnU8U1h-U41BbmfvhJes
+ hash: v1.k794b7964.f1c87387cbe119f0eec02ff672ba29c887c50053b6519f9345af5180fa37d283.tiIVIjMa8fs83I9lPkDgoVwHv_QX1ezJtbw2CZAxzMs
scenes-app-data-warehouse-sql-editor--bi-data-source-picker--dark:
- hash: v1.k794b7964.e52e0e6b5bbafcc49b7a403283ea2582623830f201f0f2cebde96694df76a434.cJCCG5oSz14yhFdrPG9GFg-3o3SeAPcCDiY7r0B2MVE
+ hash: v1.k794b7964.08851b463c307a87fe3ecabd7545393c066f3613e8cba0108b948a269c298ddc.2fxXWG6LMerRWb7XXjcVpH2FbH7_WonIXS8az6pR72I
scenes-app-data-warehouse-sql-editor--bi-data-source-picker--light:
- hash: v1.k794b7964.2b52437065c62287b16468e8bcbaddad744423b5293288ab3094f78faf618dfb.7aEiYNMWShTp9l6KWxD-1GouTk_dqFp_dtsIu3F4514
+ hash: v1.k794b7964.e7816fd43c604ea6080278a3ff4f7b7dc2bf57628dc074bdcb81a66ec64e7237.5hYpETTmAY32Gd7VEHzR7Xa9mZcjNXaNlCZkEZh3GX8
scenes-app-data-warehouse-sql-editor--bi-drilldown--dark:
hash: v1.k794b7964.64bb56a49fb27c4b5565420e8ef786e09aaa68e631c20b00dd44b157c8360615.iNgzWOSQA-YNWVTuFVBrflHl_kJJXfHTAAvOBQ4rVEg
scenes-app-data-warehouse-sql-editor--bi-drilldown--light:
hash: v1.k794b7964.17425e90961381749cfc5f29a6648045fc2823bb8e239393b9801d2194e8b887.sqGRqMiXBdZxzpm-duX1-vj4SrOlKfwFtNl5Qh5o6VA
scenes-app-data-warehouse-sql-editor--bi-edit-saved-insight--dark:
- hash: v1.k794b7964.bb961b255cd6561500d69559373f91070bc3b64b58a2a38474beda3b16d3021a.8U8Odg-DQuf2OOzhEcmxbdf4ieZSEIZ0gtcrm4-DwtQ
+ hash: v1.k794b7964.829fa05c70ff169bd9561723610d0b6a1097236fe77bbfd25fc2a9937e07cc60.JNHbO84M4-QZflpWtf5n2nvxRJafSBXwjDfsUivr_gk
scenes-app-data-warehouse-sql-editor--bi-edit-saved-insight--light:
- hash: v1.k794b7964.08c698105dcedbbc6507c842976e386fda5fc5382eecda9f3acfe93b0960d5b5.8Z0KplEwTXGa0J2CUv6qQ1jldVddlpPQn1grxjanWxI
+ hash: v1.k794b7964.f121adb3dd90f7c246d4e355f39039b6702ecb251648664408b9f2935b272218.0k7LEOj3czluUhiby0T9sQ6iaHyLPQZP6ThTsoJEVbc
scenes-app-data-warehouse-sql-editor--bi-empty-worksheet--dark:
- hash: v1.k794b7964.9cdaf1b941fa6fac0d8839b4165ddd0506ce1c1ac263ae447087461a77e85a93.gXKbXKNUGG_zCLxpBvyfnmrOVGKBJj4sYQLELwogzNE
+ hash: v1.k794b7964.64113c52b48ef72719f5bb6d117704612733e237eb8df16b1195bd33f267380e.Z5fVC4LKr_MGqH0tkEWqkyn1fJ-6fgYQltN3PUum6XM
scenes-app-data-warehouse-sql-editor--bi-empty-worksheet--light:
- hash: v1.k794b7964.99ecf94f32c88b943651332b786c3ab33d4497730016ec325f279c53683bfd59.UE1Sw435eYovzC5VHT6kQceuUqT8J1rNMicQQlbSOL0
+ hash: v1.k794b7964.bf69fade0f379d579707a7a10b03d47e6ca5da5747fc61831d451fa5ab33feab.dxQdER__8Q-6tLQR2_UasCmsRln75tT36QY3qdccybQ
scenes-app-data-warehouse-sql-editor--bi-measure-display--dark:
hash: v1.k794b7964.285d3b0652df44f0abbc37490be06be0d37295e3c2cd90dec3b9ba686e94e226.E68htKmQ7-55dVI3ntl1GiZ7F4phBSgI-dESHmfSa5o
scenes-app-data-warehouse-sql-editor--bi-measure-display--light:
@@ -10119,37 +10135,37 @@ snapshots:
scenes-app-data-warehouse-sql-editor--bi-mode-worksheet--light:
hash: v1.k794b7964.d60ca4f154f5b6aa7dfe97f5907d32aeb07d408ef2ccfdd9b86bd8880c17ba6b.m2J3D-2Zw-ub5S6SSZk2MFZf3rAXWA6146N6UMKx2Xo
scenes-app-data-warehouse-sql-editor--bi-named-hierarchy--dark:
- hash: v1.k794b7964.63bc34e411b972a3014ab15f34997009bcb8221674630e8c893c683dca030794.vIOC126Xccqj1qHXT4AfSFN_Jj5nqzzdGUYSskXEJy8
+ hash: v1.k794b7964.e724f38d23aeec39cc86f95f44e0767dcd4ba7f54e23359854261fd8678afde5.fc_hkdQoeJKUm3dtBBrcUlgIiMUarlqIRs7dSUXfXM0
scenes-app-data-warehouse-sql-editor--bi-named-hierarchy--light:
- hash: v1.k794b7964.4782c05aa2882568d321dc2e4279ff4fbc941c89981568f99ccf9520aa367661.Qu14j4A7Z_Ipey958BcWksERq3KXSnLSWVquwQsDplU
+ hash: v1.k794b7964.e9e97c5e5adc2f34a62843d118758309b09d0685c342be53451487afea937f1b.yCbS9idhUSib62_0kNp0Q9-kvhol81kwmWG3f35V7Xs
scenes-app-data-warehouse-sql-editor--bi-numeric-bins--dark:
- hash: v1.k794b7964.a1e58d329dd081d4ddad9ab42809a292557b16f4332b7c5dc033514197f6e456.si6X7Eq2qEYOYNpbh-WyrfhztA5m6Yv9xxRG8x802G0
+ hash: v1.k794b7964.6c0e9647ab165b3f5b47ba3419bba78dcf7e01cc1754f1d1b54b91d367ffa1f8.QtWRhrqKfarrT3lDUzGGJVj3hOqJDHC98P9TOzfbjuM
scenes-app-data-warehouse-sql-editor--bi-numeric-bins--light:
- hash: v1.k794b7964.f481b2dbffeb539a58d734b53d101fb6faaf3c030c36aa8004718a5a96862dc3.TvLxQm-fA52VnkzkBIdfykJlTeBwQ-bZrsIzLc4q7zY
+ hash: v1.k794b7964.aff75e357db7015dcf44f17053bf73937d2a0dd7ccc0896546f3a63a5521c61f.kbX6VcgtLZcMuDWLfcyIuZmB7dbDjeeuGU3QUIZNI14
scenes-app-data-warehouse-sql-editor--bi-one-click-comparison--dark:
- hash: v1.k794b7964.ca3574d560dceeca22b572252d2bf6a628e809ce56e3369792daefcf5bd12217.mS7XTjrH0HiARysg99L3O1OkWb94O1iQ0rqCkWeei1o
+ hash: v1.k794b7964.0da3e82e2a92da71dff99dfd05922421e1c694a20c7fb3a20f5bde7e4c3da3c2.gQ4eMAbYTCqMYNkzgZvjFK50OgUOvRcXa70HVAcYsiI
scenes-app-data-warehouse-sql-editor--bi-one-click-comparison--light:
- hash: v1.k794b7964.3af5fdf03f573407de0d9bf6a459d4f89c1f2cecbc5e6e296dee33dc46ffe8fb.1XR_hWBwWFx8-cgqg9j_QaXpzMB5x8lZgLS9JkeXoxQ
+ hash: v1.k794b7964.efa93e911135571c4b567f0cecdfbe9267207f397a8d80cba8d96df955584ff8.w567Al6dICcEwyU2xS6tHQY7q0uLcEJee7hWVaW46yw
scenes-app-data-warehouse-sql-editor--bi-pivot-totals--dark:
- hash: v1.k794b7964.c1c999f52a8f6aaa2b937f09ed1218420fbf22717b256b5746f83a857ffdb456.GV5s-1z80XNrg1kiEK3rkWlwPw3al5QxyViFErjW8_Q
+ hash: v1.k794b7964.ca55e4352814f9b4f9554b782dda070016864f1a6d76619898448d3383b3ed06.s4nN2Ca4wjFxBEdblNrjBX63nFewXw0f4srWU12BvrI
scenes-app-data-warehouse-sql-editor--bi-pivot-totals--light:
- hash: v1.k794b7964.c1a5a9e6925a99c5442d5b9c5cac146826104df0be56951853ff8ca656a5711c.1X2Gb4NVgF3zF9fOYmP8XI04X1UdEZpyA6QU_cCJt44
+ hash: v1.k794b7964.177d686456832851851545e28c7890453476538c7792f2df91975901b42fd5ca.q0cqEfcb8V_EBFEghm1IRhzrW9E93_JgsNM0ZuXVtzw
scenes-app-data-warehouse-sql-editor--bi-quick-filters--dark:
- hash: v1.k794b7964.cb93198bfbc39e7551bbb2afb089b262a4feb09783428423313164199953c2ea.yZVTW4sCJxN3og54hyxVpSi5MDPIsU-iXoV4WjhBFqA
+ hash: v1.k794b7964.7bf2ec2272d97038218bbbadb0ae81b6717f5b7f8fa3e9f1e2094dc582b6730a.XmCj0d0OKwQc8wd95Ddk8kZNOGJnyAcuzjMaaarwCcM
scenes-app-data-warehouse-sql-editor--bi-quick-filters--light:
- hash: v1.k794b7964.c869c53035ab8999de17064f328e55a98e2d630e0798523b7546c7e37d566a51.7JCWR9o8WI_n5E5GPe3VyiQy-h2lLPh5olskN0aEJX8
+ hash: v1.k794b7964.08c05916876febc7e4ef4fdd505fe35b746b7d912f047c5543e579e3ce91f1fc._BJ4vHqrfHE-S0IL5teOT8Ny3MZWHxbAf6k0jW3s7Yo
scenes-app-data-warehouse-sql-editor--bi-quick-filters-narrow--dark:
- hash: v1.k794b7964.f1a652e4ed52ade1bea7690f5bee354a819e7b95a7265baa9c616caf13e61f90.DsjWYPHS114oT41R9WcLbQdX5eCxJdqUCH6D6x6fFA4
+ hash: v1.k794b7964.49e711ad9fd4e98043b92fb9e1bd21fd04976387fa243248f691a5a972d1a100.8eq7d5kByrWGfjtI0JbwcLzUbXg_B1UYD1qWWxNfXx4
scenes-app-data-warehouse-sql-editor--bi-quick-filters-narrow--light:
- hash: v1.k794b7964.f8d5ab63e05e8f9199c85faf8eab900180c9ef443b812bfbdb3b9642ee6dc066.kt-8oDI3zW6KzCgxv3u6ECjvwnfcrhrFRnRi_rWE5d4
+ hash: v1.k794b7964.110aa20490746f5c25a9ee046cbcdb82ea9bb7b59348fea8948288c082ebd03a.lmOFmebfu7-i7ZbLVr3DqxTRpjhoTXAJu9J48gfmFTo
scenes-app-data-warehouse-sql-editor--bi-saved-insight--dark:
hash: v1.k794b7964.06df092616d217a4ebdaf0f5f35015c05fe63f5bc1e9b9c39dcdf6594293c0e3.D8zEjaefT5868HRYC8F6GkfsuMMlcxSxekM5z-VoXyM
scenes-app-data-warehouse-sql-editor--bi-saved-insight--light:
hash: v1.k794b7964.2c5f15b06d4347f767fc34bf934ea1bd53e988c443d528edb457795e778cc556.FcMHWv530RuOEcqg3G_bnos4zzZ4mku3Q9pdsK-VCXU
scenes-app-data-warehouse-sql-editor--bi-table-analysis--dark:
- hash: v1.k794b7964.a2f0aeb7739ef1d91f0d5ffdf47ba9013cb25a2853092180265a132347fd59f2.BcvLZ0iTpnnGxgl9j-ZEw9Mm6BZsB7fd6UsmEDx0tls
+ hash: v1.k794b7964.95f4edada167b94534e7a074171d0aa0b9aa21aa54c40438b37531c71845465d.6wK-B37Jl64GkiYujYjQQjGlGoSTr_TFHatyCo69vjA
scenes-app-data-warehouse-sql-editor--bi-table-analysis--light:
- hash: v1.k794b7964.6738d6bf86ffbca51e925b3230ac4b66c0808260fed0d0750804b33734dfd889.MKkIrRDTnof49tYgECLwbv_WqugRJB11sJjPBkf8-YA
+ hash: v1.k794b7964.a0eb06eaf33fcdbd2913559b580c1503298013743f0d3fef8ddc47721da8d964.LH1_3K3E-T6ZzlAXmenIw_Tz8HPaEWWyL7HwY9WLuVQ
scenes-app-data-warehouse-sql-editor--edited-insight--dark:
hash: v1.k794b7964.334b216a8359c768613cdec5b99a8a8ee26b6b5fac76397eaed8d6d1401a23c0.0pI7NMTufzUIfDel9Ngmhv3P3sdBu6IgpSj5xYNmYrY
scenes-app-data-warehouse-sql-editor--edited-insight--light:
@@ -12983,9 +12999,9 @@ snapshots:
scenes-app-mcp-analytics-dashboard-cards--daily-tool-breakdown--light:
hash: v1.k794b7964.ef1d01e79c64ba3a610716272257daa8015654e54cc4ee09d6a9fa8ec91f6d41.wJlkho2QkeMjd3FbjVsFK37nxaziOX6bUnlEGyPtXHg
scenes-app-mcp-analytics-dashboard-cards--error-rate-by-tool--dark:
- hash: v1.k794b7964.0fcfa6b04152d1e337cff4600e0ccbc78a9f2bdd26288a49aaedc32b6a6e7b30.IKeaptvJPXK3-jRApkTBlVHOa_9Cngl2HEAGgvR95hI
+ hash: v1.k794b7964.3e9e147230095c6602e7cb5c25414cfab376bef36d895cde3ca3a709c18c6ae3.F1OrEv_affEy1PYJgo6RjuZCfSr2Bi6iYIhbICb3_94
scenes-app-mcp-analytics-dashboard-cards--error-rate-by-tool--light:
- hash: v1.k794b7964.344e0b9c95f3eecf57448dd709df4bdf3d8736d08244a5c51c4993b63ce1bb7c.cZL6t8214SXHzXIykKc4_7qBKnesFf95cN0jCDfqBfc
+ hash: v1.k794b7964.0c5f4e1cb28d098e43a7cb57082fc15f04cdf31ad6b842ac1f6590d95102dc14.Y5SYKK2ptHxU-rb2O9zDPruRrI7LFMmcP6AREWQABoQ
scenes-app-mcp-analytics-dashboard-cards--flagged-sessions--dark:
hash: v1.k794b7964.3cb2da2576280c91d6c8ded46d37cb622ff5a7ed1c5806a44c0fccf9efee0c0f.siDD7CL4vymuXEIyfWny7zcxf7Lo9I8GeuZ3SIODDrY
scenes-app-mcp-analytics-dashboard-cards--flagged-sessions--light:
@@ -14783,13 +14799,13 @@ snapshots:
scenes-app-surveys--new-survey-with-text-question-description-that-does-not-render-html--light:
hash: v1.k794b7964.bdd6755a72ec571efaa9b38ef0bff6e87b78d504b254006a409f2114354d7afc.tu-CzwdxzR8jjFs-Eam3yR-MQDTaJGOSQFTevQSXczE
scenes-app-surveys--survey-results--dark:
- hash: v1.k794b7964.d24cf21331cc08695b112c71c74fbebad505f764b5724c887e1eae2b910a5add.F78vCNK-5jT9ibk8H5w3wLowjG6acy17BWbFyM9rmhM
+ hash: v1.k794b7964.26fb3c324bf0749bd161a390eec761e0ca4b2ab846f54e8fa8600815b28b041c.BXV4GPelcnS4R79bvCck6komIvn-CnePNnjBABJfLR0
scenes-app-surveys--survey-results--light:
- hash: v1.k794b7964.a1e5aa8fb1e492e5336f984ec06b48c101295863c2ac0f3d6ce75a1c7325710e.94II2OjeSRNoA0vmcSCD4VYazwhbhLOQFTU1Yvwl4LY
+ hash: v1.k794b7964.87758b68551b35277bd0b576abc586689fb10db7008d23bd8af6a5e11c388e81.CWamhYwGuu-xmoseaC2gYIzTF0NmCcoSzSEDsvfDpkk
scenes-app-surveys--survey-summary-export--dark:
- hash: v1.k794b7964.7a29422b4cb020b79b9f9908dca482a988d85cc76f0ef933119ebfc234a26102.wHOJnD6FjoTozXXkXXko9W9sSQxIk0GApIqv4sojL-g
+ hash: v1.k794b7964.939714ca04ee24ff16b27316ff41c6bdc44c84b3a73151a9264015400adad28d.631SJTGu5VHJuYY6FBAZs2M2V-GCPuPxAZa8IMYHS9s
scenes-app-surveys--survey-summary-export--light:
- hash: v1.k794b7964.4c1aba9c3175866b1cd56a938768604d0cfa12158dc6881d8051cf9b4dce01b9.7SX5XrAQDCKIdIawBOoVzZMKBaDtedRucnvsxb9HLME
+ hash: v1.k794b7964.117d4c4bf8074f5c074d913daee28b97c37d086d9152f96f60c328f4178ad1ed.rkLsbZ23kLk_NZ8p91LVl5LZ8vqs_iUK2INZP5-S4wM
scenes-app-surveys--surveys-global-settings--dark:
hash: v1.k794b7964.476a85556bb374416ca1ae0cccfb23f8cc6f6a2e0e71d3f7d0e37a2ad3d463aa.lCKgctegJe2jQZ7Bf7sXK6YhuGh17KhGftYqoY3s5PM
scenes-app-surveys--surveys-global-settings--light:
@@ -15855,13 +15871,13 @@ snapshots:
scenes-web-analytics-calendarheatmap--with-hidden-row-aggregation--light:
hash: v1.k794b7964.afd498e7ebdeb0ae332637bc81c11e42462d4e849279096bc98b32e0cd80a516.a801UVBIEm5FXhf9KT5H6yJS0fMpnWS9Fv3lBzmSbqs
surveys-outcome-bar--nps--dark:
- hash: v1.k794b7964.e28423208584760021c769886dcdcd65a80212dcb89334b23313639ae283da3b.liq7EW2dUHBpgjju6n-bIB0sc35V0FcCfQ2-RJr_WA8
+ hash: v1.k794b7964.5027828bc67c5da7300c82814d299e9a0ab56b6a4330be00e8df4ba148fb1338.5lKlEhKPFFcZaK1jAHWXytfI3M5J62-MTIbiHE7y86s
surveys-outcome-bar--nps--light:
- hash: v1.k794b7964.9e5259c7f8c1faed817039c606c9c9a809a0aac9fb3ba3bc8bcd7a599df129cf.sL5BDDvwNx-7vAEzY3vi_zi8riJhGTqlL01vYdw6mZ0
+ hash: v1.k794b7964.664876b63781e83742387b8ad8a2c9731cbf26b323643ff712804085bd21cbee.HX1SCek5PuF7vU6jTM7Qiys60MCSqVQXLscI_62U9XM
surveys-outcome-bar--single-outcome--dark:
- hash: v1.k794b7964.426cc20709928614ef3022fb0978cd52f5383a3af4e296dc8dbbcd33f9729ba2.2dpQI-oXq4Tn0ZwGj7iT0QbL_tOsqx7ORVDSiuvNUhg
+ hash: v1.k794b7964.f974fcd379e3c76ffedfe04ffaf8d81892f3a5314e3390c8c59cdc08f2d8796e.DqorZscpg8E28vERo1pnSTWHdv_bimMRN9WqEdJQdnI
surveys-outcome-bar--single-outcome--light:
- hash: v1.k794b7964.eea08aab0c30fb91dece5e4766d2a4849cb22fa5a288a9140a12b5b5d64435dd.NqcUt3h1BIAVCafEfep4Y-BvhuCxUAfSyVtfy0Zygz4
+ hash: v1.k794b7964.d08d75af926eb118a851b8911c469839a57744d31982e8da0e40cee3ad347c90.N4YLSXJzksch_ZeyuQEYWkPAk8oecZdlb00XJjg7xog
surveys-outcome-bar--small-segment--dark:
hash: v1.k794b7964.324466fd5bc76f528a4c890c6c442b36bf27d5bdf2982edd7b78ea59bbc0473d.bapbvFkO7eGAoEc4Rh6bLKk9WyoZua2GtXrJtXemwE4
surveys-outcome-bar--small-segment--light:
diff --git a/frontend/src/lib/lemon-ui/LemonColor/LemonColorPicker.stories.tsx b/frontend/src/lib/lemon-ui/LemonColor/LemonColorPicker.stories.tsx
index 48c12e3b2e89..2a3a6633fd19 100644
--- a/frontend/src/lib/lemon-ui/LemonColor/LemonColorPicker.stories.tsx
+++ b/frontend/src/lib/lemon-ui/LemonColor/LemonColorPicker.stories.tsx
@@ -39,6 +39,27 @@ export const ShowCustomColor: Story = {
},
}
+export const TokensWithCustomColor: Story = {
+ render: () => {
+ const [colorToken, setColorToken] = useState<DataColorToken>('preset-1')
+ const [customColor, setCustomColor] = useState<string>()
+ return (
+ <LemonColorPicker
+ colorTokens={colorTokens}
+ selectedColorToken={customColor ? null : colorToken}
+ onSelectColorToken={(token) => {
+ setColorToken(token)
+ setCustomColor(undefined)
+ }}
+ customColorValue={customColor}
+ onSelectCustomColor={setCustomColor}
+ showCustomColor
+ customButton={<LemonButton>{customColor ?? colorToken}</LemonButton>}
+ />
+ )
+ },
+}
+
export const HideDropdown: Story = {
render: () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
diff --git a/frontend/src/lib/lemon-ui/LemonColor/LemonColorPicker.tsx b/frontend/src/lib/lemon-ui/LemonColor/LemonColorPicker.tsx
index aae7d7fd9d47..8eed3dc098df 100644
--- a/frontend/src/lib/lemon-ui/LemonColor/LemonColorPicker.tsx
+++ b/frontend/src/lib/lemon-ui/LemonColor/LemonColorPicker.tsx
@@ -15,6 +15,7 @@ type LemonColorPickerBaseProps = {
preventPopoverClose?: boolean
customButton?: JSX.Element
customColorValue?: string
+ onSelectCustomColor?: (color: string) => void
}
type LemonColorPickerColorProps = LemonColorPickerBaseProps & {
@@ -58,17 +59,16 @@ export const LemonColorPickerOverlay = ({
showCustomColor = false,
preventPopoverClose = false,
customColorValue,
+ onSelectCustomColor,
}: LemonColorPickerOverlayProps): JSX.Element => {
const [color, setColor] = useState<string | null>(customColorValue || selectedColor || null)
const [lastValidColor, setLastValidColor] = useState<string | null>(selectedColor || null)
const { getAvailableColorTokens } = useValues(dataThemeLogic)
useEffect(() => {
- const newColor = customColorValue || selectedColor
- if (newColor) {
- setColor(newColor)
- setLastValidColor(newColor)
- }
+ const newColor = customColorValue || selectedColor || null
+ setColor(newColor)
+ setLastValidColor(newColor)
}, [customColorValue, selectedColor])
return (
@@ -116,7 +116,7 @@ export const LemonColorPickerOverlay = ({
setColor(color)
if (color != null && color != selectedColor && /^#[0-9A-Fa-f]{6}$/.test(color)) {
setLastValidColor(color)
- onSelectColor?.(color)
+ ;(onSelectCustomColor ?? onSelectColor)?.(color)
}
}}
/>
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.stories.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.stories.tsx
index 756e2d810aaa..f1a468bf4d42 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.stories.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.stories.tsx
@@ -58,6 +58,24 @@ const render = (props: SqlChartProps): JSX.Element => (
const baseSettings: ChartSettings = { showLegend: true }
+export const InsideLabelsWithoutGaps: Story = {
+ render: () =>
+ render({
+ xData,
+ yData: positiveSeries,
+ visualizationType: ChartDisplayType.ActionsStackedBar,
+ chartSettings: {
+ ...baseSettings,
+ showValuesOnSeries: true,
+ valueLabelPosition: 'center',
+ valueLabelBackground: false,
+ valueLabelFontSize: 14,
+ valueLabelRotation: -90,
+ barGap: 0,
+ },
+ }),
+}
+
export const StackedBar: Story = {
render: () =>
render({
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.tsx
index 4e5184e035c8..61192d3353d2 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlBarGraph.tsx
@@ -85,7 +85,15 @@ export const SqlBarGraph = (props: SqlChartProps): JSX.Element => {
>
<ReferenceLines lines={model.config.referenceLines ?? []} />
{props.children}
- {props.chartSettings.showValuesOnSeries && <ValueLabels valueFormatter={valueLabelFormatter} />}
+ {props.chartSettings.showValuesOnSeries && (
+ <ValueLabels
+ valueFormatter={valueLabelFormatter}
+ position={props.chartSettings.valueLabelPosition}
+ background={props.chartSettings.valueLabelBackground}
+ fontSize={props.chartSettings.valueLabelFontSize}
+ rotation={props.chartSettings.valueLabelRotation}
+ />
+ )}
</BarChart>
) : (
<TimeSeriesBarChart
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlLineGraph.test.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlLineGraph.test.tsx
index 556afed78870..310a100be62a 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlLineGraph.test.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/SqlLineGraph.test.tsx
@@ -238,9 +238,9 @@ describe('SqlLineGraph', () => {
expect(rightTicks.every((tick) => tick.endsWith('%'))).toBe(true)
})
- it('hides only the right gutter when the right axis turns tick labels off', async () => {
+ it('hides right-axis ticks while preserving its title', async () => {
await renderChart({
- chartSettings: { rightYAxisSettings: { showTicks: false } },
+ chartSettings: { rightYAxisSettings: { showTicks: false, label: 'Conversion rate' } },
yData: [
ySeries('revenue', [1200, 1400, 1300]),
ySeries('conversion', [12, 18, 15], { display: { yAxisPosition: 'right' } }),
@@ -248,7 +248,8 @@ describe('SqlLineGraph', () => {
})
await waitFor(() => expect(getHogChart().yTicks().length).toBeGreaterThan(0))
- expect(getHogChart().yRightTicks()).toHaveLength(0)
+ expect(getHogChart().yRightTicks().filter(Boolean)).toHaveLength(0)
+ expect(await screen.findByText('Conversion rate')).toBeInTheDocument()
})
it('floats only the right axis when its begin-at-zero is off', async () => {
@@ -449,14 +450,15 @@ describe('SqlLineGraph', () => {
expect(getHogChart().xTicks()).toEqual(expect.arrayContaining(['October', 'November', 'December']))
})
- it('hides x-axis ticks when showXAxisTicks is false', async () => {
+ it('hides x-axis ticks while preserving its title', async () => {
renderLine(
- { yAxis: [{ column: 'pageviews' }], showXAxisTicks: false },
+ { yAxis: [{ column: 'pageviews' }], showXAxisTicks: false, xAxisLabel: 'Signup month' },
lineFixture([{ name: 'pageviews', valueAt: (i) => (i + 1) * 100 }])
)
await screen.findByLabelText(/chart with/i)
- expect(getHogChart().xTicks()).toHaveLength(0)
+ expect(getHogChart().xTicks().filter(Boolean)).toHaveLength(0)
+ await waitFor(() => expect(getHogChart().xAxisLabel()).toBe('Signup month'))
})
})
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.test.ts b/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.test.ts
index f50e0ee088bd..0505a0d60280 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.test.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.test.ts
@@ -604,6 +604,27 @@ describe('sqlLineGraphAdapter', () => {
expect(config.xAxis?.timezone).toBe('UTC')
})
+ it.each(['YYYY-MM-DD', 'MMM YYYY', 'DD/MM/YYYY'])(
+ 'formats date ticks with %s without changing their values',
+ (format) => {
+ const config = buildLineChartConfig({
+ xData: dateXData,
+ chartSettings: { xAxisDateFormat: format },
+ timezone: 'America/Los_Angeles',
+ })
+ const expected = { 'YYYY-MM-DD': '2026-01-01', 'MMM YYYY': 'Jan 2026', 'DD/MM/YYYY': '01/01/2026' }
+ expect(config.xAxis?.tickFormatter?.('2026-01-01', 0)).toBe(expected[format as keyof typeof expected])
+ const hidden = buildLineChartConfig({
+ xData: dateXData,
+ chartSettings: { xAxisLabel: 'Date', showXAxisTicks: false, xAxisDateFormat: format },
+ timezone: 'UTC',
+ })
+ expect(hidden.xAxis?.label).toBe('Date')
+ expect(hidden.xAxis?.hide).toBe(false)
+ expect(hidden.xAxis?.tickFormatter?.('2026-01-01', 0)).toBe('')
+ }
+ )
+
it('omits the timezone for non-date axes', () => {
const config = buildLineChartConfig({ xData: stringXData, chartSettings: {}, timezone: 'UTC' })
expect(config.xAxis?.timezone).toBeUndefined()
@@ -615,7 +636,7 @@ describe('sqlLineGraphAdapter', () => {
leftYAxisSettings: { label: 'Count', scale: 'logarithmic', showGridLines: false, showTicks: false },
}
const config = buildLineChartConfig({ xData: dateXData, chartSettings, timezone: 'UTC' })
- expect(config.yAxis).toMatchObject({ label: 'Count', scale: 'log', showGrid: false, hide: true })
+ expect(config.yAxis).toMatchObject({ label: 'Count', scale: 'log', showGrid: false, hide: false })
})
it('defaults to a linear scale with grid shown', () => {
@@ -990,22 +1011,36 @@ describe('sqlLineGraphAdapter', () => {
expect(config).toMatchObject({
axisOrientation: 'horizontal',
barLayout: 'grouped',
- hideXAxis: true,
- hideYAxis: true,
+ hideXAxis: false,
+ hideYAxis: false,
xAxisLabel: 'Revenue',
yAxisLabel: 'Page',
showAxisLines: { x: true, y: false },
maxCategoryLabelWidth: MAX_CATEGORY_LABEL_WIDTH,
bars: { fitToHeight: true, valueDomain: { include: [2000] } },
})
- expect(config.xTickFormatter!('0', 0)).toBe('/pricing')
- expect(config.yTickFormatter!(1200)).toBe('$1200')
+ expect(config.xTickFormatter!('0', 0)).toBe('')
+ expect(config.yTickFormatter!(1200)).toBe('')
expect(config.tooltip!.labelFormatter!('1')).toBe('/signup')
expect(config.referenceLines).toEqual([
expect.objectContaining({ label: 'Target', value: 2000, axisOrientation: 'horizontal' }),
])
})
+ it.each([true, false])('keeps custom date tooltip headings with ticks %s', (showXAxisTicks) => {
+ const config = buildBarValueChartConfig({
+ xData: {
+ column: { name: 'date', type: { name: 'DATE', isNumerical: false }, label: 'date', dataIndex: 0 },
+ data: ['2024-01-01'],
+ },
+ chartSettings: { showXAxisTicks, xAxisDateFormat: 'MMM YYYY' },
+ timezone: 'America/Los_Angeles',
+ visualizationType: ChartDisplayType.ActionsBarValue,
+ })
+ expect(config.xTickFormatter!('0', 0)).toBe(showXAxisTicks ? 'Jan 2024' : '')
+ expect(config.tooltip!.labelFormatter!('0')).toBe('Jan 2024')
+ })
+
it.each([
{ category: null, label: '0', expected: '[No value]' },
{ category: undefined, label: '0', expected: '[No value]' },
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.ts b/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.ts
index e5b7d97b4c95..3e0d214a66b6 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Charts/sqlLineGraphAdapter.ts
@@ -350,8 +350,18 @@ function buildXAxisConfig(
return {
label: chartSettings.xAxisLabel,
timezone: isDateAxis ? timezone : undefined,
- tickLabelRotation: isDateAxis ? undefined : tickLabelRotation,
- hide: chartSettings.showXAxisTicks === false,
+ hide: false,
+ tickLabelRotation: chartSettings.xAxisTickRotation ?? (isDateAxis ? undefined : tickLabelRotation),
+ tickFormatter:
+ chartSettings.showXAxisTicks === false
+ ? () => ''
+ : isDateAxis && chartSettings.xAxisDateFormat
+ ? (label) =>
+ (/^\d{4}-\d{2}-\d{2}$/.test(label)
+ ? dayjs.tz(label, timezone)
+ : dayjs(label).tz(timezone)
+ ).format(chartSettings.xAxisDateFormat)
+ : undefined,
}
}
@@ -380,8 +390,8 @@ function buildYAxisConfig(
label: yAxis?.label,
scale: isLog ? 'log' : 'linear',
showGrid: yAxis?.showGridLines ?? true,
- hide: yAxis?.showTicks === false,
- tickFormatter,
+ hide: false,
+ tickFormatter: yAxis?.showTicks === false ? () => '' : tickFormatter,
// Quill ignores startAtZero on a log scale; floatBaseline (the false case) is line-only, so
// bars/combo keep their zero baseline regardless.
startAtZero: forceLinear || !isLog ? (yAxis?.startAtZero ?? yAxisAtZero ?? true) : undefined,
@@ -425,6 +435,10 @@ function buildValueLabelsConfig(
return undefined
}
return {
+ position: chartSettings.valueLabelPosition,
+ background: chartSettings.valueLabelBackground,
+ fontSize: chartSettings.valueLabelFontSize,
+ rotation: chartSettings.valueLabelRotation,
formatter: (_value, seriesIndex, _dataIndex, context) =>
formatSqlSeriesValue(context.rawValue, ySeriesData?.[seriesIndex]?.settings),
}
@@ -510,6 +524,8 @@ export function buildBarChartConfig({
goalLines: schemaGoalLinesToConfigs(goalLines),
showAxisLines: buildAxisLinesConfig(chartSettings),
barLayout,
+ bandPadding: chartSettings.barGap,
+ barCornerRadius: chartSettings.barGap === 0 ? 0 : undefined,
// Stacked bars must preserve negative values (SQL results can be negative) so they render
// below the zero baseline instead of being clamped to 0. Only the stacked layout stacks.
divergingStack: barLayout === 'stacked',
@@ -535,7 +551,7 @@ export function buildBarValueChartConfig({
legendRenderItem,
embedded,
}: BuildBarConfigArgs): SqlBarGraphConfig {
- const categoryAxis = buildXAxisConfig(xData, chartSettings, timezone)
+ const categoryAxis = buildXAxisConfig(xData, { ...chartSettings, showXAxisTicks: true }, timezone)
const valueAxis = buildYAxisConfig(chartSettings.leftYAxisSettings, ySeriesData ?? [], chartSettings.yAxisAtZero)
const dateLabelFormatter = buildSqlDateLabelFormatter(xData, timezone)
const categoryLabelFormatter = (label: string): string => {
@@ -548,7 +564,9 @@ export function buildBarValueChartConfig({
return '[No value]'
}
const stringValue = String(value)
- return dateLabelFormatter?.(stringValue) ?? stringValue
+ return chartSettings.xAxisDateFormat
+ ? (categoryAxis.tickFormatter?.(stringValue, index) ?? stringValue)
+ : (dateLabelFormatter?.(stringValue) ?? stringValue)
}
const referenceLines = goalLinesToReferenceLines(goalLines, series ?? [], 'horizontal')
const referenceLineValues = referenceLines.flatMap((line) => (typeof line.value === 'number' ? [line.value] : []))
@@ -556,9 +574,9 @@ export function buildBarValueChartConfig({
return {
axisOrientation: 'horizontal',
barLayout: 'grouped',
- barCornerRadius: 4,
+ barCornerRadius: chartSettings.barGap === 0 ? 0 : 4,
referenceLines,
- xTickFormatter: categoryLabelFormatter,
+ xTickFormatter: chartSettings.showXAxisTicks === false ? () => '' : categoryLabelFormatter,
yTickFormatter: valueAxis.tickFormatter,
yScaleType: valueAxis.scale,
hideXAxis: valueAxis.hide,
@@ -570,6 +588,7 @@ export function buildBarValueChartConfig({
maxCategoryLabelWidth: MAX_CATEGORY_LABEL_WIDTH,
bars: {
fitToHeight: embedded,
+ bandPadding: chartSettings.barGap,
valueDomain: referenceLineValues.length ? { include: referenceLineValues } : undefined,
},
legend: buildLegendConfig(chartSettings, legendRenderItem),
@@ -618,6 +637,8 @@ export function buildComboChartConfig({
goalLines: schemaGoalLinesToConfigs(goalLines),
showAxisLines: buildAxisLinesConfig(chartSettings),
barLayout,
+ bandPadding: chartSettings.barGap,
+ barCornerRadius: chartSettings.barGap === 0 ? 0 : undefined,
// Stacked bars must preserve negative values (SQL results can be negative) so they render
// below the zero baseline instead of being clamped to 0 — mirrors buildBarChartConfig.
divergingStack: barLayout === 'stacked',
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/DisplayTab.tsx b/frontend/src/queries/nodes/DataVisualization/Components/DisplayTab.tsx
index a15f1f6fe07e..b69d3b079853 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/DisplayTab.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/DisplayTab.tsx
@@ -265,10 +265,10 @@ export const DisplayTab = (): JSX.Element => {
updateChartSettings({ showLegend: value })
}}
/>
- <div className="flex flex-col gap-1">
+ <div className="flex items-center justify-between gap-2">
<LemonLabel>Legend position</LemonLabel>
<LemonSelect
- className="w-full"
+ size="xsmall"
value={
chartSettings.legendPosition ??
(isProportionBar ? 'bottom' : isPieChart ? 'right' : 'top')
@@ -278,7 +278,6 @@ export const DisplayTab = (): JSX.Element => {
showLegend ? undefined : 'Turn the legend on to set its position'
}
onChange={(value) => updateChartSettings({ legendPosition: value })}
- fullWidth
/>
</div>
{isBoxPlot && (
@@ -381,6 +380,118 @@ export const DisplayTab = (): JSX.Element => {
/>
</>
)}
+ {chartSettings.showValuesOnSeries && !isSingleAxisChart && (
+ <>
+ {!isLineChart && (
+ <div className="flex items-center justify-between gap-2">
+ <LemonLabel>Value position</LemonLabel>
+ <LemonSelect
+ size="xsmall"
+ value={chartSettings.valueLabelPosition ?? 'end'}
+ options={[
+ { value: 'end', label: 'At the end' },
+ { value: 'center', label: 'Inside' },
+ ]}
+ onChange={(valueLabelPosition) =>
+ updateChartSettings({ valueLabelPosition })
+ }
+ />
+ </div>
+ )}
+ <LemonSwitch
+ label="Value background"
+ checked={chartSettings.valueLabelBackground ?? true}
+ onChange={(valueLabelBackground) =>
+ updateChartSettings({ valueLabelBackground })
+ }
+ />
+ <div className="flex items-center justify-between gap-2">
+ <LemonLabel>Value font size</LemonLabel>
+ <LemonSelect
+ size="xsmall"
+ value={chartSettings.valueLabelFontSize ?? 12}
+ options={[8, 10, 12, 14, 16, 20, 24, 32].map((value) => ({
+ value,
+ label: `${value}px`,
+ }))}
+ onChange={(valueLabelFontSize) =>
+ updateChartSettings({ valueLabelFontSize })
+ }
+ />
+ </div>
+ <div className="flex items-center justify-between gap-2">
+ <LemonLabel>Value rotation</LemonLabel>
+ <LemonSelect
+ size="xsmall"
+ value={chartSettings.valueLabelRotation ?? 0}
+ options={[0, -45, -90, 45, 90].map((value) => ({
+ value,
+ label: `${value}°`,
+ }))}
+ onChange={(valueLabelRotation) =>
+ updateChartSettings({ valueLabelRotation })
+ }
+ />
+ </div>
+ </>
+ )}
+ {(isStackedBarChart ||
+ isHorizontalBarChart ||
+ effectiveVisualizationType === ChartDisplayType.ActionsBar) && (
+ <div className="flex items-center justify-between gap-2">
+ <LemonLabel>Bar spacing</LemonLabel>
+ <LemonSelect
+ size="xsmall"
+ value={chartSettings.barGap ?? 0.2}
+ options={[
+ { value: 0, label: 'None' },
+ { value: 0.1, label: 'Small' },
+ { value: 0.2, label: 'Medium' },
+ { value: 0.4, label: 'Large' },
+ ]}
+ onChange={(barGap) => updateChartSettings({ barGap })}
+ />
+ </div>
+ )}
+ {isDateXAxis && (
+ <div className="flex flex-col gap-1">
+ <LemonLabel>Date format</LemonLabel>
+ <LemonInput
+ value={chartSettings.xAxisDateFormat ?? ''}
+ placeholder="Automatic"
+ onChange={(xAxisDateFormat) =>
+ updateChartSettings({
+ xAxisDateFormat: xAxisDateFormat || undefined,
+ })
+ }
+ data-attr="chart-date-format"
+ />
+ <span className="text-xs text-secondary">
+ For example, YYYY-MM-DD, MMM YYYY, or DD/MM/YYYY.
+ </span>
+ </div>
+ )}
+ {!isSingleAxisChart && (
+ <div className="flex items-center justify-between gap-2">
+ <LemonLabel>Tick label rotation</LemonLabel>
+ <LemonSelect
+ size="xsmall"
+ value={chartSettings.xAxisTickRotation ?? null}
+ options={[
+ { value: null, label: 'Automatic' },
+ ...[0, -45, -90, 45, 90].map((value) => ({
+ value,
+ label: `${value}°`,
+ })),
+ ]}
+ onChange={(xAxisTickRotation) =>
+ updateChartSettings({
+ xAxisTickRotation: xAxisTickRotation ?? undefined,
+ })
+ }
+ />
+ </div>
+ )}
{isLineChart && (
<div className="flex flex-col gap-1">
<LemonLabel>Line style</LemonLabel>
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.tsx b/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.tsx
index ef893ab00a13..92a92108ff73 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.tsx
@@ -770,7 +770,8 @@ const BreakdownSeries = ({
const theme = getTheme(undefined)
const themeTokens = theme ? (Object.keys(theme) as DataColorToken[]) : []
- const selectedToken = chartSettings.resultCustomizations?.[series.breakdownValue]?.color ?? null
+ const customization = chartSettings.resultCustomizations?.[series.breakdownValue]
+ const selectedToken = customization?.customColor ? null : (customization?.color ?? null)
const seriesColor = series.settings?.display?.color ?? getSeriesColor(index)
return (
@@ -779,13 +780,29 @@ const BreakdownSeries = ({
colorTokens={themeTokens}
selectedColorToken={selectedToken}
customButton={<LemonColorButton type="tertiary" color={seriesColor} className="mr-2" />}
+ showCustomColor
+ customColorValue={chartSettings.resultCustomizations?.[series.breakdownValue]?.customColor}
+ onSelectCustomColor={(customColor) =>
+ updateChartSettings({
+ resultCustomizations: {
+ ...chartSettings.resultCustomizations,
+ [series.breakdownValue]: {
+ ...chartSettings.resultCustomizations?.[series.breakdownValue],
+ assignmentBy: ResultCustomizationBy.Value,
+ customColor,
+ },
+ },
+ })
+ }
onSelectColorToken={(token) => {
updateChartSettings({
resultCustomizations: {
...chartSettings.resultCustomizations,
[series.breakdownValue]: {
+ ...chartSettings.resultCustomizations?.[series.breakdownValue],
assignmentBy: ResultCustomizationBy.Value,
color: token,
+ customColor: undefined,
},
},
})
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.test.ts b/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.test.ts
index d9c3856367a3..53d818260d3e 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.test.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.test.ts
@@ -2,7 +2,7 @@ import { expectLogic } from 'kea-test-utils'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-import { VisualizationNode, NodeKind } from '~/queries/schema/schema-general'
+import { VisualizationNode, NodeKind, ResultCustomizationBy } from '~/queries/schema/schema-general'
import { initKeaTests } from '~/test/init'
import { ChartDisplayType } from '~/types'
@@ -339,6 +339,35 @@ describe('seriesBreakdownLogic', () => {
})
})
+ it('applies a custom color to one breakdown value', () => {
+ logic = seriesBreakdownLogic({ key: testUniqueKey })
+ logic.mount()
+ const node = dataNodeLogic({ key: testUniqueKey, query: globalQuery.source })
+ node.mount()
+ node.actions.setResponse({
+ results: [
+ ['signed_up', 'Safari', 11],
+ ['signed_up', 'Chrome', 22],
+ ],
+ columns: ['event', 'browser', 'total_count'],
+ types: [
+ ['event', 'String'],
+ ['browser', 'String'],
+ ['total_count', 'UInt64'],
+ ],
+ })
+ builtDataVizLogic.actions.clearAxis()
+ builtDataVizLogic.actions.updateXSeries('event')
+ builtDataVizLogic.actions.addYSeries('total_count')
+ logic.actions.addSeriesBreakdown('browser')
+ builtDataVizLogic.actions.updateChartSettings({
+ resultCustomizations: { Safari: { assignmentBy: ResultCustomizationBy.Value, customColor: '#123456' } },
+ })
+ const series = logic.values.seriesBreakdownData.seriesData
+ expect(series.find((entry) => entry.breakdownValue === 'Safari')?.settings?.display?.color).toBe('#123456')
+ expect(series.find((entry) => entry.breakdownValue === 'Chrome')?.settings?.display?.color).toBeUndefined()
+ })
+
it.each([
{ xColumn: 'event', breakdownColumn: 'browser' },
{ xColumn: 'browser', breakdownColumn: 'event' },
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts b/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts
index 94d76e7d1501..7a0eabbf859c 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts
@@ -312,6 +312,17 @@ export const seriesBreakdownLogic = kea<seriesBreakdownLogicType>([
// xData is unique x values
const xData = Array.from(new Set(data.map((n) => n[xColumn.dataIndex])))
+ const rowsByBreakdown = new Map<unknown, any[]>()
+ for (const row of data) {
+ const value = row[breakdownColumn.dataIndex]
+ const rows = rowsByBreakdown.get(value)
+ if (rows) {
+ rows.push(row)
+ } else {
+ rowsByBreakdown.set(value, [row])
+ }
+ }
+
let isUnaggregated = false
const multipleYSeries = yAxis.length > 1
@@ -341,10 +352,10 @@ export const seriesBreakdownLogic = kea<seriesBreakdownLogicType>([
const breakdownValue = getBreakdownValueKey(value)
const customColorToken = resultCustomizations[breakdownValue]?.color
const customColor =
- customColorToken && theme ? getColorFromToken(theme, customColorToken) : undefined
+ resultCustomizations[breakdownValue]?.customColor ??
+ (customColorToken && theme ? getColorFromToken(theme, customColorToken) : undefined)
- // first filter data by breakdown column value
- const filteredData = data.filter((n) => n[breakdownColumn.dataIndex] === value)
+ const filteredData = rowsByBreakdown.get(value) ?? []
if (filteredData.length === 0) {
return {
name: seriesName,
@@ -357,30 +368,20 @@ export const seriesBreakdownLogic = kea<seriesBreakdownLogicType>([
}
}
- // check if there are any duplicates of xColumn values
- // (if we know there is unaggregated data, we don't need to check again)
- if (!isUnaggregated) {
- const xColumnValues = filteredData.map((n) => n[xColumn.dataIndex])
- const xColumnValuesSet = new Set(xColumnValues)
- if (xColumnValues.length !== xColumnValuesSet.size) {
+ const totalsByX = new Map<unknown, number | null>()
+ for (const row of filteredData) {
+ const xValue = row[xColumn.dataIndex]
+ if (totalsByX.has(xValue)) {
isUnaggregated = true
}
+ const numeric = parseBreakdownSeriesValue(row[yColumn.dataIndex], selectedYAxis)
+ const previous = totalsByX.get(xValue)
+ totalsByX.set(xValue, numeric === null ? (previous ?? null) : (previous ?? 0) + numeric)
}
// Missing buckets should remain null unless the chart explicitly
// requests zero-filling, matching the non-breakdown series path.
- const dataset = xData.map((xValue) => {
- const numericValues = filteredData
- .filter((n) => n[xColumn.dataIndex] === xValue)
- .map((n) => parseBreakdownSeriesValue(n[yColumn.dataIndex], selectedYAxis))
- .filter((value): value is number => value !== null)
-
- if (numericValues.length === 0) {
- return showNullsAsZero ? 0 : null
- }
-
- return numericValues.reduce((a, b) => a + b, 0)
- })
+ const dataset = xData.map((xValue) => totalsByX.get(xValue) ?? (showNullsAsZero ? 0 : null))
return {
name: seriesName,
diff --git a/frontend/src/queries/nodes/DataVisualization/DataVisualization.tsx b/frontend/src/queries/nodes/DataVisualization/DataVisualization.tsx
index efabe9a129dd..f9f58b97a176 100644
--- a/frontend/src/queries/nodes/DataVisualization/DataVisualization.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/DataVisualization.tsx
@@ -285,6 +285,7 @@ function InternalDataTableVisualization(props: DataTableVisualizationProps): JSX
query.kind === NodeKind.BIVisualizationNode &&
(xData?.column.type.name === 'DATE' || xData?.column.type.name === 'DATETIME') &&
dateBucket !== 'year' &&
+ !chartSettings.xAxisDateFormat &&
effectiveVisualizationType !== ChartDisplayType.ActionsBarValue &&
chartSettings.showXAxisTicks !== false
const dateAxis = useMemo(
@@ -667,7 +668,7 @@ function InternalDataTableVisualization(props: DataTableVisualizationProps): JSX
<AddVariableButton buttonProps={{ size: controlSize }} />
{sourceFeatures.has(QueryFeature.dateRangePicker) &&
- !(query.kind === NodeKind.BIVisualizationNode && query.config.querySnapshot) &&
+ query.kind !== NodeKind.BIVisualizationNode &&
!router.values.location.pathname.includes(urls.sqlEditor()) && ( // decouple this component from insights tab and datawarehouse scene
<DateRange
key="date-range"
diff --git a/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts b/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts
index c2aece7e61d7..a618db7cd61c 100644
--- a/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts
@@ -48,6 +48,7 @@ import {
import { QueryContext } from '~/queries/types'
import { ChartDisplayType, DashboardType } from '~/types'
+import { captureBIWorksheetAction } from 'products/business_intelligence/frontend/biEditorAnalytics'
import { getBIResultDimensions } from 'products/business_intelligence/frontend/biEditorTypes'
import { getBIAutoChartType } from 'products/business_intelligence/frontend/biEditorTypes'
import { createBIMemberDisplayLookup } from 'products/business_intelligence/frontend/biMemberAliases'
@@ -2023,6 +2024,11 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
}
},
updateChartSettings: ({ settings }) => {
+ if (values.query.kind === NodeKind.BIVisualizationNode) {
+ captureBIWorksheetAction('chart_settings_changed', values.query.config, {
+ setting_keys: Object.keys(settings),
+ })
+ }
actions.setQuery((query) => ({
...query,
chartSettings: mergeChartSettings(query.chartSettings ?? ({} as ChartSettings), settings),
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 792ef874b1ba..51545e8938f6 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -17579,6 +17579,9 @@
"ChartSettings": {
"additionalProperties": false,
"properties": {
+ "barGap": {
+ "type": "number"
+ },
"boxPlot": {
"$ref": "#/definitions/BoxPlotSettings"
},
@@ -17656,12 +17659,31 @@
"description": "Whether we fill the bars to 100% in stacked mode",
"type": "boolean"
},
+ "valueLabelBackground": {
+ "type": "boolean"
+ },
+ "valueLabelFontSize": {
+ "type": "number"
+ },
+ "valueLabelPosition": {
+ "enum": ["end", "center"],
+ "type": "string"
+ },
+ "valueLabelRotation": {
+ "type": "number"
+ },
"xAxis": {
"$ref": "#/definitions/ChartAxis"
},
+ "xAxisDateFormat": {
+ "type": "string"
+ },
"xAxisLabel": {
"type": "string"
},
+ "xAxisTickRotation": {
+ "type": "number"
+ },
"yAxis": {
"items": {
"$ref": "#/definitions/ChartAxis"
@@ -51133,6 +51155,9 @@
"color": {
"$ref": "#/definitions/DataColorToken"
},
+ "customColor": {
+ "type": "string"
+ },
"hidden": {
"type": "boolean"
}
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 4ca5c8581486..f1b8500458cd 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -1556,6 +1556,8 @@ export interface YAxisSettings {
export interface ChartSettings {
xAxis?: ChartAxis
xAxisLabel?: string
+ xAxisDateFormat?: string
+ xAxisTickRotation?: number
yAxis?: ChartAxis[]
goalLines?: GoalLine[]
/** Deprecated: use `[left|right]YAxisSettings`. Whether the Y axis should start at zero */
@@ -1573,6 +1575,11 @@ export interface ChartSettings {
/** Where the legend sits relative to the chart. Unset falls back per chart type: right for pie and donut, bottom for proportion bar, top for the rest. */
legendPosition?: 'top' | 'bottom' | 'left' | 'right'
showValuesOnSeries?: boolean
+ valueLabelPosition?: 'end' | 'center'
+ valueLabelBackground?: boolean
+ valueLabelFontSize?: number
+ valueLabelRotation?: number
+ barGap?: number
// Deprecated: superseded by `pie.showTotal`. Retained so pre-existing pie-chart insights still
// validate (ChartSettings is `extra="forbid"`). Read as a fallback in the pie chart components.
showPieTotal?: boolean
@@ -2005,6 +2012,7 @@ export interface ResultCustomizationByPosition extends ResultCustomizationBase {
}
export interface ResultCustomizationByValue extends ResultCustomizationBase {
+ customColor?: string
assignmentBy: ResultCustomizationBy.Value
}
diff --git a/packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx b/packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx
index 5590e8326915..26209c84d0b4 100644
--- a/packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx
+++ b/packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx
@@ -195,6 +195,7 @@ function BarChartInner<Meta = unknown>({
stackedSeries,
maxBandRange,
bandPadding,
+ groupPadding: bandPadding === 0 ? 0 : undefined,
fitToHeight,
minBandSize: resolvedMinBandSize,
minBarSize,
diff --git a/packages/quill/packages/charts/src/charts/ComboChart/ComboChart.tsx b/packages/quill/packages/charts/src/charts/ComboChart/ComboChart.tsx
index 24f1e7c643eb..1eceb7a98ac9 100644
--- a/packages/quill/packages/charts/src/charts/ComboChart/ComboChart.tsx
+++ b/packages/quill/packages/charts/src/charts/ComboChart/ComboChart.tsx
@@ -149,6 +149,8 @@ function ComboChartInner<Meta = unknown>({
barLayout,
seriesTypeOf,
barStackedData,
+ bandPadding: config?.bandPadding,
+ groupPadding: config?.bandPadding === 0 ? 0 : undefined,
valueDomain,
axes: configYAxes,
})
@@ -183,7 +185,7 @@ function ComboChartInner<Meta = unknown>({
_private: comboPrivate,
}
},
- [yScaleType, barLayout, seriesTypeOf, barStackedData, valueDomain, configYAxes]
+ [yScaleType, barLayout, seriesTypeOf, barStackedData, valueDomain, configYAxes, config?.bandPadding]
)
const drawStatic = useCallback(
diff --git a/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx b/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx
index 3ec4a104e6f1..f5591479cdf5 100644
--- a/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx
+++ b/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx
@@ -199,7 +199,7 @@ export function TimeSeriesBarChart<Meta = unknown>({
>
{referenceLines.length > 0 && <ReferenceLines lines={referenceLines} />}
{trendSeries.length > 0 && <TrendLineOverlay trendSeries={trendSeries} />}
- {valueLabelsConfig && <ValueLabels valueFormatter={valueLabelFormatter} />}
+ {valueLabelsConfig && <ValueLabels {...valueLabelsConfig} valueFormatter={valueLabelFormatter} />}
{children}
</BarChart>
</ChartLegend>
diff --git a/packages/quill/packages/charts/src/charts/TimeSeriesComboChart/TimeSeriesComboChart.tsx b/packages/quill/packages/charts/src/charts/TimeSeriesComboChart/TimeSeriesComboChart.tsx
index db287d8cf841..1fe2b04f08ba 100644
--- a/packages/quill/packages/charts/src/charts/TimeSeriesComboChart/TimeSeriesComboChart.tsx
+++ b/packages/quill/packages/charts/src/charts/TimeSeriesComboChart/TimeSeriesComboChart.tsx
@@ -42,6 +42,8 @@ export interface TimeSeriesComboChartConfig {
divergingStack?: boolean
/** Stacked bars only round the topmost segment. */
barCornerRadius?: number
+ /** Inner gap between bar bands as a fraction of their slot. */
+ bandPadding?: number
/** Show a vertical crosshair line that follows the cursor. */
showCrosshair?: boolean
/** Horizontal grid lines, aligned to the primary y-axis ticks. `showGrid` on the primary
@@ -99,6 +101,7 @@ export function TimeSeriesComboChart<Meta = unknown>({
barLayout,
divergingStack,
barCornerRadius,
+ bandPadding,
showCrosshair,
showGrid,
showAxisLines,
@@ -144,6 +147,7 @@ export function TimeSeriesComboChart<Meta = unknown>({
barLayout,
divergingStack,
barCornerRadius,
+ bandPadding,
tooltip: timeSeriesTooltipConfig,
valueDomain: mergeValueDomains(config?.valueDomain, valueDomain),
yAxes,
@@ -164,7 +168,7 @@ export function TimeSeriesComboChart<Meta = unknown>({
>
{referenceLines.length > 0 && <ReferenceLines lines={referenceLines} />}
{trendSeries.length > 0 && <TrendLineOverlay trendSeries={trendSeries} />}
- {valueLabelsConfig && <ValueLabels valueFormatter={valueLabelFormatter} />}
+ {valueLabelsConfig && <ValueLabels {...valueLabelsConfig} valueFormatter={valueLabelFormatter} />}
{children}
</ComboChart>
</ChartLegend>
diff --git a/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx b/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx
index 7a509286a6ad..fd29ac04d615 100644
--- a/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx
+++ b/packages/quill/packages/charts/src/charts/TimeSeriesLineChart/TimeSeriesLineChart.tsx
@@ -184,7 +184,9 @@ export function TimeSeriesLineChart<Meta = unknown>({
onError={onError}
>
{referenceLines.length > 0 && <ReferenceLines lines={referenceLines} />}
- {valueLabelsConfig && <ValueLabels valueFormatter={valueLabelFormatter} />}
+ {valueLabelsConfig && (
+ <ValueLabels {...valueLabelsConfig} position="end" valueFormatter={valueLabelFormatter} />
+ )}
{children}
</LineChart>
</ChartLegend>
diff --git a/packages/quill/packages/charts/src/charts/utils/use-value-labels.ts b/packages/quill/packages/charts/src/charts/utils/use-value-labels.ts
index 15dc98e505f9..ea6843dad27f 100644
--- a/packages/quill/packages/charts/src/charts/utils/use-value-labels.ts
+++ b/packages/quill/packages/charts/src/charts/utils/use-value-labels.ts
@@ -1,9 +1,9 @@
import { useMemo } from 'react'
import type { Series } from '../../core/types'
-import type { ValueLabelFormatter } from '../../overlays/ValueLabels'
+import type { ValueLabelFormatter, ValueLabelsProps } from '../../overlays/ValueLabels'
-export interface ValueLabelsConfig {
+export interface ValueLabelsConfig extends Pick<ValueLabelsProps, 'position' | 'background' | 'fontSize' | 'rotation'> {
seriesKeys?: string[]
/** Per-segment label text — see `ValueLabelFormatter` for the context and empty-string contract. */
formatter?: ValueLabelFormatter
diff --git a/packages/quill/packages/charts/src/core/types.ts b/packages/quill/packages/charts/src/core/types.ts
index 588abd0ee35c..9e265eec9a39 100644
--- a/packages/quill/packages/charts/src/core/types.ts
+++ b/packages/quill/packages/charts/src/core/types.ts
@@ -453,7 +453,8 @@ export interface BarsConfig {
* still span the full width — useful for few-category funnel-style charts. */
maxBandRange?: number
/** Inner gap between bars as a fraction of the band slot (0–1). Outer padding is half this
- * value, so `step = range / N`. Defaults to `DEFAULT_BAND_PADDING` in `scales.ts`. */
+ * value, so `step = range / N`. Zero also removes spacing within grouped bars.
+ * Defaults to `DEFAULT_BAND_PADDING` in `scales.ts`. */
bandPadding?: number
/** Floor (px) on a bar's thickness along the value axis, so a present-but-tiny value stays
* visible instead of collapsing to a sub-pixel sliver — e.g. a single error in a volume bucket
@@ -520,6 +521,8 @@ export interface LineChartConfig extends ChartConfig {
/** Config for {@link ComboChart}, which draws bar, line, and area series together. `axisOrientation`
* is omitted on purpose — bars require a band x-axis, so combo charts are vertical-only. */
export interface ComboChartConfig extends Omit<ChartConfig, 'axisOrientation'> {
+ /** Gap between bar bands (0–1, default 0.2). Zero also removes within-group spacing. */
+ bandPadding?: number
/** Type used for series that don't set {@link Series.type}. Defaults to `'line'`. */
defaultSeriesType?: SeriesType
/** Layout applied to *bar* series only — lines and areas never stack or group. Defaults to
diff --git a/packages/quill/packages/charts/src/docs/bars.md b/packages/quill/packages/charts/src/docs/bars.md
index 80ea0d01bd94..9029741a7ea7 100644
--- a/packages/quill/packages/charts/src/docs/bars.md
+++ b/packages/quill/packages/charts/src/docs/bars.md
@@ -9,6 +9,7 @@ Field docs live on `BarChartConfig` and `BarsConfig` in `core/types.ts`; the per
- `axisOrientation: 'horizontal'` for horizontal bars. Drag-to-zoom is disabled there, since the interaction axis is vertical.
- `divergingStack` (stacked only) stacks negative values below the zero baseline instead of clamping them to 0. Same semantics on `ComboChart` and `TimeSeriesComboChart`.
- `barCornerRadius` rounds the end caps. It is a top-level key on every bar-capable chart, including the time-series and combo configs.
+- Set `bandPadding: 0` to remove both category and within-group gaps. Set `barCornerRadius: 0` for adjoining square bars. `TimeSeriesComboChart` accepts the same top-level `bandPadding` setting.
- `TimeSeriesBarChart` takes `minBarSize`, `bandPadding`, `margins`, and `maxCategoryLabelWidth` as top-level config keys (alongside `barCornerRadius` and `fillStyle`) rather than under `bars`.
## Per-bar overrides
diff --git a/packages/quill/packages/charts/src/docs/overlays.md b/packages/quill/packages/charts/src/docs/overlays.md
index 2e615c858aec..e3be01a44e58 100644
--- a/packages/quill/packages/charts/src/docs/overlays.md
+++ b/packages/quill/packages/charts/src/docs/overlays.md
@@ -37,6 +37,9 @@ In percent layouts `value` is a 0..1 fraction; `context.rawValue` holds the orig
`mode="stack-total"` labels only the stack top.
For per-segment bar labels, `position="center"` places each label inside its segment, including in horizontal percent stacks.
The default `position="end"` preserves labels at bar ends.
+Use `background={false}` for unboxed text, `fontSize` (8–32 pixels, default 12), and `rotation` (−90° to 90°, default 0).
+Collision detection accounts for the rotated text bounds; centered text uses the bar color to choose readable contrast.
+These options also work in `config.valueLabels` on time-series charts.
`series.visibility.valueLabel: false` skips a series.
On the time-series charts, prefer `config.valueLabels` so the chart sizes its margins for the labels.
diff --git a/packages/quill/packages/charts/src/overlays/ValueLabels.stories.tsx b/packages/quill/packages/charts/src/overlays/ValueLabels.stories.tsx
index 02519d4495b9..e517f2bf42cf 100644
--- a/packages/quill/packages/charts/src/overlays/ValueLabels.stories.tsx
+++ b/packages/quill/packages/charts/src/overlays/ValueLabels.stories.tsx
@@ -20,6 +20,22 @@ export default meta
type Story = StoryObj<{}>
+export const PlainRotatedLabels: Story = {
+ render: () => {
+ const theme = useReactiveTheme()
+ const series: Series[] = [
+ { key: 'visits', label: 'Visits', color: '', data: [20, 35, 28, 60, 45, 70, 52] },
+ ]
+ return (
+ <Stage>
+ <LineChart series={series} labels={LABELS} config={CONFIG} theme={theme}>
+ <ValueLabels background={false} fontSize={16} rotation={-45} />
+ </LineChart>
+ </Stage>
+ )
+ },
+}
+
export const SingleSeries: Story = {
render: () => {
const theme = useReactiveTheme()
diff --git a/packages/quill/packages/charts/src/overlays/ValueLabels.test.tsx b/packages/quill/packages/charts/src/overlays/ValueLabels.test.tsx
index 0d39e0a5669a..feed80b31f63 100644
--- a/packages/quill/packages/charts/src/overlays/ValueLabels.test.tsx
+++ b/packages/quill/packages/charts/src/overlays/ValueLabels.test.tsx
@@ -476,7 +476,7 @@ describe('ValueLabels', () => {
).toEqual(['20%', '40%', '60%', '80%'])
})
- it('centers labels inside horizontal percent segments, including the final segment', () => {
+ it.each([true, false])('centers horizontal percent labels with background=%s', (background) => {
const series: ResolvedSeries[] = [
{ key: 'a', label: 'A', color: '#f00', data: [20] },
{ key: 'b', label: 'B', color: '#ff0', data: [30] },
@@ -490,8 +490,12 @@ describe('ValueLabels', () => {
scales: { x: xScale, y: (value) => 48 + value * 720, yTicks: () => [] },
resolvePositionValue: (s) => tops[s.key],
})
- const { container } = renderInChart(ctx, <ValueLabels position="center" />)
+ const { container } = renderInChart(ctx, <ValueLabels position="center" background={background} fontSize={16} rotation={-45} />)
expect(labelDivs(container).map((label) => label.style.left)).toEqual(['120px', '300px', '588px'])
+ const text = labelDivs(container)[0].querySelector('span')!
+ expect(text.style.fontSize).toBe('16px')
+ expect(text.style.transform).toBe('rotate(-45deg)')
+ expect(text.style.backgroundColor).toBe(background ? 'rgb(255, 0, 0)' : 'transparent')
})
describe('offset', () => {
diff --git a/packages/quill/packages/charts/src/overlays/ValueLabels.tsx b/packages/quill/packages/charts/src/overlays/ValueLabels.tsx
index 3e868c574cad..a7c07e786141 100644
--- a/packages/quill/packages/charts/src/overlays/ValueLabels.tsx
+++ b/packages/quill/packages/charts/src/overlays/ValueLabels.tsx
@@ -1,7 +1,7 @@
import React, { useMemo } from 'react'
import { useChartHover, useChartLayout } from '../core/chart-context'
-import { barColorAt } from '../core/color-utils'
+import { barColorAt, perceivedLuminance } from '../core/color-utils'
import { resolveYScaleForSeries } from '../core/scales'
import type { ChartDimensions, ChartScales, ResolvedSeries, ResolveValueFn } from '../core/types'
import { getTextMeasureCtx } from '../utils/text-measure'
@@ -40,6 +40,12 @@ export interface ValueLabelsProps {
mode?: ValueLabelsMode
/** Per-segment labels only: place labels at the bar end (default) or inside the segment's center. */
position?: 'end' | 'center'
+ /** Draw a series-colored badge behind the text. Defaults to true. */
+ background?: boolean
+ /** Label size in pixels, clamped to 8..32. */
+ fontSize?: number
+ /** Label rotation in degrees, clamped to -90..90. */
+ rotation?: number
/** Gap in px between the bar tip and the label, applied along the value axis in the outward
* direction (right/above the tip, or inward for labels flipped inside a clipped bar). Ignored
* for centered (`percent`) labels. Defaults to 0 — the label's edge sits on the bar tip. */
@@ -63,6 +69,7 @@ interface Candidate {
x: number
y: number
width: number
+ height: number
color: string
above: boolean
/** Center the label across the value-axis coord instead of anchoring its leading edge there. */
@@ -111,6 +118,7 @@ function pushCandidate(
x: isHorizontal ? valueCoord : categoricalCoord,
y: isHorizontal ? categoricalCoord : valueCoord,
width,
+ height: LABEL_HEIGHT,
color,
above,
centerAnchor,
@@ -261,8 +269,8 @@ function buildPerSegment(args: BuildCandidatesArgs, ctx: CanvasRenderingContext2
// label on its own bar rather than the band center between bars. Other chart
// types ignore the second arg and fall back to the band/point center.
const categoricalCoord = scales.x(labels[dIdx], s.key)
- const valueCoord =
- position === 'center' ? (yScale(yValue) + yScale(yValue - displayValue)) / 2 : yScale(yValue)
+ const centerInSegment = position === 'center' && s.type !== 'line'
+ const valueCoord = centerInSegment ? (yScale(yValue) + yScale(yValue - displayValue)) / 2 : yScale(yValue)
if (categoricalCoord == null || !isFinite(categoricalCoord) || !isFinite(valueCoord)) {
continue
}
@@ -288,7 +296,7 @@ function buildPerSegment(args: BuildCandidatesArgs, ctx: CanvasRenderingContext2
categoricalCoord,
valueCoord,
above,
- isPercent || position === 'center'
+ isPercent || centerInSegment
)
}
}
@@ -304,7 +312,7 @@ interface Rect {
function labelRect(c: Candidate, isHorizontal: boolean): Rect {
if (isHorizontal) {
- const halfH = LABEL_HEIGHT / 2
+ const halfH = c.height / 2
let left: number
if (c.centerAnchor) {
left = c.x - c.width / 2
@@ -316,11 +324,11 @@ function labelRect(c: Candidate, isHorizontal: boolean): Rect {
const halfW = c.width / 2
let top: number
if (c.centerAnchor) {
- top = c.y - LABEL_HEIGHT / 2
+ top = c.y - c.height / 2
} else {
- top = c.above ? c.y - LABEL_HEIGHT : c.y
+ top = c.above ? c.y - c.height : c.y
}
- return { left: c.x - halfW, right: c.x + halfW, top, bottom: top + LABEL_HEIGHT }
+ return { left: c.x - halfW, right: c.x + halfW, top, bottom: top + c.height }
}
function rectsOverlap(a: Rect, b: Rect, gap: number): boolean {
@@ -343,8 +351,8 @@ function fitsWithinWrapper(c: Candidate, above: boolean, dimensions: ChartDimens
const left = above ? c.x : c.x - c.width
return left >= 0 && left + c.width <= dimensions.width
}
- const top = above ? c.y - LABEL_HEIGHT : c.y
- return top >= 0 && top + LABEL_HEIGHT <= dimensions.height
+ const top = above ? c.y - c.height : c.y
+ return top >= 0 && top + c.height <= dimensions.height
}
// If the default placement (above/right of the bar) would push the label past the chart
@@ -462,6 +470,9 @@ export function ValueLabels({
mode = 'per-segment',
position = 'end',
offset = 0,
+ background = true,
+ fontSize = 12,
+ rotation = 0,
}: ValueLabelsProps): React.ReactElement | null {
const { series, scales, labels, theme, resolvePositionValue, axis, dimensions } = useChartLayout()
const { hoverIndex } = useChartHover()
@@ -469,6 +480,9 @@ export function ValueLabels({
const isPercent = axis.isPercent
const formatter = valueFormatter ?? defaultLocaleFormatter
+ const resolvedFontSize = Number.isFinite(fontSize) ? Math.min(32, Math.max(8, fontSize)) : 12
+ const resolvedRotation = Number.isFinite(rotation) ? Math.min(90, Math.max(-90, rotation)) : 0
+ const labelHeight = resolvedFontSize + 10
const visible = useMemo(
() =>
@@ -484,7 +498,19 @@ export function ValueLabels({
mode,
position,
isPercent,
- }).filter((c) => withinPlotArea(c, dimensions, isHorizontal)),
+ })
+ .map((candidate) => {
+ const width =
+ ((candidate.width - LABEL_HORIZONTAL_CHROME) * resolvedFontSize) / 12 +
+ LABEL_HORIZONTAL_CHROME
+ const radians = (resolvedRotation * Math.PI) / 180
+ return {
+ ...candidate,
+ width: Math.abs(Math.cos(radians) * width) + Math.abs(Math.sin(radians) * labelHeight),
+ height: Math.abs(Math.sin(radians) * width) + Math.abs(Math.cos(radians) * labelHeight),
+ }
+ })
+ .filter((c) => withinPlotArea(c, dimensions, isHorizontal)),
dimensions,
isHorizontal
),
@@ -503,6 +529,9 @@ export function ValueLabels({
position,
isPercent,
dimensions,
+ resolvedFontSize,
+ resolvedRotation,
+ labelHeight,
]
)
@@ -542,15 +571,38 @@ export function ValueLabels({
data-attr="hog-chart-value-label"
style={{
...LABEL_STYLE_BASE,
- backgroundColor: c.color,
- borderColor,
+ width: c.width,
+ height: c.height,
+ padding: 0,
+ backgroundColor: background && resolvedRotation === 0 ? c.color : 'transparent',
+ borderColor: background && resolvedRotation === 0 ? borderColor : 'transparent',
+ borderWidth: background && resolvedRotation === 0 ? LABEL_BORDER : 0,
left: Math.round(c.x),
top: Math.round(c.y),
transform: transformFor(c, isHorizontal, isHovered, offset),
willChange: isHovered ? 'transform' : undefined,
}}
>
- {c.text}
+ <span
+ style={{
+ ...LABEL_STYLE_BASE,
+ position: 'static',
+ flexShrink: 0,
+ height: labelHeight,
+ fontSize: resolvedFontSize,
+ color:
+ background || c.centerAnchor
+ ? perceivedLuminance(c.color) < 0.5
+ ? 'white'
+ : 'black'
+ : theme.axisColor,
+ backgroundColor: background && resolvedRotation !== 0 ? c.color : 'transparent',
+ borderColor: background && resolvedRotation !== 0 ? borderColor : 'transparent',
+ transform: `rotate(${resolvedRotation}deg)`,
+ }}
+ >
+ {c.text}
+ </span>
</div>
)
})}
diff --git a/posthog/schema.py b/posthog/schema.py
index eb19ff701b69..cdf83e7ad33b 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -328,6 +328,7 @@ from posthog.schema_enums import (
UsageMetricDisplay as UsageMetricDisplay,
UsageMetricFormat as UsageMetricFormat,
ValueDisplay as ValueDisplay,
+ ValueLabelPosition as ValueLabelPosition,
WebAgentAnalyticsQueryType as WebAgentAnalyticsQueryType,
WebAgentContentGrouping as WebAgentContentGrouping,
WebAnalyticsItemKind as WebAnalyticsItemKind,
@@ -3150,6 +3151,7 @@ class ResultCustomizationByValue(BaseModel):
)
assignmentBy: Literal["value"] = "value"
color: DataColorToken | None = None
+ customColor: str | None = None
hidden: bool | None = None
@@ -16851,6 +16853,7 @@ class ChartSettings(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
+ barGap: float | None = None
boxPlot: BoxPlotSettings | None = None
chartStyle: ChartStyle | None = Field(
default=None,
@@ -16886,8 +16889,14 @@ class ChartSettings(BaseModel):
showXAxisTicks: bool | None = None
showYAxisBorder: bool | None = None
stackBars100: bool | None = Field(default=None, description="Whether we fill the bars to 100% in stacked mode")
+ valueLabelBackground: bool | None = None
+ valueLabelFontSize: float | None = None
+ valueLabelPosition: ValueLabelPosition | None = None
+ valueLabelRotation: float | None = None
xAxis: ChartAxis | None = None
+ xAxisDateFormat: str | None = None
xAxisLabel: str | None = None
+ xAxisTickRotation: float | None = None
yAxis: list[ChartAxis] | None = None
yAxisAtZero: bool | None = Field(
default=None,
diff --git a/posthog/schema_enums.py b/posthog/schema_enums.py
index ca9ae73c0e59..061ce15162fc 100644
--- a/posthog/schema_enums.py
+++ b/posthog/schema_enums.py
@@ -829,6 +829,11 @@ class ChartDisplayType(StrEnum):
SCATTER_PLOT = "ScatterPlot"
+class ValueLabelPosition(StrEnum):
+ END = "end"
+ CENTER = "center"
+
+
class Curve(StrEnum):
LINEAR = "linear"
SMOOTH = "smooth"
diff --git a/products/business_intelligence/frontend/BICalculatedMeasureModal.tsx b/products/business_intelligence/frontend/BICalculatedMeasureModal.tsx
index 88c079bd20c2..34a54270286a 100644
--- a/products/business_intelligence/frontend/BICalculatedMeasureModal.tsx
+++ b/products/business_intelligence/frontend/BICalculatedMeasureModal.tsx
@@ -10,7 +10,13 @@ import { escapeDottedHogQLIdentifier } from '~/queries/utils'
import { biEditorLogic } from 'products/business_intelligence/frontend/biEditorLogic'
export function BICalculatedMeasureModal(): JSX.Element | null {
- const { calculatedMeasureDraft: draft, calculatedFieldError, config } = useValues(biEditorLogic)
+ const {
+ calculatedMeasureDraft: draft,
+ calculatedFieldError,
+ calculatedFieldValidation,
+ calculatedFieldMetadata,
+ config,
+ } = useValues(biEditorLogic)
const { setCalculatedMeasureDraft, saveCalculatedMeasure } = useActions(biEditorLogic)
if (!draft || !config.source) {
@@ -32,7 +38,11 @@ export function BICalculatedMeasureModal(): JSX.Element | null {
<LemonButton
type="primary"
onClick={saveCalculatedMeasure}
- disabledReason={calculatedFieldError}
+ loading={calculatedFieldValidation === 'checking'}
+ disabledReason={
+ calculatedFieldError ??
+ (calculatedFieldValidation !== 'valid' ? 'Enter a valid SQL expression' : undefined)
+ }
data-attr="bi-calculated-measure-save"
>
{draft.index === null && !draft.fieldId ? 'Add field' : 'Save field'}
@@ -53,9 +63,7 @@ export function BICalculatedMeasureModal(): JSX.Element | null {
{ value: 'dimension', label: 'Dimension · one value per row' },
{ value: 'measure', label: 'Measure · aggregate each group' },
]}
- onChange={(kind) =>
- setCalculatedMeasureDraft({ ...draft, kind, type: kind === 'measure' ? 'float' : 'string' })
- }
+ onChange={(kind) => setCalculatedMeasureDraft({ ...draft, kind })}
disabledReason={
draft.fieldId || draft.index !== null ? 'Create a new field to change its role' : undefined
}
@@ -71,8 +79,9 @@ export function BICalculatedMeasureModal(): JSX.Element | null {
{ value: 'boolean', label: 'Boolean' },
{ value: 'date', label: 'Date' },
{ value: 'datetime', label: 'Date and time' },
+ { value: 'boolean', label: 'Boolean' },
]}
- onChange={(type) => setCalculatedMeasureDraft({ ...draft, type })}
+ onChange={(type) => setCalculatedMeasureDraft({ ...draft, type, typeOverride: true })}
/>
)}
</div>
@@ -91,7 +100,9 @@ export function BICalculatedMeasureModal(): JSX.Element | null {
<LemonLabel>HogQL expression</LemonLabel>
<CodeEditorInline
value={draft.expression}
- onChange={(expression) => setCalculatedMeasureDraft({ ...draft, expression: expression ?? '' })}
+ onChange={(expression) =>
+ setCalculatedMeasureDraft({ ...draft, expression: expression ?? '', typeOverride: false })
+ }
language="hogQLExpr"
minHeight="100px"
options={{ ariaLabel: 'Calculated field expression' }}
@@ -103,6 +114,18 @@ export function BICalculatedMeasureModal(): JSX.Element | null {
onPressCmdEnter={saveCalculatedMeasure}
data-attr="bi-calculated-measure-formula"
/>
+ <p className="m-0 text-xs text-secondary">
+ Press Cmd+Space (Ctrl+Space on Windows or Linux) to autocomplete fields.
+ </p>
+ <p className="m-0 text-xs" role="status">
+ {calculatedFieldValidation === 'checking'
+ ? 'Checking SQL…'
+ : calculatedFieldValidation === 'valid'
+ ? 'Valid SQL'
+ : calculatedFieldValidation === 'invalid'
+ ? (calculatedFieldMetadata?.metadata.errors[0]?.message ?? 'Invalid SQL expression')
+ : ''}
+ </p>
<p className="m-0 text-xs text-secondary">
{draft.kind === 'dimension'
? "Use a row expression, such as coalesce(properties.plan, 'Unknown'). Refer to fields from the selected table using HogQL."
diff --git a/products/business_intelligence/frontend/BIChartAxisModal.tsx b/products/business_intelligence/frontend/BIChartAxisModal.tsx
index 0268adc7cbe4..4b410bb96e5d 100644
--- a/products/business_intelligence/frontend/BIChartAxisModal.tsx
+++ b/products/business_intelligence/frontend/BIChartAxisModal.tsx
@@ -19,6 +19,8 @@ export function BIChartAxisModal({
}): JSX.Element {
const key = axis === 'right' ? 'rightYAxisSettings' : 'leftYAxisSettings'
const [label, setLabel] = useState(axis === 'x' ? (settings.xAxisLabel ?? '') : (settings[key]?.label ?? ''))
+ const [dateFormat, setDateFormat] = useState(settings.xAxisDateFormat ?? '')
+ const [tickRotation, setTickRotation] = useState<number | null>(settings.xAxisTickRotation ?? null)
const [draft, setDraft] = useState<YAxisSettings>(settings[key] ?? {})
const [showTicks, setShowTicks] = useState(
axis === 'x' ? (settings.showXAxisTicks ?? true) : (settings[key]?.showTicks ?? true)
@@ -39,7 +41,13 @@ export function BIChartAxisModal({
onClick={() => {
onSave(
axis === 'x'
- ? { ...settings, xAxisLabel: label, showXAxisTicks: showTicks }
+ ? {
+ ...settings,
+ xAxisLabel: label,
+ showXAxisTicks: showTicks,
+ xAxisDateFormat: dateFormat || undefined,
+ xAxisTickRotation: tickRotation ?? undefined,
+ }
: { ...settings, [key]: { ...draft, label, showTicks } }
)
onClose()
@@ -72,6 +80,30 @@ export function BIChartAxisModal({
/>
</>
)}
+ {axis === 'x' && (
+ <>
+ <LemonLabel htmlFor="bi-axis-date-format">Date format</LemonLabel>
+ <LemonInput
+ id="bi-axis-date-format"
+ value={dateFormat}
+ onChange={setDateFormat}
+ placeholder="Automatic"
+ />
+ <p className="m-0 text-xs text-secondary">
+ For date fields, use YYYY-MM-DD, MMM YYYY, or DD/MM/YYYY. Leave empty for automatic
+ formatting.
+ </p>
+ <LemonLabel>Tick label rotation</LemonLabel>
+ <LemonSelect
+ value={tickRotation}
+ onChange={setTickRotation}
+ options={[
+ { value: null, label: 'Automatic' },
+ ...[0, -45, -90, 45, 90].map((value) => ({ value, label: `${value}°` })),
+ ]}
+ />
+ </>
+ )}
<LemonSwitch label="Show tick labels" checked={showTicks} onChange={setShowTicks} />
</div>
</LemonModal>
diff --git a/products/business_intelligence/frontend/BIChartYearLabels.stories.tsx b/products/business_intelligence/frontend/BIChartYearLabels.stories.tsx
index a08be1b3860a..a17ba3f01187 100644
--- a/products/business_intelligence/frontend/BIChartYearLabels.stories.tsx
+++ b/products/business_intelligence/frontend/BIChartYearLabels.stories.tsx
@@ -34,7 +34,7 @@ const config: BIConfig = {
],
filters: [],
chartType: ChartDisplayType.ActionsBar,
- limit: 100,
+ limit: 50_000,
}
const dates = [
'2025-10-01',
@@ -56,9 +56,9 @@ const meta: Meta = {
}
export default meta
-export const PartialYears: StoryObj = {
- render: () => (
- <div className="flex h-96 w-[48rem] flex-col">
+function ChartYears({ dates: chartDates, width = '48rem' }: { dates: string[]; width?: string }): JSX.Element {
+ return (
+ <div className="flex h-96 flex-col" style={{ width }}>
<DataTableVisualization
query={{
...buildBIQuery(config)!.node,
@@ -76,11 +76,25 @@ export const PartialYears: StoryObj = {
['toStartOfMonth(timestamp)', 'DateTime'],
['sum_revenue', 'Float64'],
],
- results: dates.map((date, index) => [date, 100 + (index % 4) * 50]),
+ results: chartDates.map((date, index) => [date, 100 + (index % 4) * 50]),
}}
context={{ insightProps: { dashboardItemId: 'new-SQL-bi-years' } }}
readOnly
/>
</div>
+ )
+}
+
+export const PartialYears: StoryObj = { render: () => <ChartYears dates={dates} /> }
+
+export const ManyYearsNarrow: StoryObj = {
+ render: () => (
+ <ChartYears
+ dates={Array.from(
+ { length: 360 },
+ (_, i) => `${2000 + Math.floor(i / 12)}-${String((i % 12) + 1).padStart(2, '0')}-01`
+ )}
+ width="520px"
+ />
),
}
diff --git a/products/business_intelligence/frontend/BIChartYearLabels.tsx b/products/business_intelligence/frontend/BIChartYearLabels.tsx
index 258afdde9072..5b067aad667e 100644
--- a/products/business_intelligence/frontend/BIChartYearLabels.tsx
+++ b/products/business_intelligence/frontend/BIChartYearLabels.tsx
@@ -5,6 +5,7 @@ import { getBIChartYearGroups } from './biChartDateAxis'
export function BIChartYearLabels({ timezone }: { timezone: string }): JSX.Element {
const { labels, scales, dimensions, theme } = useChartLayout()
const groups = getBIChartYearGroups(labels, timezone)
+ let nextLabelStart = dimensions.plotLeft
return (
<div className="pointer-events-none" aria-label="Years">
{groups.map(({ year, first, last }, index) => {
@@ -13,15 +14,20 @@ export function BIChartYearLabels({ timezone }: { timezone: string }): JSX.Eleme
if (start === undefined || end === undefined) {
return null
}
+ const left = Math.max(dimensions.plotLeft, start - (scales.extent?.(first) ?? 0) / 2)
+ if (left < nextLabelStart || left + 36 > dimensions.plotLeft + dimensions.plotWidth) {
+ return null
+ }
+ nextLabelStart = left + 48
return (
<span
key={`${year}-${index}`}
data-attr="bi-chart-year"
- className="absolute -translate-x-1/2 text-xs whitespace-nowrap"
+ className="absolute text-xs whitespace-nowrap"
// The year spans chart coordinates, which change with the plot's measured size.
// eslint-disable-next-line react/forbid-dom-props
style={{
- left: (start + end) / 2,
+ left,
top: dimensions.plotTop + dimensions.plotHeight + 28,
color: theme.axisColor,
}}
diff --git a/products/business_intelligence/frontend/BIDataSourcePicker.tsx b/products/business_intelligence/frontend/BIDataSourcePicker.tsx
index 73e91fe298eb..f233d13fa4ca 100644
--- a/products/business_intelligence/frontend/BIDataSourcePicker.tsx
+++ b/products/business_intelligence/frontend/BIDataSourcePicker.tsx
@@ -58,6 +58,14 @@ export function BIDataSourcePicker(): JSX.Element {
virtualizationScrollContainerRef={scrollRef}
expandedItemIds={visibleExpandedIds}
onSetExpandedItemIds={setExpandedIds}
+ onFolderClick={(item, expanded) =>
+ item &&
+ setExpandedIds(
+ expanded
+ ? visibleExpandedIds.filter((id) => id !== item.id)
+ : [...visibleExpandedIds, item.id]
+ )
+ }
onItemClick={(item) => item && selectSource(item.id)}
isItemActive={(item) =>
!!config.source && item.id === getBIDataSourceKey(config.source)
diff --git a/products/business_intelligence/frontend/BIFilterValueInput.tsx b/products/business_intelligence/frontend/BIFilterValueInput.tsx
index 421add4a3e1b..34fbb5c701dd 100644
--- a/products/business_intelligence/frontend/BIFilterValueInput.tsx
+++ b/products/business_intelligence/frontend/BIFilterValueInput.tsx
@@ -58,7 +58,7 @@ export function BIFilterValueInput({ index }: { index: number }): JSX.Element |
)
: (options ?? []).map((value) => ({ key: value, label: value }))
}
- loading={optionsLoading}
+ loading={optionsLoading && options === null}
status={validationError ? 'danger' : 'default'}
onFocus={() => setFocused(true)}
onBlur={() => setFocused(false)}
diff --git a/products/business_intelligence/frontend/BusinessIntelligenceScene.stories.tsx b/products/business_intelligence/frontend/BusinessIntelligenceScene.stories.tsx
index dbe8f6341c73..0e83b3c4b910 100644
--- a/products/business_intelligence/frontend/BusinessIntelligenceScene.stories.tsx
+++ b/products/business_intelligence/frontend/BusinessIntelligenceScene.stories.tsx
@@ -98,10 +98,31 @@ const meta: Meta = {
'/api/projects/:team_id/external_data_sources/direct_connection_options/': [],
},
post: {
+ '/api/projects/:team_id/query/HogQLMetadata/': {
+ isValid: true,
+ errors: [],
+ warnings: [],
+ notices: [],
+ output_columns: [{ name: 'value', type: 'Float64' }],
+ },
'/api/environments/:team_id/query/:query_kind/': async ({ request }) => {
const { query } = (await request.json()) as {
query: { kind: string; query?: string; limit?: number }
}
+ if (query.kind === NodeKind.HogQLMetadata) {
+ return [
+ 200,
+ {
+ isValid: true,
+ errors: [],
+ warnings: [],
+ notices: [],
+ output_columns: [
+ { name: 'value', type: query.query?.includes('revenue') ? 'Float64' : 'String' },
+ ],
+ },
+ ]
+ }
if (query.kind === NodeKind.DatabaseSchemaQuery) {
const fields = [
region,
diff --git a/products/business_intelligence/frontend/biAnalysis.test.ts b/products/business_intelligence/frontend/biAnalysis.test.ts
index 830acab889fc..59531f0a241c 100644
--- a/products/business_intelligence/frontend/biAnalysis.test.ts
+++ b/products/business_intelligence/frontend/biAnalysis.test.ts
@@ -126,7 +126,7 @@ describe('BI analysis queries', () => {
expect(query).toContain('OVER (PARTITION BY bi_column_event')
expect(query.match(/LIMIT/g)).toHaveLength(1)
expect(query.indexOf('bi_filtered AS')).toBeGreaterThan(query.indexOf('bi_calculated AS'))
- expect(query.endsWith('LIMIT 1000')).toBe(true)
+ expect(query.endsWith('LIMIT 50000')).toBe(true)
if (compare) {
expect(query).toContain('FROM bi_previous')
expect(query).toContain('UNION ALL')
diff --git a/products/business_intelligence/frontend/biCatalog.test.ts b/products/business_intelligence/frontend/biCatalog.test.ts
index effdbaa68c79..f422e25587ea 100644
--- a/products/business_intelligence/frontend/biCatalog.test.ts
+++ b/products/business_intelligence/frontend/biCatalog.test.ts
@@ -54,7 +54,7 @@ it('only proposes the successfully executed current query, retaining resolved da
definition: { kind: NodeKind.HogQLQuery, query: 'SELECT 42' },
})!
const response = { hogql: "SELECT 42 WHERE toDate('2026-01-01') < toDate('2026-01-08') LIMIT 1001" }
- expect(getBIMetricSnapshot(node, node, response, true)).toBe(`SELECT * FROM (${response.hogql}) LIMIT 1000`)
+ expect(getBIMetricSnapshot(node, node, response, true)).toBe(`SELECT * FROM (${response.hogql}) LIMIT 50000`)
expect(getBIMetricSnapshot(node, node, response, false)).toBeNull()
expect(
getBIMetricSnapshot({ ...node, source: { ...node.source, query: 'SELECT 43' } }, node, response, true)
diff --git a/products/business_intelligence/frontend/biDataSourcePickerLogic.ts b/products/business_intelligence/frontend/biDataSourcePickerLogic.ts
index e6576ae52bb9..8123810d1fc2 100644
--- a/products/business_intelligence/frontend/biDataSourcePickerLogic.ts
+++ b/products/business_intelligence/frontend/biDataSourcePickerLogic.ts
@@ -129,7 +129,10 @@ export const biDataSourcePickerLogic: LogicWrapper<biDataSourcePickerLogicType>
reducers({
open: [false, { setOpen: (_, { open }) => open }],
search: ['', { setSearch: (_, { search }) => search, setOpen: () => '' }],
- expandedIds: [null as string[] | null, { setExpandedIds: (_, { ids }) => ids, setOpen: () => null }],
+ expandedIds: [
+ null as string[] | null,
+ { setExpandedIds: (_, { ids }) => ids, setOpen: () => null, setSearch: () => null },
+ ],
}),
selectors({
selectedDirectSource: [
@@ -176,8 +179,8 @@ export const biDataSourcePickerLogic: LogicWrapper<biDataSourcePickerLogicType>
],
visibleExpandedIds: [
(s) => [s.filteredTree, s.search, s.expandedIds],
- (tree: TreeDataItem[], search: string, expandedIds: string[] | null): string[] =>
- search || expandedIds === null ? getBIDataSourceFolderIds(tree) : expandedIds,
+ (tree: TreeDataItem[], _search: string, expandedIds: string[] | null): string[] =>
+ expandedIds === null ? getBIDataSourceFolderIds(tree) : expandedIds,
],
}),
listeners(({ actions, values }) => ({
diff --git a/products/business_intelligence/frontend/biDataSourceTree.test.ts b/products/business_intelligence/frontend/biDataSourceTree.test.ts
index 313cdcf49616..074efa36829b 100644
--- a/products/business_intelligence/frontend/biDataSourceTree.test.ts
+++ b/products/business_intelligence/frontend/biDataSourceTree.test.ts
@@ -107,7 +107,7 @@ describe('BI data source tree', () => {
[{ table: 'orders_raw' }, { table: 'customers' }, { table: 'orders_old' }],
false
)
- expect(results.map((node) => node.name)).toEqual(['Views', 'Raw'])
+ expect(results.map((node) => node.name)).toEqual(['Certified sources', 'Raw', 'Views'])
expect(searchBIDataSourceTree(results, 'orders').map((node) => node.name)).toEqual(['Raw', 'Views'])
})
it.each([
diff --git a/products/business_intelligence/frontend/biDataSourceTree.ts b/products/business_intelligence/frontend/biDataSourceTree.ts
index f6bb209a05c9..b5ca9919b26f 100644
--- a/products/business_intelligence/frontend/biDataSourceTree.ts
+++ b/products/business_intelligence/frontend/biDataSourceTree.ts
@@ -31,6 +31,7 @@ export function buildBIDataSourceTree(
): TreeDataItem[] {
const remaining = new Map(sources.map((source) => [getBIDataSourceKey(source), source]))
const leaves: TreeDataItem[] = []
+ const certified: TreeDataItem[] = []
const visit = (items: TreeDataItem[]): TreeDataItem[] =>
items.flatMap((item) => {
if (['table', 'view', 'managed-view', 'view-table', 'endpoint'].includes(item.record?.type)) {
@@ -48,6 +49,10 @@ export function buildBIDataSourceTree(
icon: item.icon,
record: { ...item.record, type: item.record?.type },
}
+ if (node.record?.certification?.status === 'certified') {
+ certified.push(node)
+ return []
+ }
leaves.push(node)
return [node]
}
@@ -58,11 +63,14 @@ export function buildBIDataSourceTree(
})
const grouped = visit(tree)
const missing = [...remaining.values()].map((source) => ({ id: getBIDataSourceKey(source), name: source.table }))
- return prioritizeCertifiedSources(
- directConnection
- ? groupDirectConnectionTableNodesBySchema([...leaves, ...missing], false, defaultSchemaName)
- : [...grouped, ...missing]
- )
+ return [
+ ...(certified.length ? [{ id: 'bi-certified-sources', name: 'Certified sources', children: certified }] : []),
+ ...prioritizeCertifiedSources(
+ directConnection
+ ? groupDirectConnectionTableNodesBySchema([...leaves, ...missing], false, defaultSchemaName)
+ : [...grouped, ...missing]
+ ),
+ ]
}
export function searchBIDataSourceTree(tree: TreeDataItem[], search: string): TreeDataItem[] {
diff --git a/products/business_intelligence/frontend/biEditorAnalytics.ts b/products/business_intelligence/frontend/biEditorAnalytics.ts
index d313614e95c9..1759e9d16720 100644
--- a/products/business_intelligence/frontend/biEditorAnalytics.ts
+++ b/products/business_intelligence/frontend/biEditorAnalytics.ts
@@ -95,6 +95,8 @@ export type BIWorksheetAction =
| 'filter_values_searched'
| 'filter_values_page_loaded'
| 'local_field_saved'
+ | 'calculated_field_saved'
+ | 'chart_settings_changed'
| 'undo'
| 'redo'
| 'copied'
@@ -124,6 +126,7 @@ export function captureBIWorksheetAction(
expanded?: boolean
starter_kind?: 'metric' | 'certified_source' | 'events'
source_certification?: 'certified' | 'deprecated' | 'unmarked'
+ setting_keys?: string[]
} = {}
): void {
posthog.capture(BI_EDITOR_EVENTS.WORKSHEET_ACTION, {
diff --git a/products/business_intelligence/frontend/biEditorLogic.test.ts b/products/business_intelligence/frontend/biEditorLogic.test.ts
index 1d320a479808..3d655a4ccf93 100644
--- a/products/business_intelligence/frontend/biEditorLogic.test.ts
+++ b/products/business_intelligence/frontend/biEditorLogic.test.ts
@@ -4,7 +4,9 @@ import { expectLogic } from 'kea-test-utils'
import { databaseTableListLogic } from 'scenes/data-management/database/databaseTableListLogic'
import { useMocks } from '~/mocks/jest'
+import * as queryRunner from '~/queries/query'
import { BIConfig, BIField } from '~/queries/schema/schema-business-intelligence'
+import { HogQLMetadataResponse } from '~/queries/schema/schema-general'
import { NodeKind } from '~/queries/schema/schema-general'
import { initKeaTests } from '~/test/init'
import { ChartDisplayType } from '~/types'
@@ -26,7 +28,16 @@ describe('biEditorLogic', () => {
'/api/projects/:team_id/external_data_sources/connections/': [],
'/api/projects/:team_id/warehouse_saved_queries/': { results: [] },
},
- post: { '/api/environments/:team_id/query/': queryEndpointMock },
+ post: {
+ '/api/environments/:team_id/query/': queryEndpointMock,
+ '/api/projects/:team_id/query/HogQLMetadata/': {
+ isValid: true,
+ errors: [],
+ warnings: [],
+ notices: [],
+ output_columns: [{ name: 'value', type: 'String' }],
+ },
+ },
})
initKeaTests()
router.actions.push('/')
@@ -51,7 +62,7 @@ describe('biEditorLogic', () => {
limit: 1000,
sort: null,
}
- it.each(['rows', 'columns'] as const)('only adds a calculated field to %s after confirmation', (shelf) => {
+ it.each(['rows', 'columns'] as const)('only adds a calculated field to %s after confirmation', async (shelf) => {
const logic = biEditorLogic({ tabId: TAB_ID })
logic.mount()
logic.actions.setAutoUpdate(false)
@@ -67,11 +78,111 @@ describe('biEditorLogic', () => {
expression: 'lower(event)',
})
expect(logic.values.config).toEqual(config)
+ await expectLogic(logic).toFinishAllListeners()
logic.actions.saveCalculatedMeasure()
expect(logic.values.config[shelf].at(-1)).toMatchObject({ name: 'Event label', expression: 'lower(event)' })
expect(logic.values.calculatedMeasureDraft).toBeNull()
logic.unmount()
})
+ it('infers SQL types, preserves an explicit override, and blocks invalid calculations', async () => {
+ useMocks({
+ post: {
+ '/api/projects/:team_id/query/HogQLMetadata/': {
+ isValid: true,
+ errors: [],
+ warnings: [],
+ notices: [],
+ output_columns: [{ name: 'value', type: 'Nullable(Float64)' }],
+ },
+ },
+ })
+ const logic = biEditorLogic({ tabId: TAB_ID })
+ logic.mount()
+ logic.actions.restoreState({ editorView: BIEditorView.BI, config })
+ logic.actions.setCalculatedMeasureDraft({
+ index: null,
+ kind: 'dimension',
+ name: 'Amount',
+ expression: 'toFloat(event)',
+ })
+ expect(logic.values.calculatedFieldValidation).toBe('checking')
+ logic.actions.saveCalculatedMeasure()
+ expect(logic.values.config.localFields).toBeUndefined()
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.calculatedMeasureDraft?.type).toBe('float')
+ expect(logic.values.calculatedFieldValidation).toBe('valid')
+ logic.actions.setCalculatedMeasureDraft({
+ ...logic.values.calculatedMeasureDraft!,
+ type: 'string',
+ typeOverride: true,
+ })
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.calculatedMeasureDraft?.type).toBe('string')
+ useMocks({
+ post: {
+ '/api/projects/:team_id/query/HogQLMetadata/': {
+ isValid: false,
+ errors: [{ message: 'Unknown field' }],
+ warnings: [],
+ notices: [],
+ },
+ },
+ })
+ logic.actions.setCalculatedMeasureDraft({
+ ...logic.values.calculatedMeasureDraft!,
+ expression: 'missing_field',
+ })
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.calculatedFieldValidation).toBe('invalid')
+ logic.actions.saveCalculatedMeasure()
+ expect(logic.values.config.localFields).toBeUndefined()
+ logic.unmount()
+ })
+
+ it('keeps cached validation when a superseded expression finishes after undo', async () => {
+ const validMetadata: HogQLMetadataResponse = {
+ isValid: true,
+ errors: [],
+ warnings: [],
+ notices: [],
+ output_columns: [{ name: 'value', type: 'String' }],
+ }
+ let finishPending!: (metadata: HogQLMetadataResponse) => void
+ const pending = new Promise<HogQLMetadataResponse>((resolve) => {
+ finishPending = resolve
+ })
+ const performQuery = jest
+ .spyOn(queryRunner, 'performQuery')
+ .mockResolvedValueOnce(validMetadata as never)
+ .mockImplementationOnce(() => pending as never)
+ const logic = biEditorLogic({ tabId: TAB_ID })
+ logic.mount()
+ logic.actions.setAutoUpdate(false)
+ logic.actions.restoreState({ editorView: BIEditorView.BI, config })
+ const draft = { index: null, kind: 'dimension' as const, name: 'Label', expression: 'event' }
+ try {
+ logic.actions.setCalculatedMeasureDraft(draft)
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.calculatedFieldValidation).toBe('valid')
+ jest.useFakeTimers()
+ logic.actions.setCalculatedMeasureDraft({ ...draft, expression: 'lower(event)' })
+ await jest.advanceTimersByTimeAsync(300)
+ expect(performQuery).toHaveBeenCalledTimes(2)
+ logic.actions.setCalculatedMeasureDraft(draft)
+ await jest.advanceTimersByTimeAsync(0)
+ expect(logic.values.calculatedFieldValidation).toBe('valid')
+ finishPending(validMetadata)
+ await jest.advanceTimersByTimeAsync(0)
+ expect(logic.values.calculatedFieldMetadata?.expression).toBe('event')
+ expect(logic.values.calculatedFieldValidation).toBe('valid')
+ } finally {
+ finishPending(validMetadata)
+ logic.unmount()
+ performQuery.mockRestore()
+ jest.useRealTimers()
+ }
+ })
+
it('renames shelf labels without changing the source expression and preserves them on reload', () => {
const logic = biEditorLogic({ tabId: TAB_ID })
logic.mount()
@@ -521,13 +632,14 @@ describe('biEditorLogic', () => {
it.each(['dimension', 'measure'] as const)(
'reuses, edits, clears, restores and deletes a worksheet-local %s',
- (kind) => {
+ async (kind) => {
const logic = biEditorLogic({ tabId: TAB_ID })
logic.mount()
logic.actions.restoreState({ editorView: BIEditorView.BI, config })
const expression = kind === 'dimension' ? "coalesce(properties.plan, 'Unknown')" : 'sum(revenue)'
const editedExpression = kind === 'dimension' ? 'lower(properties.plan)' : 'avg(revenue)'
logic.actions.setCalculatedMeasureDraft({ index: null, kind, name: 'Local calculation', expression })
+ await expectLogic(logic).toFinishAllListeners()
logic.actions.saveCalculatedMeasure()
const field = logic.values.config.localFields![0]
const shelf = kind === 'dimension' ? 'rows' : 'values'
@@ -541,6 +653,7 @@ describe('biEditorLogic', () => {
name: 'Renamed calculation',
expression: editedExpression,
})
+ await expectLogic(logic).toFinishAllListeners()
logic.actions.saveCalculatedMeasure()
expect(logic.values.config.localFields![0].name).toBe('Renamed calculation')
if (kind === 'dimension') {
@@ -575,7 +688,7 @@ describe('biEditorLogic', () => {
}
)
- it('creates and edits a calculated measure without applying canceled drafts or losing its sort', () => {
+ it('creates and edits a calculated measure without applying canceled drafts or losing its sort', async () => {
const biLogic = biEditorLogic({ tabId: TAB_ID })
biLogic.mount()
biLogic.actions.restoreState({ editorView: BIEditorView.BI, config })
@@ -588,6 +701,7 @@ describe('biEditorLogic', () => {
})
expect(biLogic.values.calculatedMeasureDraft?.name).toBe('ARPU')
expect(biLogic.values.config.values).toEqual([])
+ await expectLogic(biLogic).toFinishAllListeners()
biLogic.actions.saveCalculatedMeasure()
expect(biLogic.values.calculatedMeasureDraft).toBeNull()
expect(biLogic.values.generatedQuery?.query).toContain(
@@ -602,6 +716,7 @@ describe('biEditorLogic', () => {
biLogic.actions.editCalculatedMeasure(0)
expect(biLogic.values.calculatedMeasureDraft?.name).toBe('ARPU')
biLogic.actions.setCalculatedMeasureDraft({ index: 0, name: 'Average revenue', expression: 'avg(revenue)' })
+ await expectLogic(biLogic).toFinishAllListeners()
biLogic.actions.saveCalculatedMeasure()
expect(biLogic.values.config.values).toHaveLength(1)
expect(biLogic.values.config.values[0].field.id).toBe(value.field.id)
@@ -613,6 +728,7 @@ describe('biEditorLogic', () => {
biLogic.actions.editCalculatedMeasure(0)
biLogic.actions.setDataSource({ table: 'other_table' })
expect(biLogic.values.calculatedMeasureDraft).toBeNull()
+ await expectLogic(biLogic).toFinishAllListeners()
biLogic.actions.saveCalculatedMeasure()
expect(biLogic.values.config.values).toEqual([])
biLogic.unmount()
diff --git a/products/business_intelligence/frontend/biEditorLogic.ts b/products/business_intelligence/frontend/biEditorLogic.ts
index b0a0e9aab673..d008f62de3b9 100644
--- a/products/business_intelligence/frontend/biEditorLogic.ts
+++ b/products/business_intelligence/frontend/biEditorLogic.ts
@@ -1,9 +1,11 @@
import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
import { uuid } from 'lib/utils/dom'
import { TableFieldsStatus, databaseTableListLogic } from 'scenes/data-management/database/databaseTableListLogic'
+import { performQuery } from '~/queries/query'
import {
BIAggregation,
BIConfig,
@@ -22,7 +24,16 @@ import {
BIResultFilter,
BIHierarchy,
} from '~/queries/schema/schema-business-intelligence'
-import { CompareFilter, DatabaseSchemaTable, DateRange } from '~/queries/schema/schema-general'
+import {
+ CompareFilter,
+ DatabaseSchemaTable,
+ DateRange,
+ HogQLMetadata,
+ HogQLMetadataResponse,
+ HogLanguage,
+ NodeKind,
+} from '~/queries/schema/schema-general'
+import { escapeDottedHogQLIdentifier } from '~/queries/utils'
import { ChartDisplayType } from '~/types'
import {
@@ -54,7 +65,13 @@ import {
} from 'products/business_intelligence/frontend/biEditorTypes'
import type { BIPaneSettings } from '../../../frontend/src/queries/schema/schema-business-intelligence'
-import { getBILocalFields, localFieldError, localFieldExpression, upsertBILocalField } from './biLocalFields'
+import {
+ getBILocalFields,
+ inferBICalculatedFieldType,
+ localFieldError,
+ localFieldExpression,
+ upsertBILocalField,
+} from './biLocalFields'
import { matchesBIFieldSearch } from './biPropertyFields'
import { getBIDateField } from './biQueryFilters'
@@ -69,6 +86,7 @@ export interface BICalculatedMeasureDraft {
kind?: 'dimension' | 'measure'
fieldId?: string
type?: BIField['type']
+ typeOverride?: boolean
shelf?: 'rows' | 'columns'
}
@@ -373,6 +391,13 @@ export interface biEditorLogicValues {
autoUpdate: boolean
availableDataSources: BIDataSource[]
calculatedFieldError: string | undefined
+ calculatedFieldMetadata: {
+ expression: string
+ metadata: HogQLMetadataResponse
+ sourceKey: string
+ } | null
+ calculatedFieldMetadataLoading: boolean
+ calculatedFieldValidation: 'checking' | 'idle' | 'invalid' | 'valid'
calculatedMeasureDraft: BICalculatedMeasureDraft | null
chartFits: Partial<Record<ChartDisplayType, BIChartFit>>
config: BIConfig
@@ -466,6 +491,29 @@ export interface biEditorLogicActions {
editMeasureSettings: (index: number | null) => {
index: number | null
}
+ loadCalculatedFieldMetadata: (_: void) => void
+ loadCalculatedFieldMetadataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCalculatedFieldMetadataSuccess: (
+ calculatedFieldMetadata: {
+ expression: string
+ metadata: HogQLMetadataResponse
+ sourceKey: string
+ } | null,
+ payload?: void
+ ) => {
+ calculatedFieldMetadata: {
+ expression: string
+ metadata: HogQLMetadataResponse
+ sourceKey: string
+ } | null
+ payload?: void
+ }
moveFieldToShelf: (
fromShelf: BIShelf,
fromIndex: number,
@@ -713,6 +761,16 @@ export interface biEditorLogicActions {
export interface biEditorLogicMeta {
key: string
__keaTypeGenInternalSelectorTypes: {
+ calculatedFieldValidation: (
+ calculatedMeasureDraft: BICalculatedMeasureDraft | null,
+ calculatedFieldMetadata: {
+ expression: string
+ metadata: HogQLMetadataResponse
+ sourceKey: string
+ } | null,
+ calculatedFieldMetadataLoading: boolean,
+ config: BIConfig
+ ) => 'checking' | 'idle' | 'invalid' | 'valid'
calculatedFieldError: (
calculatedMeasureDraft: BICalculatedMeasureDraft | null,
config: BIConfig
@@ -868,7 +926,42 @@ export const biEditorLogic = kea<biEditorLogicType>([
setFilterCustomExpression: (index: number, customExpression: string) => ({ index, customExpression }),
resetConfig: true,
}),
- reducers(() => ({
+ loaders(({ values }) => ({
+ calculatedFieldMetadata: [
+ null as { expression: string; sourceKey: string; metadata: HogQLMetadataResponse } | null,
+ {
+ loadCalculatedFieldMetadata: async (_: void, breakpoint) => {
+ const draft = values.calculatedMeasureDraft
+ const source = values.config.source
+ if (!draft?.expression.trim() || !source) {
+ return null
+ }
+ const cached = values.calculatedFieldMetadata
+ if (cached?.expression === draft.expression && cached.sourceKey === getBIDataSourceKey(source)) {
+ return cached
+ }
+ await breakpoint(300)
+ const metadata = await performQuery<HogQLMetadata>({
+ kind: NodeKind.HogQLMetadata,
+ language: HogLanguage.hogQL,
+ query: `SELECT (${draft.expression}) AS value FROM ${escapeDottedHogQLIdentifier(source.table)}`,
+ connectionId: source.connectionId,
+ includeOutputTypes: true,
+ }).catch(
+ (): HogQLMetadataResponse => ({
+ isValid: false,
+ errors: [{ message: 'Could not check SQL. Edit the expression to try again.' }],
+ warnings: [],
+ notices: [],
+ })
+ )
+ breakpoint()
+ return { expression: draft.expression, sourceKey: getBIDataSourceKey(source), metadata }
+ },
+ },
+ ],
+ })),
+ reducers({
localFieldDraft: [
null as BIField | null,
{ setLocalFieldDraft: (_, { field }) => field, upsertLocalField: () => null, setDataSource: () => null },
@@ -1268,8 +1361,29 @@ export const biEditorLogic = kea<biEditorLogicType>([
}),
},
],
- })),
+ }),
selectors({
+ calculatedFieldValidation: [
+ (s) => [s.calculatedMeasureDraft, s.calculatedFieldMetadata, s.calculatedFieldMetadataLoading, s.config],
+ (
+ draft: BICalculatedMeasureDraft | null,
+ result: { expression: string; sourceKey: string; metadata: HogQLMetadataResponse } | null,
+ loading: boolean,
+ config: BIConfig
+ ): 'idle' | 'checking' | 'valid' | 'invalid' => {
+ if (!draft?.expression.trim()) {
+ return 'idle'
+ }
+ if (
+ loading ||
+ result?.expression !== draft.expression ||
+ (config.source && result.sourceKey !== getBIDataSourceKey(config.source))
+ ) {
+ return 'checking'
+ }
+ return result.metadata.isValid ? 'valid' : 'invalid'
+ },
+ ],
calculatedFieldError: [
(s) => [s.calculatedMeasureDraft, s.config],
(draft: BICalculatedMeasureDraft | null, config: BIConfig): string | undefined => {
@@ -1471,6 +1585,33 @@ export const biEditorLogic = kea<biEditorLogicType>([
actions.runAfterChange()
},
renameField: () => actions.runAfterChange(),
+ loadCalculatedFieldMetadataSuccess: ({ calculatedFieldMetadata: result }) => {
+ const draft = values.calculatedMeasureDraft
+ const source = values.config.source
+ const type = inferBICalculatedFieldType(result?.metadata.output_columns?.[0]?.type)
+ if (
+ draft &&
+ source &&
+ result?.expression === draft.expression &&
+ result.sourceKey === getBIDataSourceKey(source) &&
+ result.metadata.isValid &&
+ type &&
+ !draft.typeOverride
+ ) {
+ actions.setCalculatedMeasureDraft({ ...draft, type })
+ }
+ },
+ setCalculatedMeasureDraft: () => {
+ if (
+ !values.calculatedMeasureDraft ||
+ values.calculatedFieldMetadataLoading ||
+ values.calculatedMeasureDraft.expression !== values.calculatedFieldMetadata?.expression ||
+ (values.config.source &&
+ values.calculatedFieldMetadata?.sourceKey !== getBIDataSourceKey(values.config.source))
+ ) {
+ actions.loadCalculatedFieldMetadata()
+ }
+ },
editCalculatedField: ({ field, shelf }) => {
if (!values.config.source) {
return
@@ -1485,6 +1626,7 @@ export const biEditorLogic = kea<biEditorLogicType>([
name: field?.name ?? '',
expression: field?.expression ?? '',
type: field?.type ?? 'string',
+ typeOverride: !!field,
shelf,
})
},
@@ -1502,15 +1644,19 @@ export const biEditorLogic = kea<biEditorLogicType>([
kind: 'measure',
fieldId: value?.field.localFieldId,
type: value?.field.type ?? 'float',
+ typeOverride: index !== null,
})
},
saveCalculatedMeasure: () => {
const draft = values.calculatedMeasureDraft
- if (draft && !values.calculatedFieldError) {
+ if (draft && !values.calculatedFieldError && values.calculatedFieldValidation === 'valid') {
actions.upsertCalculatedMeasure(draft)
}
},
- upsertCalculatedMeasure: () => actions.runAfterChange(),
+ upsertCalculatedMeasure: () => {
+ captureBIWorksheetAction('calculated_field_saved', values.config)
+ actions.runAfterChange()
+ },
setFilterGroup: () => actions.runAfterChange(),
addResultFilter: () => actions.runAfterChange(),
updateResultFilter: () => actions.runAfterChange(),
diff --git a/products/business_intelligence/frontend/biEditorTypes.ts b/products/business_intelligence/frontend/biEditorTypes.ts
index 9ab711575d94..6bffe356c87f 100644
--- a/products/business_intelligence/frontend/biEditorTypes.ts
+++ b/products/business_intelligence/frontend/biEditorTypes.ts
@@ -227,7 +227,7 @@ export const DEFAULT_BI_CONFIG: BIConfig = {
columns: [],
values: [],
filters: [],
- limit: 1000,
+ limit: 50000,
sort: null,
}
diff --git a/products/business_intelligence/frontend/biFilterValuesLogic.test.ts b/products/business_intelligence/frontend/biFilterValuesLogic.test.ts
index ee63e870d2ba..98cdfc84fa4a 100644
--- a/products/business_intelligence/frontend/biFilterValuesLogic.test.ts
+++ b/products/business_intelligence/frontend/biFilterValuesLogic.test.ts
@@ -1,4 +1,3 @@
-import { waitFor } from '@testing-library/react'
import { expectLogic } from 'kea-test-utils'
import api from 'lib/api'
@@ -12,7 +11,10 @@ import { biFilterValuesLogic } from 'products/business_intelligence/frontend/biF
describe('BI filter suggestions', () => {
beforeEach(() => initKeaTests())
- afterEach(() => jest.restoreAllMocks())
+ afterEach(() => {
+ jest.useRealTimers()
+ jest.restoreAllMocks()
+ })
it('cancels a pending value lookup on replacement and unmount without cancelling completed queries', async () => {
const requests: AbortSignal[] = []
@@ -31,14 +33,17 @@ describe('BI filter suggestions', () => {
})
const unmount = logic.mount()
expect(requests).toHaveLength(1)
+ jest.useFakeTimers()
await expectLogic(logic, () => logic.actions.setSearch('new')).toDispatchActions(['loadOptions'])
expect(requests[0].aborted).toBe(true)
expect(cancelQuery).toHaveBeenCalledWith(performQuery.mock.calls[0][3])
- await waitFor(() => expect(requests).toHaveLength(2))
+ await jest.advanceTimersByTimeAsync(300)
+ expect(requests).toHaveLength(2)
unmount()
expect(requests.every((signal) => signal.aborted)).toBe(true)
expect(cancelQuery).toHaveBeenCalledTimes(requests.length)
+ jest.useRealTimers()
performQuery.mockResolvedValue({ results: [['done']] } as never)
const completed = biFilterValuesLogic({
query: { kind: NodeKind.HogQLQuery, query: 'SELECT DISTINCT region AS value FROM accounts' },
@@ -68,7 +73,12 @@ describe('BI filter suggestions', () => {
expect(logic.values.options).toHaveLength(101)
expect(logic.values.hasMore).toBe(false)
expect((performQuery.mock.calls[1][0] as HogQLQuery).query).toContain('OFFSET 100')
- await expectLogic(logic, () => logic.actions.setSearch("O'Reilly")).toFinishAllListeners()
+ await expectLogic(logic, () => logic.actions.setSearch('')).toFinishAllListeners()
+ expect(performQuery).toHaveBeenCalledTimes(2)
+ expect(logic.values.options).toHaveLength(101)
+ logic.actions.setSearch("O'Reilly")
+ expect(logic.values.options).toHaveLength(101)
+ await expectLogic(logic).toFinishAllListeners()
expect(logic.values.options).toEqual(["O'Reilly"])
expect((performQuery.mock.calls[2][0] as HogQLQuery).query).toContain(
"positionCaseInsensitiveUTF8(value, 'O\\'Reilly')"
diff --git a/products/business_intelligence/frontend/biFilterValuesLogic.ts b/products/business_intelligence/frontend/biFilterValuesLogic.ts
index 4bb0d6322a0a..b9e5aa9b3e1b 100644
--- a/products/business_intelligence/frontend/biFilterValuesLogic.ts
+++ b/products/business_intelligence/frontend/biFilterValuesLogic.ts
@@ -33,6 +33,7 @@ export function searchBIFilterValues(query: HogQLQuery, search: string, offset:
}
interface BIFilterValuePage {
+ search: string
values: string[]
hasMore: boolean
}
@@ -121,12 +122,15 @@ export const biFilterValuesLogic = kea<biFilterValuesLogicType>([
const { append = false, debounce = false } = payload
cache.disposables.dispose('valueQuery')
const search = values.search
- const existing = append ? (values.page?.values ?? []) : []
+ const existing = append && values.page?.search === search ? values.page.values : []
+ if (debounce && !append && values.page?.search === search) {
+ return values.page
+ }
if (debounce) {
await breakpoint(300)
}
if (!props.query) {
- return { values: [], hasMore: false }
+ return { search, values: [], hasMore: false }
}
const controller = new AbortController()
const queryId = uuid()
@@ -167,6 +171,7 @@ export const biFilterValuesLogic = kea<biFilterValuesLogicType>([
)
}
return {
+ search,
values: [...existing, ...response.results.slice(0, PAGE_SIZE).map((row) => String(row[0]))],
hasMore: response.results.length > PAGE_SIZE,
}
@@ -176,7 +181,6 @@ export const biFilterValuesLogic = kea<biFilterValuesLogicType>([
})),
reducers({
search: ['', { setSearch: (_, { search }) => search }],
- page: { setSearch: () => null },
optionsError: [
null as string | null,
{
diff --git a/products/business_intelligence/frontend/biLocalFields.test.ts b/products/business_intelligence/frontend/biLocalFields.test.ts
index d0135ca38100..672e4c97bba7 100644
--- a/products/business_intelligence/frontend/biLocalFields.test.ts
+++ b/products/business_intelligence/frontend/biLocalFields.test.ts
@@ -4,9 +4,22 @@ import { NodeKind } from '~/queries/schema/schema-general'
import { getBIDrillQueries, getBIDrillSelection } from './biDrilldown'
import { BIEditorView, buildBIQuery, DEFAULT_BI_CONFIG, parseBIEditorState } from './biEditorTypes'
import { getBIResultDimensions } from './biEditorTypes'
-import { localFieldError, localFieldExpression, upsertBILocalField } from './biLocalFields'
+import { inferBICalculatedFieldType, localFieldError, localFieldExpression, upsertBILocalField } from './biLocalFields'
import { getBIMemberLabel } from './biMemberAliases'
+it.each([
+ ['Nullable(Int64)', 'integer'],
+ ['LowCardinality(Nullable(String))', 'string'],
+ ['Decimal(18, 2)', 'float'],
+ ["DateTime64(3, 'UTC')", 'datetime'],
+ ['Date32', 'date'],
+ ['Bool', 'boolean'],
+ ['Array(String)', undefined],
+ [undefined, undefined],
+])('infers the calculated field type of %s', (type, expected) => {
+ expect(inferBICalculatedFieldType(type)).toBe(expected)
+})
+
it.each<BILocalFieldDefinition>([
{ kind: 'expression', expression: "coalesce(properties.plan, 'Unknown')", aggregate: false },
{ kind: 'expression', expression: 'sum(properties.amount)', aggregate: true },
diff --git a/products/business_intelligence/frontend/biLocalFields.ts b/products/business_intelligence/frontend/biLocalFields.ts
index df23e48a58fe..cdce6d6cff3c 100644
--- a/products/business_intelligence/frontend/biLocalFields.ts
+++ b/products/business_intelligence/frontend/biLocalFields.ts
@@ -51,6 +51,32 @@ export function localFieldError(definition: BILocalFieldDefinition): string | un
}
}
+export function inferBICalculatedFieldType(type: string | undefined): BIField['type'] | undefined {
+ const base = type?.replace(/^(?:Nullable|LowCardinality)\((.*)\)$/, '$1')
+ if (!base) {
+ return undefined
+ }
+ if (/^(?:Nullable|LowCardinality)\(/.test(base)) {
+ return inferBICalculatedFieldType(base)
+ }
+ if (/^U?Int\d+$/.test(base)) {
+ return 'integer'
+ }
+ if (/^(?:Float\d+|Decimal(?:\d+)?\()/.test(base)) {
+ return 'float'
+ }
+ if (base.startsWith('DateTime')) {
+ return 'datetime'
+ }
+ if (/^Date(?:32)?$/.test(base)) {
+ return 'date'
+ }
+ if (base === 'Bool' || base === 'Boolean') {
+ return 'boolean'
+ }
+ return /^(?:String|FixedString\(|UUID|Enum)/.test(base) ? 'string' : undefined
+}
+
export function localFieldExpression(definition: BILocalFieldDefinition): string {
if (definition.kind === 'expression') {
return definition.expression.trim()
diff --git a/products/business_intelligence/frontend/biSceneLogic.test.ts b/products/business_intelligence/frontend/biSceneLogic.test.ts
index 0e901bb85cd5..bede80f25ce7 100644
--- a/products/business_intelligence/frontend/biSceneLogic.test.ts
+++ b/products/business_intelligence/frontend/biSceneLogic.test.ts
@@ -302,7 +302,7 @@ describe('biSceneLogic', () => {
expect(logic.values.worksheet.config.source).toBeNull()
const dataLogic = dataNodeLogic({
key: logic.values.dataNodeKey,
- query: logic.values.worksheet.source,
+ query: getBIVisualizationSource(logic.values.worksheet),
autoLoad: false,
})
const unmount = dataLogic.mount()
diff --git a/products/business_intelligence/frontend/components/BIDataPane.tsx b/products/business_intelligence/frontend/components/BIDataPane.tsx
index 8af1cc86527a..820027ece389 100644
--- a/products/business_intelligence/frontend/components/BIDataPane.tsx
+++ b/products/business_intelligence/frontend/components/BIDataPane.tsx
@@ -109,22 +109,20 @@ export function BIDataPane({ tabId }: { tabId: string }): JSX.Element {
/>
</>
)}
+ {config.source && !dataPaneFieldsError && (
+ <LemonButton
+ icon={<IconPlus />}
+ size="xsmall"
+ fullWidth
+ onClick={() => editCalculatedField()}
+ data-attr="bi-editor-add-calculated-measure"
+ >
+ Add calculated field
+ </LemonButton>
+ )}
{config.source && !dataPaneFieldsError ? <BIHierarchySection tabId={tabId} /> : null}
{config.source && !dataPaneFieldsError ? <BIConnections /> : null}
</div>
- <div className="border-t p-2">
- <LemonButton
- icon={<IconPlus />}
- size="xsmall"
- fullWidth
- type="secondary"
- onClick={() => editCalculatedField()}
- disabledReason={!config.source ? 'Select a data source first' : undefined}
- data-attr="bi-editor-add-calculated-measure"
- >
- Add calculated field
- </LemonButton>
- </div>
</div>
)
}
diff --git a/products/business_intelligence/frontend/components/BIFilterEditor.tsx b/products/business_intelligence/frontend/components/BIFilterEditor.tsx
index da7b150c9af2..3a923e3c2e46 100644
--- a/products/business_intelligence/frontend/components/BIFilterEditor.tsx
+++ b/products/business_intelligence/frontend/components/BIFilterEditor.tsx
@@ -12,7 +12,13 @@ import { BIFilterValueInput } from 'products/business_intelligence/frontend/BIFi
import { getBIFilterLabel } from '../biFilterSummary'
-export function BIFilterEditor({ index, onDone }: { index: number; onDone: () => void }): JSX.Element | null {
+export function BIFilterEditor({
+ index,
+ onDone,
+}: {
+ index: number
+ onDone: (removed?: boolean) => void
+}): JSX.Element | null {
const { config } = useValues(biEditorLogic)
const {
removeFieldFromShelf,
@@ -39,7 +45,7 @@ export function BIFilterEditor({ index, onDone }: { index: number; onDone: () =>
type="tertiary"
size="xsmall"
aria-label="Close filter editor"
- onClick={onDone}
+ onClick={() => onDone()}
/>
</div>
<div className="flex flex-col gap-1">
@@ -141,12 +147,12 @@ export function BIFilterEditor({ index, onDone }: { index: number; onDone: () =>
size="small"
onClick={() => {
removeFieldFromShelf('filters', index)
- onDone()
+ onDone(true)
}}
>
Remove filter
</LemonButton>
- <LemonButton type="primary" size="small" onClick={onDone} data-attr="bi-editor-filter-done">
+ <LemonButton type="primary" size="small" onClick={() => onDone()} data-attr="bi-editor-filter-done">
Done
</LemonButton>
</div>
diff --git a/products/business_intelligence/frontend/components/BIFilterPill.test.tsx b/products/business_intelligence/frontend/components/BIFilterPill.test.tsx
new file mode 100644
index 000000000000..5424149d988f
--- /dev/null
+++ b/products/business_intelligence/frontend/components/BIFilterPill.test.tsx
@@ -0,0 +1,48 @@
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { BindLogic } from 'kea'
+
+import { initKeaTests } from '~/test/init'
+
+import { biEditorLogic } from '../biEditorLogic'
+import { BIEditorView, DEFAULT_BI_CONFIG, getBIShelfEditorKey } from '../biEditorTypes'
+import { BIFilterPill } from './BIFilterPill'
+
+describe('BIFilterPill', () => {
+ beforeEach(() => initKeaTests())
+ afterEach(cleanup)
+
+ it.each(['Remove filter', 'Done'])('only discards the empty filter when clicking %s', (button) => {
+ const props = { tabId: 'empty-filter-removal' }
+ const logic = biEditorLogic(props)
+ const unmount = logic.mount()
+ const field = { id: 'empty', name: '', expression: '', type: 'string' as const, source: { table: 'events' } }
+ const nextFilter = {
+ field: { ...field, id: 'event', name: 'event', expression: 'event' },
+ operator: 'is_set' as const,
+ value: '',
+ }
+ logic.actions.setAutoUpdate(false)
+ logic.actions.restoreState({
+ editorView: BIEditorView.BI,
+ config: {
+ ...DEFAULT_BI_CONFIG,
+ source: field.source,
+ filters: [{ field, operator: 'is_set', value: '' }, nextFilter],
+ },
+ })
+ logic.actions.setActiveExpressionEditorId(getBIShelfEditorKey('filters', field.id))
+ try {
+ render(
+ <BindLogic logic={biEditorLogic} props={props}>
+ <BIFilterPill index={0} />
+ </BindLogic>
+ )
+ fireEvent.click(screen.getByText(button))
+ expect(logic.values.config.filters).toEqual([nextFilter])
+ expect(logic.values.activeExpressionEditorId).toBeNull()
+ } finally {
+ cleanup()
+ unmount()
+ }
+ })
+})
diff --git a/products/business_intelligence/frontend/components/BIFilterPill.tsx b/products/business_intelligence/frontend/components/BIFilterPill.tsx
index e82000e22119..2b5d7c913c3e 100644
--- a/products/business_intelligence/frontend/components/BIFilterPill.tsx
+++ b/products/business_intelligence/frontend/components/BIFilterPill.tsx
@@ -13,7 +13,7 @@ import { getBIFilterLabel, describeBIFilter } from '../biFilterSummary'
export function BIFilterPill({ index }: { index: number }): JSX.Element | null {
const { config, activeExpressionEditorId } = useValues(biEditorLogic)
- const { setActiveExpressionEditorId } = useActions(biEditorLogic)
+ const { setActiveExpressionEditorId, removeFieldFromShelf } = useActions(biEditorLogic)
const filter = config.filters[index]
if (!filter) {
return null
@@ -21,9 +21,12 @@ export function BIFilterPill({ index }: { index: number }): JSX.Element | null {
const editorKey = getBIShelfEditorKey('filters', filter.field.id)
const visible = activeExpressionEditorId === editorKey
- const close = (): void => {
+ const close = (removed = false): void => {
if (activeExpressionEditorId === editorKey) {
setActiveExpressionEditorId(null)
+ if (!removed && !filter.field.expression.trim() && !filter.customExpression?.trim()) {
+ removeFieldFromShelf('filters', index)
+ }
}
}
const label = getBIFilterLabel(filter)
diff --git a/products/business_intelligence/frontend/components/BIFiltersCard.tsx b/products/business_intelligence/frontend/components/BIFiltersCard.tsx
index 10c7380420e7..2cbec90ae164 100644
--- a/products/business_intelligence/frontend/components/BIFiltersCard.tsx
+++ b/products/business_intelligence/frontend/components/BIFiltersCard.tsx
@@ -2,7 +2,7 @@ import { useActions, useValues } from 'kea'
import { useState } from 'react'
import { IconFilter, IconPlus, IconX } from '@posthog/icons'
-import { LemonButton, LemonDropdown } from '@posthog/lemon-ui'
+import { LemonButton, LemonDropdown, LemonInputSelect } from '@posthog/lemon-ui'
import { biEditorLogic } from 'products/business_intelligence/frontend/biEditorLogic'
@@ -15,8 +15,12 @@ import { BIShelfDropTarget } from './BIShelfDropTarget'
export function BIFiltersCard(): JSX.Element {
const [resultFiltersOpen, setResultFiltersOpen] = useState(false)
- const { config } = useValues(biEditorLogic)
- const { addBlankFieldToShelf, setFilterGroup } = useActions(biEditorLogic)
+ const [fieldPickerOpen, setFieldPickerOpen] = useState(false)
+ const { config, dataPaneFields, dataPaneFieldsLoading } = useValues(biEditorLogic)
+ const { addBlankFieldToShelf, addFieldToShelf, setFilterGroup } = useActions(biEditorLogic)
+ const filterFields = [...dataPaneFields.dimensions, ...dataPaneFields.measures].filter(
+ (field) => !(field.localDefinition?.kind === 'expression' && field.localDefinition.aggregate)
+ )
return (
<BIShelfDropTarget
@@ -30,16 +34,52 @@ export function BIFiltersCard(): JSX.Element {
{config.filters.map((filter, index) => (
<BIFilterPill key={filter.field.id} index={index} />
))}
- <LemonButton
- icon={<IconPlus />}
- size="xsmall"
- type="tertiary"
- disabledReason={!config.source ? 'Select a data source first' : undefined}
- onClick={() => addBlankFieldToShelf('filters')}
- data-attr="bi-editor-filters-add-field"
+ <LemonDropdown
+ visible={fieldPickerOpen}
+ onVisibilityChange={setFieldPickerOpen}
+ closeOnClickInside={false}
+ placement="bottom-start"
+ overlay={
+ <div className="flex w-64 flex-col gap-2">
+ <LemonInputSelect
+ mode="single"
+ value={[]}
+ options={filterFields.map((field) => ({ key: field.id, label: field.label ?? field.name }))}
+ loading={dataPaneFieldsLoading}
+ placeholder="Search table fields"
+ autoFocus
+ fullWidth
+ onChange={([id]) => {
+ const field = filterFields.find((candidate) => candidate.id === id)
+ if (field) {
+ addFieldToShelf(field, 'filters')
+ setFieldPickerOpen(false)
+ }
+ }}
+ data-attr="bi-filter-field-picker"
+ />
+ <LemonButton
+ size="xsmall"
+ onClick={() => {
+ addBlankFieldToShelf('filters')
+ setFieldPickerOpen(false)
+ }}
+ >
+ Custom SQL expression
+ </LemonButton>
+ </div>
+ }
>
- Add filter
- </LemonButton>
+ <LemonButton
+ icon={<IconPlus />}
+ size="xsmall"
+ type="tertiary"
+ disabledReason={!config.source ? 'Select a data source first' : undefined}
+ data-attr="bi-editor-filters-add-field"
+ >
+ Add filter
+ </LemonButton>
+ </LemonDropdown>
{config.filters.length > 1 && (
<BIConditionGroups
title="Row filter groups"
@@ -57,8 +97,8 @@ export function BIFiltersCard(): JSX.Element {
closeOnClickInside={false}
placement="bottom-end"
overlay={
- <div className="w-72">
- <div className="flex justify-end">
+ <div className="relative w-72">
+ <div className="absolute right-1 top-1 z-10">
<LemonButton
icon={<IconX />}
type="tertiary"
diff --git a/products/business_intelligence/frontend/components/BIShelfStrip.tsx b/products/business_intelligence/frontend/components/BIShelfStrip.tsx
index 50229868a06e..709228637f09 100644
--- a/products/business_intelligence/frontend/components/BIShelfStrip.tsx
+++ b/products/business_intelligence/frontend/components/BIShelfStrip.tsx
@@ -43,7 +43,9 @@ export function BIShelfStrip({
disabledReason={!config.source ? 'Select a data source first' : undefined}
onClick={() => editCalculatedField(undefined, shelf)}
data-attr={`bi-editor-${shelf}-add-field`}
- />
+ >
+ Field
+ </LemonButton>
</div>
</BIShelfDropTarget>
)
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index 67b7b3ebe9d9..27dd98ed8934 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -3081,6 +3081,7 @@ export const DataColorTokenApi = {
export interface ResultCustomizationByValueApi {
assignmentBy?: 'value'
color?: DataColorTokenApi | null
+ customColor?: string | null
hidden?: boolean | null
}
@@ -9195,6 +9196,13 @@ export interface ScatterChartSettingsApi {
xStartAtZero?: boolean | null
}
+export type ValueLabelPositionApi = (typeof ValueLabelPositionApi)[keyof typeof ValueLabelPositionApi]
+
+export const ValueLabelPositionApi = {
+ End: 'end',
+ Center: 'center',
+} as const
+
export type DisplayTypeApi = (typeof DisplayTypeApi)[keyof typeof DisplayTypeApi]
export const DisplayTypeApi = {
@@ -9251,6 +9259,7 @@ export interface ChartAxisApi {
export type ChartSettingsApiResultCustomizations = { [key: string]: ResultCustomizationByValueApi } | null
export interface ChartSettingsApi {
+ barGap?: number | null
boxPlot?: BoxPlotSettingsApi | null
/** Chart rendering style overrides (line shape). Only applies to line and area charts. */
chartStyle?: ChartStyleApi | null
@@ -9277,8 +9286,14 @@ export interface ChartSettingsApi {
showYAxisBorder?: boolean | null
/** Whether we fill the bars to 100% in stacked mode */
stackBars100?: boolean | null
+ valueLabelBackground?: boolean | null
+ valueLabelFontSize?: number | null
+ valueLabelPosition?: ValueLabelPositionApi | null
+ valueLabelRotation?: number | null
xAxis?: ChartAxisApi | null
+ xAxisDateFormat?: string | null
xAxisLabel?: string | null
+ xAxisTickRotation?: number | null
yAxis?: ChartAxisApi[] | null
/** Deprecated: use `[left|right]YAxisSettings`. Whether the Y axis should start at zero */
yAxisAtZero?: boolean | null
diff --git a/products/desktop/packages/api-client/src/generated.ts b/products/desktop/packages/api-client/src/generated.ts
index a8ec6aa7b7db..5b1ac0d0b9fd 100644
--- a/products/desktop/packages/api-client/src/generated.ts
+++ b/products/desktop/packages/api-client/src/generated.ts
@@ -2219,6 +2219,7 @@ export namespace Schemas {
export type ResultCustomizationByValue = Partial<{
assignmentBy: string;
color: DataColorToken | null;
+ customColor: string | null;
hidden: boolean | null;
}>;
export type ResultCustomizationByPosition = Partial<{
@@ -4880,6 +4881,7 @@ export namespace Schemas {
xScale: XScale | null;
xStartAtZero: boolean | null;
}>;
+ export type ValueLabelPosition = "end" | "center";
export type Settings = Partial<{
display: ChartSettingsDisplay | null;
formatting: ChartSettingsFormatting | null;
@@ -4889,6 +4891,7 @@ export namespace Schemas {
settings?: (Settings | null) | undefined;
};
export type ChartSettings = Partial<{
+ barGap: number | null;
boxPlot: BoxPlotSettings | null;
chartStyle: ChartStyle | null;
goalLines: Array<GoalLine> | null;
@@ -4911,8 +4914,14 @@ export namespace Schemas {
showXAxisTicks: boolean | null;
showYAxisBorder: boolean | null;
stackBars100: boolean | null;
+ valueLabelBackground: boolean | null;
+ valueLabelFontSize: number | null;
+ valueLabelPosition: ValueLabelPosition | null;
+ valueLabelRotation: number | null;
xAxis: ChartAxis | null;
+ xAxisDateFormat: string | null;
xAxisLabel: string | null;
+ xAxisTickRotation: number | null;
yAxis: Array<ChartAxis> | null;
yAxisAtZero: boolean | null;
}>;
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index 7e750350c477..fd2b753a7fb0 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -1948,6 +1948,7 @@ export const DataColorTokenApi = {
export interface ResultCustomizationByValueApi {
assignmentBy?: 'value'
color?: DataColorTokenApi | null
+ customColor?: string | null
hidden?: boolean | null
}
@@ -8073,6 +8074,13 @@ export interface ScatterChartSettingsApi {
xStartAtZero?: boolean | null
}
+export type ValueLabelPositionApi = (typeof ValueLabelPositionApi)[keyof typeof ValueLabelPositionApi]
+
+export const ValueLabelPositionApi = {
+ End: 'end',
+ Center: 'center',
+} as const
+
export type DisplayTypeApi = (typeof DisplayTypeApi)[keyof typeof DisplayTypeApi]
export const DisplayTypeApi = {
@@ -8129,6 +8137,7 @@ export interface ChartAxisApi {
export type ChartSettingsApiResultCustomizations = { [key: string]: ResultCustomizationByValueApi } | null
export interface ChartSettingsApi {
+ barGap?: number | null
boxPlot?: BoxPlotSettingsApi | null
/** Chart rendering style overrides (line shape). Only applies to line and area charts. */
chartStyle?: ChartStyleApi | null
@@ -8155,8 +8164,14 @@ export interface ChartSettingsApi {
showYAxisBorder?: boolean | null
/** Whether we fill the bars to 100% in stacked mode */
stackBars100?: boolean | null
+ valueLabelBackground?: boolean | null
+ valueLabelFontSize?: number | null
+ valueLabelPosition?: ValueLabelPositionApi | null
+ valueLabelRotation?: number | null
xAxis?: ChartAxisApi | null
+ xAxisDateFormat?: string | null
xAxisLabel?: string | null
+ xAxisTickRotation?: number | null
yAxis?: ChartAxisApi[] | null
/** Deprecated: use `[left|right]YAxisSettings`. Whether the Y axis should start at zero */
yAxisAtZero?: boolean | null
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index e83ca434abd6..8bc4ea750bfe 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -5538,6 +5538,7 @@ export namespace Schemas {
export interface ResultCustomizationByValue {
assignmentBy?: 'value';
color?: DataColorToken | null;
+ customColor?: string | null;
hidden?: boolean | null;
}
@@ -10626,6 +10627,14 @@ export namespace Schemas {
xStartAtZero?: boolean | null;
}
+ export type ValueLabelPosition = typeof ValueLabelPosition[keyof typeof ValueLabelPosition];
+
+
+ export const ValueLabelPosition = {
+ End: 'end',
+ Center: 'center',
+ } as const;
+
export type DisplayType = typeof DisplayType[keyof typeof DisplayType];
@@ -10685,6 +10694,7 @@ export namespace Schemas {
export type ChartSettingsResultCustomizations = {[key: string]: ResultCustomizationByValue} | null;
export interface ChartSettings {
+ barGap?: number | null;
boxPlot?: BoxPlotSettings | null;
/** Chart rendering style overrides (line shape). Only applies to line and area charts. */
chartStyle?: ChartStyle | null;
@@ -10711,8 +10721,14 @@ export namespace Schemas {
showYAxisBorder?: boolean | null;
/** Whether we fill the bars to 100% in stacked mode */
stackBars100?: boolean | null;
+ valueLabelBackground?: boolean | null;
+ valueLabelFontSize?: number | null;
+ valueLabelPosition?: ValueLabelPosition | null;
+ valueLabelRotation?: number | null;
xAxis?: ChartAxis | null;
+ xAxisDateFormat?: string | null;
xAxisLabel?: string | null;
+ xAxisTickRotation?: number | null;
yAxis?: ChartAxis[] | null;
/** Deprecated: use `[left|right]YAxisSettings`. Whether the Y axis should start at zero */
yAxisAtZero?: boolean | null;