pat310 / quick-pivot

Quickly format data to create a pivot table
https://www.npmjs.com/package/quick-pivot
MIT License
64 stars 21 forks source link

Support Multiple Aggregation Dimensions #75

Open jrweinb opened 6 years ago

jrweinb commented 6 years ago

It would be great to have the type of functionality seen in this Pivot component:

Webix Pivot Component

Here, both GDP and OIL are aggregation dimensions, with configurable aggregators. I tried forking the library and working on it on my own, but I was unable to get it working on first pass. Any suggestions or recommendations on where to focus? Thanks!

pat310 commented 6 years ago

Most of the business logic is located in src/logic, so that's likely where you would poke around. Is it possible to do the configurable aggregators using the callback function? You have access to each of the aggregation fields in that callback function so you could configure any aggregations that you wanted

jrweinb commented 6 years ago

@pat310 Thanks for your input! So I am able to use the callback function to do exactly what you suggest, but the results are hard to understand when rendered without column headers (from a UX perspective). Its definitely a workable solution, but I would prefer to create a feature where you could give an array of aggregation dimensions and a flag to show/hide column headers for each aggregation.

I am currently working on adding the new columns in createColumnHeaders and I will see where that gets me.

jrweinb commented 6 years ago

@pat310 - I got this working, but I need to do a lot of refactoring and test writing before I would submit a PR. It accepts an array of aggregationDimensions and create column headers for each aggregation under its parent. Below is a rendering of my pivot table, where the input array of aggDimensions is: ['value1', 'value2']

screen shot 2018-05-21 at 5 21 51 pm

I am also going to work on different types of aggregations for each aggregation dimension once this is complete. I will send another update when I have made more progress

pat310 commented 6 years ago

Wow looks great so far!

On Mon, May 21, 2018 at 5:23 PM, jrweinb notifications@github.com wrote:

@pat310 https://github.com/pat310 - I got this working, but I need to do a lot of refactoring and test writing before I would submit a PR. It accepts an array of aggregationDimensions and create column headers for each aggregation under its parent. Below is a rendering of my pivot table, where the input array of aggDimensions is: ['value1', 'value2']

[image: screen shot 2018-05-21 at 5 21 51 pm] https://user-images.githubusercontent.com/424662/40330610-7d0ed1fe-5d1b-11e8-91a7-26c9d942d46f.png

I am also going to work on different types of aggregations for each aggregation dimension once this is complete. I will send another update when I have made more progress

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pat310/quick-pivot/issues/75#issuecomment-390787200, or mute the thread https://github.com/notifications/unsubscribe-auth/ALpZGD8UciJ8yX3h_SXNo8aUlxLpruNmks5t0zBRgaJpZM4T70MF .

rmdort commented 6 years ago

@jrweinb Looks really good. Any possibility of having this feature merged?

pat310 commented 6 years ago

If a PR is made for it, I'll merge it in

rmdort commented 6 years ago

@jrweinb Do you have fork of a working version that supports multiple agg? Care to share?

fmq commented 5 years ago

@jrweinb I know it's old now but could you share your code for this? I have to code the same functionality and it would be great to have your code to Strat from

Thanks!

lovelyelfpop commented 4 years ago

@jrweinb Could you share your code, please? Thank you

Gydunhn commented 4 years ago

@jrweinb @fmq I have to code the same functionality too!, any news ? :)