{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "https://datagraphics.dc.scilifelab.se/api/dataset/6d6f551abc10413a97a6ab64ebac46bd.csv"
},
"transform": [
{
"calculate": "if(datum.class === 'positive', 0, if(datum.class === 'negative', 1, 2))",
"as": "classOrder"
},
{
"calculate": "if(datum.class === 'R&D', 'R&D*', datum.class)",
"as": "classUpdated"
}
],
"width": 800,
"height": 250,
"mark": {
"type": "bar"
},
"encoding": {
"x": {
"title": "Week",
"field": "week",
"type": "nominal",
"axis": {
"labelOverlap": "parity"
}
},
"y": {
"title": "Number of tests",
"field": "count",
"type": "quantitative",
"axis": {
"orient": "right"
}
},
"color": {
"field": "classUpdated",
"type": "nominal",
"scale": {
"domain": [
"R&D*",
"negative",
"positive"
],
"range": [
"#c7c7c7",
"#8fd7f9",
"#ef9292"
]
},
"legend": {
"title": "Test results"
}
},
"order": {
"field": "classOrder",
"type": "nominal"
},
"tooltip": [
{
"field": "week",
"type": "nominal",
"title": "Week"
},
{
"field": "classUpdated",
"type": "nominal",
"title": "Test result"
},
{
"field": "count",
"type": "quantitative",
"title": "Number of tests"
}
]
}
}