In vega how do I handle "other" cases with a scale

Hello All,

I have an ordinal scale that contains items [ A, B, C] and data that has values of [A,B,C,D,E,F] how do I put D,E, and F under a catch all with the scale? Similar to how "other" functions in other kibana visualizations, I ask because my original data set had too many values for the legend so I am building a second data set that only has a constrained value set so that I can limit my scale to like 10 items and then have others placed under "other"

Thank you!

@nyuriks - can u shed some light here.

Hi @nsimi, there is an example for top-K graph (funny enough it was created after I posted a similar issue a while back). The main idea is that you want to prepare your data first -- use aggregate transformation to group it by some value and sum or count the content of each group. Afterwards, use window transformation to sort the result and use row_number to decide if you want to keep the value as unique or as part of "all other". A side note -- Elasticsearch can actually do this work for you in many cases, and you can simply look at the resulting data.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.