NPC test statistics, weekly fraction positive

API
Dataset
NPC statistics data set 2020-12-22T10:06:26.847Z
Other graphics for same dataset
{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "data": {
    "url": "https://datagraphics.dckube.scilifelab.se/api/dataset/bbbaf64a25a1452287a8630503f07418.csv"
  },
  "width": 800,
  "height": 100,
  "transform": [
    {
      "filter": "datum.class!='invalid/inconclusive'"
    },
    {
      "calculate": "datum.count",
      "as": "counts"
    },
    {
      "calculate": "day(datetime(utcyear(datum.date), 0, 1))",
      "as": "startingDay"
    },
    {
      "calculate": "(4 - datum.startingDay) % 7 - 2",
      "as": "mondayOfFirstWeek"
    },
    {
      "calculate": "1 + floor((utcdayofyear(datum.date) - datum.mondayOfFirstWeek) / 7)",
      "as": "ISOweek"
    }
  ],
  "mark": {
    "type": "bar",
    "tooltip": true,
    "clip": true
  },
  "encoding": {
    "x": {
      "title": "Week",
      "field": "ISOweek",
      "type": "ordinal",
      "axis": {
        "labelAngle": 0
      }
    },
    "y": {
      "aggregate": "sum",
      "field": "counts",
      "type": "quantitative",
      "stack": "normalize",
      "title": "Fraction of tests",
      "scale": {
        "domain": [
          0,
          0.3
        ]
      },
      "axis": {
        "orient": "right",
        "format": ".1%",
        "title": "Fraction positive"
      }
    },
    "color": {
      "field": "class",
      "type": "nominal",
      "scale": {
        "domain": [
          "positive"
        ],
        "range": [
          "#ef9292"
        ]
      },
      "legend": null
    }
  }
}
Owner: arnold
Modified 2020-11-12T16:41:19.455Z
Created 2020-11-12T16:32:45.120Z

DataGraphics version 0.7.8