I have this example data
"values": [
{"host": "host-one", "score": 70, date: 1593674604},
{"host": "host-two", "score": 30, date: 1593674608},
{"host": "host-three", "score": 12, date: 1593674615},
{"host": "host-two", "score": 95, date: 1593674624},
{"host": "host-three", "score": 1, date: 1593674633}
]
In a heatmap I have to show top 10 host, based on the sum of the score per host, in the y axis, I have tried in many ways without success, this is what I have tried the last time:
}
transform: [
{calculate: "datum.key.date", as: "date"}
{calculate: "datum.key.host", as: "host"}
{calculate: "datum.key.score", as: "score"}
{
window: [
{op: "sum", field: "score", as: "score_order"}
]
}
groupby: ["host"]
]
mark: {type: "rect", cornerRadius: 3}
encoding: {
x: {
bin: {maxbins: 80}
field: date
type: temporal
}
y: {
field: host
type: ordinal
sort: {field: "score_order", order: "descending"}
}
Any clues on what Im doing wrong?