VegaLite({
data: {values: data},
transform: [{
impute: "precipitation",
key: "date",
value: NaN,
method: "value",
groupby: ["weather"],
}],
mark: {type: "line", point: true},
encoding:{
x: {timeUnit: "month", field: "date", type: "nominal"},
y: {aggregate: "mean", field: "precipitation", type: "quantitative"},
color: {
condition: {test: {field: "precipitation", aggregate: "mean", valid: false}, value: "transparent"},
field: "weather", type: "nominal"
}
}
})