how to: set ArgMax/ArgMin to a field?
DougBurke opened this issue · comments
Doug Burke commented
From https://vega.github.io/vega-lite/examples/bar_argmax.html - I tried (very quickly) to replicate this with a separate transform
, but couldn't get it to work.
"encoding": {
"x": {"aggregate": {"argmax": "US_Gross"}, "field": "Production_Budget", "type": "quantitative"},
"y": {"field": "Major_Genre", "type": "nominal"}
}
I looked in the 3.3.0 spec and it looks like both ArgMax
and ArgMin
should take an optional field name/string:
"Aggregate": {
"anyOf": [
{
"$ref": "#/definitions/AggregateOp"
},
{
"$ref": "#/definitions/ArgmaxDef"
},
{
"$ref": "#/definitions/ArgminDef"
}
]
},
where
"ArgmaxDef": {
"additionalProperties": false,
"properties": {
"argmax": {
"type": "string"
}
},
"required": [
"argmax"
],
"type": "object"
},
and similar for ArgminDef
. Presumably something like
opArgMax : Maybe String -> Operation
Jo Wood commented
Thanks for pointing this out. I'm not sure how this parameter was missed, so will add it in as a breaking change for the next release.
Jo Wood commented
Pushed for next release.