-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make facet support sort
#2176
Comments
|
Sorting when there is only Thus, group mark's cc: @jheer |
Before the new layout features, I believe this would be handled by sorting scale domains. In that case, sorting works by generating an aggregate transform under the hood and sorting by that. An analogous approach could be taken here. Either (1) one could create an explicit aggregate and sort by the results using the group mark |
Yep.
I was thinking that we need to do this too, but that will add some more complexity to the dataflow as we will have to fork two datasets to calculate aggregate for row and for column and then "merge" both of them using lookup (twice). Thus, I wanna run it by you first if this is the only way. Meanwhile, I was thinking for a while whether Vega should support a transform that adds a new column with group summary values (like in dplyr). This would be equivalent to fork a data source, aggregate and join it back, but can be done within one transform. This could be useful in many cases. For example, calculating group residual (value - group mean) would require such operation. Obviously, this transform would make sorting operation here way simpler too. In any case, I think we would start by supporting sorting when there is only |
Sure, I could imagine adding an operator the performs an aggregate and automatically joins the results back onto the input stream. That could be useful for a number of calculations. The internal implementation could reuse the existing Any thoughts on a good name for such an operator? |
Good question. (I originally did not name it above because I don't have a good name off the top of my head too :p) Now that I'm forced to think, I'm gonna some bad ideas to brainstorm:
Another possible idea is to have a boolean flag for the original
I personally think that this is more like a different transform, so I don't really like boolean flag -- but two-words name are also bad -- so it's probably worth mentioning here. Plus, it seems like MongoDB uses cc: @arvind |
Thinking a bit more -- I start liking the "boolean" flag approach a bit more as it can fit in naturally with our |
OK, I've added a new The new operator and documentation will be included in the next Vega beta release. |
@domoritz -- I believe the right place to (Since facetNode will be moved down and aggregate might show up above the facetNode, but then will have to make sure that the facetNode takes data that still have an output from We will have to help with the dataflow part and @yhoonkim is happy to help with the rest of the related code. |
Greetings, I'm wondering if there's a way to specify the ordering of a For example, I would have expected to be able to specify the scale domain as follows, but this configuration is not changing the ordering:
Perhaps I'm missing something? Or is it not supported to control the ordering of facets? Thank you. |
Hi, I have a use case where I want to sort only a I've tried adding an |
One workaround is to modify the underlying Vega spec. |
thanks for the quick reply! |
You can use vega editor to generate vega output that you can start from. Then you can use mark sort operator to sort the mark groups (see https://vega.github.io/vega/docs/marks/). |
Fixed in #3854 -- only one case left (supporting sort array) -- but let's fork a new issue for that. |
Add
sort: SortOrder | SortField
toFacetFieldDef
add WindowNode for this purpose to perform
window
transform.Modify the facet sort related lines in Sort facet values in ascending order as default #2581
Add
sort
back to the barley examplesort
array like in Custom sort order #2915Output modify
New window transform to derive the field to sort
facet's groupby need to include the derived field
sort of the cell group need to use the derived field instead
add similar
calculation
to the header aggregate calculationuse the aggregated field to sort the header too
The text was updated successfully, but these errors were encountered: