gicentre / elm-vegalite

Elm - Vega-Lite Integration for functional declarative visualization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to: set ArgMax/ArgMin to a field?

DougBurke opened this issue · comments

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

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.

Pushed for next release.