Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@agha4to
Copy link
Contributor

@agha4to agha4to commented May 30, 2024

Closes: #10267

Description:

Adds row grouping and subtotal functionality to Pivot Tables. Pivot Table and non-Pivot Table components have distinct implementations, and ideally we'd like to combine them. This code does not do that. Instead, it keeps them separate. The underlying Pivot Table data structures have been "retrofitted" rather than rewritten at this time. I think that task is better done in the future when combining the two components, to avoid too much wasted effort.

image

Reviewer actions

  • I have manually tested the changes in the preview environment
  • I have reviewed the code
  • I understand that "request changes" will block this PR from merging

@netlify
Copy link

netlify bot commented May 30, 2024

👷 Deploy request for peaceful-bassi-cbf284 pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 175ae95

@agha4to agha4to changed the title Pivot Table row grouping and subtotals feat: pivot table row grouping and subtotals May 30, 2024
@agha4to agha4to force-pushed the pivot-table-grouping-and-subtotals branch from 7b0b16e to f3b0b3d Compare May 30, 2024 23:07
@ZeRego ZeRego self-assigned this Jun 13, 2024
@ZeRego ZeRego marked this pull request as ready for review June 13, 2024 09:07
Copy link
Collaborator

@ZeRego ZeRego left a comment

Choose a reason for hiding this comment

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

I would appreciate if you rebase this PR after the updates 🙏 🙇

@ZeRego ZeRego marked this pull request as draft June 24, 2024 09:38
@agha4to agha4to force-pushed the pivot-table-grouping-and-subtotals branch from bc75347 to f0245ad Compare June 27, 2024 21:21
@agha4to agha4to marked this pull request as ready for review June 27, 2024 21:28
@12ian34 12ian34 requested a review from ZeRego July 10, 2024 11:09
@agha4to agha4to force-pushed the pivot-table-grouping-and-subtotals branch from 499d787 to ffd44f6 Compare July 11, 2024 18:34
@agha4to
Copy link
Contributor Author

agha4to commented Jul 11, 2024

@ZeRego, thank you for your patience. Refactored per your recommendations and fixed some tests. Thanks again!

@rephus rephus requested review from almeidabbm and removed request for ZeRego July 12, 2024 11:35
@almeidabbm
Copy link
Contributor

Hi @agha4to 👋

I have been testing this and stumbled across a small bug:
I cannot change the order of the row dimensions. Don't think this is related to this PR itself, but allowing to do it would help with displaying the correct row grouping

Screen.Recording.2024-07-12.at.16.40.35.mov

@agha4to
Copy link
Contributor Author

agha4to commented Jul 15, 2024

Hi @almeidabbm, I've been thinking about Rows order and trying to implement something but I'm coming up against a few design questions.

Currently in Pivots, even without this PR:

  • From the Results table, dragging columns reorders them in both the Results and Chart view
  • From the pivot Configure chart sidebar, reordering items under Columns reorders the pivoted items at the top of the Chart

What's proposed:

  • From the pivot Configure chart sidebar, reordering items under Rows should reorder columns in the Chart (It's somewhat confusing that reordering Rows would change column order, but it is standard for pivot tables.)

Questions:

In Configure chart, should Rows drags reflect in the Chart table only or also Results? A couple possibilities:

  • A) Change only Chart because 1) it is after all the Chart config and 2) if dragging Rows changed Results, how would dragging Columns be handled? If we go this route, should drags of Results columns override the Configure chart Rows order and change Chart?
  • B) Change both Chart and Results because it is confusing if the column orders differ between the Results and Charts. If so, again, how would dragging Columns in Chart config be handled to change Results?

What about Metrics? Shouldn't those columns also be draggable to reorder the Chart columns?

I think we need a design spec for all of this. There may be other loose ends to consider too.

@almeidabbm

This comment was marked as resolved.

@agha4to agha4to requested a review from almeidabbm July 19, 2024 18:50
@owlas owlas requested a deployment to duplicate_pivot-table-grouping-and-subtotals - jaffle_db_pg_13 PR #10800 July 23, 2024 09:30 — with Render Abandoned
@owlas owlas deployed to duplicate_pivot-table-grouping-and-subtotals - headless-browser PR #10800 July 23, 2024 09:30 — with Render Active
@owlas owlas temporarily deployed to duplicate_pivot-table-grouping-and-subtotals - lightdash PR #10800 July 23, 2024 09:31 — with Render Destroyed
Copy link
Contributor

@almeidabbm almeidabbm left a comment

Choose a reason for hiding this comment

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

Couple things causing build errors related to types, otherwise types look good

@rephus rephus requested a review from IrakliJani July 24, 2024 10:35
@ZeRego ZeRego assigned IrakliJani and unassigned ZeRego Jul 24, 2024
@owlas owlas temporarily deployed to duplicate_pivot-table-grouping-and-subtotals - headless-browser PR #10800 July 26, 2024 17:09 — with Render Destroyed
@IrakliJani
Copy link
Contributor

render link: https://lightdash-pr-11681.onrender.com

@agha4to
Copy link
Contributor Author

agha4to commented Sep 26, 2024

I heard y'all were busy. I don't think there's a rush--no problem. Afaik, no remaining issues. Here's a look at the recent shading changes:

  1. Last row of Row # column is no longer shaded
  2. Last row of dimension columns are no longer shaded
  3. Last row of metric columns that do not have column totals are no longer shaded
  4. Row total columns, not including last row, are shaded

image

@agha4to agha4to force-pushed the pivot-table-grouping-and-subtotals branch from 18cb3c5 to 3f715c1 Compare September 26, 2024 06:09
@owlas owlas temporarily deployed to pivot-table-grouping-and-subtotals - lightdash PR #11681 September 27, 2024 09:44 — with Render Destroyed
@owlas owlas temporarily deployed to pivot-table-grouping-and-subtotals - headless-browser PR #11681 September 27, 2024 09:44 — with Render Destroyed
@IrakliJani
Copy link
Contributor

@agha4to approving code changes ✅ great work 🙌

@agha4to agha4to requested a review from almeidabbm September 27, 2024 15:28
@IrakliJani IrakliJani merged commit 25d4be8 into lightdash:main Sep 27, 2024
54 of 57 checks passed
lightdash-bot pushed a commit that referenced this pull request Sep 27, 2024
# [0.1281.0](0.1280.0...0.1281.0) (2024-09-27)

### Features

* pivot table row grouping and subtotals ([#10269](#10269)) ([25d4be8](25d4be8))
@lightdash-bot
Copy link
Collaborator

🎉 This PR is included in version 0.1281.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

agha4to added a commit to agha4to/lightdash that referenced this pull request Oct 3, 2024
* feat: pivot table row grouping and subtotals

* refactor: move pivot subtotal data structure retrofit

* test: pivot query result test fixes

* refactor: remove use of any in pivot data structure

* fix: table drilldown for metrics as rows, build issues

* fix: use null marker for subtotals

* fix: font settings, spacing, and group component wrapping

* Update packages/frontend/src/hooks/pivotTable/pivotQueryResults.ts

Co-authored-by: Irakli Janiashvili <[email protected]>

* fix: whitespace

* test: update pivot table data model tests

* chore: avoid mutating code
fix: avoid unsafely inferred `finalHeaderInfoForColumns: any`

* fix: row number col misalignment and checkbox state

* feat: pivot cell shading tweaks

* style: fix LightTable whitespace

---------

Co-authored-by: Tony Orciuoli <[email protected]>
Co-authored-by: Irakli Janiashvili <[email protected]>
agha4to pushed a commit to agha4to/lightdash that referenced this pull request Oct 3, 2024
# [0.1281.0](lightdash/lightdash@0.1280.0...0.1281.0) (2024-09-27)

### Features

* pivot table row grouping and subtotals ([lightdash#10269](lightdash#10269)) ([25d4be8](lightdash@25d4be8))
@agha4to agha4to deleted the pivot-table-grouping-and-subtotals branch November 13, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Pivot Table Row Grouping and Subtotals

6 participants