nicolaskruchten / pivottable

Open-source Javascript Pivot Table (aka Pivot Grid, Pivot Chart, Cross-Tab) implementation with drag'n'drop.
https://pivottable.js.org/
MIT License
4.36k stars 1.08k forks source link

Filter pivottable rows on aggregator value #1043

Open ClementFromFrance opened 5 years ago

ClementFromFrance commented 5 years ago

Hi,

I'm using pivotUI. I made my own aggretator which display empty cells or percentage. I would like to know if there is a way to filter the pivot table in order to remove the empty cells. Here is the aggregator : var DNassortPc = function () { return function () { return { sumDnAssortPc: 0, count: 0, push: function (record) { if (record.presenceneeded == 1) { this.count++; this.sumDnAssortPc += record.dn_assort; } }, value: function () { return (this.sumDnAssortPc / this.count) * 100; }, format: function (x) { if (x != undefined && !isNaN(x)) { return x + " %"; } }, numInputs: 0 }; }; };

and here is a part of the result. I'd like to be able to remove the empty rows. image

I hope it is understandable thanks for your help

nicolaskruchten commented 5 years ago

Yup, this is pretty clear, but unfortunately there's no functionality for that, and I can't think of a workaround other than post-processing the table in the onRefresh callback to drop the rows you want to drop.

See also #1044 which seems really similar :)

SaadAmin5 commented 5 years ago

Hi, but when you select aggregator, the Totals column and row again appears in the data, isn't there any way to get rid of it? Regards

ClementFromFrance commented 5 years ago

Yup, this is pretty clear, but unfortunately there's no functionality for that, and I can't think of a workaround other than post-processing the table in the onRefresh callback to drop the rows you want to drop.

See also #1044 which seems really similar :)

Thanks for your answer I will develop something and let you know if I manage to do something not so bad :)

SaadAmin5 commented 5 years ago

Yup, this is pretty clear, but unfortunately there's no functionality for that, and I can't think of a workaround other than post-processing the table in the onRefresh callback to drop the rows you want to drop. See also #1044 which seems really similar :)

Thanks for your answer I will develop something and let you know if I manage to do something not so bad :)

Hi mate, can you please have a look at the query in the following link: https://community.rstudio.com/t/headers-rownames-columnnames-wrongly-printed-in-excel-when-rpivottable-data-is-exported/17780 Thanks

nicolaskruchten commented 5 years ago

@saad55555 please don’t post off-topic request for people to address you other concerns. You have already raised your issue in the rPivottable repo and stackoverflow, and this issue is not the place to bring it up again.

SaadAmin5 commented 5 years ago

Hi mate, I understand but I’m unable to get an answer from anyplace till now. It’s been more than a week now. And I believe there’s no harm in asking some knowledgeable person for guidance when most of the people refuses to help. I hope you understand. Regards


From: Nicolas Kruchten notifications@github.com Sent: Thursday, November 8, 2018 6:06:53 PM To: nicolaskruchten/pivottable Cc: Saad55555; Mention Subject: Re: [nicolaskruchten/pivottable] Filter pivottable rows on aggregator value (#1043)

@Saad55555https://github.com/Saad55555 please don’t post off-topic request for people to address you other concerns. You have already raised your issue in the rPivottable repo and stackoverflow, and this issue is not the place to bring it up again.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/nicolaskruchten/pivottable/issues/1043#issuecomment-436987501, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aqo_YDsqF08nUZCsQL889kbZK4KET7Gvks5utCxtgaJpZM4YS0MJ.

nicolaskruchten commented 5 years ago

@Saad55555 I do understand, but I'd still like you to comply with this repo's documented support guidelines and not try to hijack existing issues. If you want to open another issue that's fine. That said, the appropriate repo for your concern is the rPivottable repo, and you already have an issue open there. If no one is responding then either they are busy or there is no clear way to accomplish what you are trying to do.

ClementFromFrance commented 5 years ago

Hi Nicolas,

Once again I'm asking for your help I'm trying to use the onRefresh as you suggested. But it's easy to remove the rows which contain data I want to remove, but the problem is with the rowspan of the parent row. image

I think we might be able to fix this by binding a remove event that will calculate rowspan in the renderer or something like it but I can't figure out how and where to start. Do you have any ideas or example ?

Regards, Clement

nicolaskruchten commented 5 years ago

It's a pretty tricky problem for sure. Now that I think about it, perhaps a more straightforward solution would be to provide your own dataClass which would be a fork of PivotData that just doesn't return those keys to the renderer, that way those rows are never in the output in the first place?

ClementFromFrance commented 5 years ago

Hi,

yeah it could be a solution, but then we lost a chance to make a feature wihch could filter values no ?

nicolaskruchten commented 5 years ago

I’m not sure I understand your question, sorry, can you rephrase?

SaadAmin5 commented 5 years ago

Hi Nicolas, could you please reply on my new query as well which I posted yesterday, I was expecting a reply from you. Thanks


From: Nicolas Kruchten notifications@github.com Sent: Monday, November 12, 2018 6:19:33 PM To: nicolaskruchten/pivottable Cc: Saad; Mention Subject: Re: [nicolaskruchten/pivottable] Filter pivottable rows on aggregator value (#1043)

I’m not sure I understand your question, sorry, can you rephrase?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/nicolaskruchten/pivottable/issues/1043#issuecomment-437876802, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aqo_YGsNWRsHGA0nD6YgaodiT-7l1hgLks5uuXVlgaJpZM4YS0MJ.

SaadAmin5 commented 5 years ago

I understand that but you could have at least commented on my post saying there’s no possible solution.


From: Nicolas Kruchten notifications@github.com Sent: Thursday, November 8, 2018 8:29:44 PM To: nicolaskruchten/pivottable Cc: Saad55555; Mention Subject: Re: [nicolaskruchten/pivottable] Filter pivottable rows on aggregator value (#1043)

@Saad55555https://github.com/Saad55555 I do understand, but I'd still like you to comply with this repo's documented support guidelineshttps://github.com/nicolaskruchten/pivottable/blob/master/SUPPORT.md and not try to hijack existing issues. If you want to open another issue that's fine. That said, the appropriate repo for your concern is the rPivottable repo, and you already have an issue open there. If no one is responding then either they are busy or there is no clear way to accomplish what you are trying to do.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/nicolaskruchten/pivottable/issues/1043#issuecomment-437036718, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aqo_YNZVupsRX4JkrsjCT-etGt1ldrShks5utE3ogaJpZM4YS0MJ.

nicolaskruchten commented 5 years ago

@Saad55555 I've already asked you not to hijack this thread with your unrelated requests. If you persist, you will find yourself blocked from this repo.

ClementFromFrance commented 5 years ago

I’m not sure I understand your question, sorry, can you rephrase?

Sorry What I wanted to say is by developping a way to filter empty values, we would developp a way to filter all values of the pivottable. The possibility to filter values would be great.

But if we filter the empty values by creating a custom dataclass to avoid rendering them, we would loose the possibility to filter the values of the pivot.

Is it explained better ? (not a fluent english speaker/writer :) )

nicolaskruchten commented 5 years ago

Yes, this is better-explained, thanks! You can write in french btw, I live in Québec ;)

So right now this library supports input-level filtering based on the attribute values, but not output-level filtering based on aggregator-computed-values, and I don't think I can imagine a nice general-purpose UI for that second use-case at the moment, so I'm not that worried about not having a way to do it, personally.