2024-02-19T07:06:54.324Z |
liane |
10.42.5.232 |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3 Safari/605.1.15 |
[] |
{
"specification": {
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://datagraphics.dc.scilifelab.se/api/dataset/6d6f551abc10413a97a6ab64ebac46bd.csv"
},
"transform": [
{
"calculate": "if(datum.class === 'R&D', 'R&D*', datum.class)",
"as": "classUpdated"
},
{
"calculate": "if(datum.class === 'positive', datum.count, 0)",
"as": "onlyPositive"
},
{
"calculate": "if(datum.class === 'negative', datum.count, 0)",
"as": "onlyNegative"
},
{
"joinaggregate": [
{
"op": "sum",
"field": "onlyPositive",
"as": "onlyPositiveSum"
},
{
"op": "sum",
"field": "onlyNegative",
"as": "onlyNegativeSum"
}
]
},
{
"calculate": "datum.onlyPositiveSum/((datum.onlyPositiveSum+datum.onlyNegativeSum)/100)",
"as": "frPos"
}
],
"hconcat": [
{
"width": 500,
"height": 60,
"title": "Total number of tests",
"encoding": {
"y": {
"field": "classUpdated",
"axis": {
"title": null
},
"type": "nominal",
"sort": [
"positive",
"negative",
"R&D*"
]
},
"x": {
"field": "count",
"aggregate": "sum",
"type": "quantitative",
"title": null,
"scale": {
"padding": 10
}
},
"color": {
"field": "classUpdated",
"legend": null,
"type": "nominal",
"scale": {
"domain": [
"negative",
"positive",
"R&D*"
],
"range": [
"#8fd7f9",
"#ef9292",
"#c7c7c7"
]
}
}
},
"layer": [
{
"mark": {
"type": "bar"
}
},
{
"mark": {
"type": "text",
"align": "left",
"baseline": "middle",
"dx": 3,
"fill": "black"
},
"encoding": {
"text": {
"field": "count",
"aggregate": "sum",
"type": "quantitative"
}
}
}
]
},
{
"title": "Sum total",
"width": 100,
"height": 60,
"mark": {
"type": "text",
"baseline": "middle",
"fontSize": 14,
"fill": "black"
},
"encoding": {
"text": {
"field": "count",
"aggregate": "sum",
"type": "quantitative"
}
}
},
{
"title": "Proportion positive**",
"width": 100,
"height": 60,
"mark": {
"type": "text",
"baseline": "middle",
"fontSize": 14,
"fill": "black"
},
"encoding": {
"text": {
"field": "frPos",
"aggregate": "mean",
"type": "quantitative",
"format": ".2f"
}
}
}
]
},
"error": null
} |
{} |