Skip to content
Vega-Lite templates

Near-Miss Reporting Trend (Vega-Lite)

Six months of near-miss reports at a surface mine stacked by potential severity, where rising volume with falling severity is the good news.

Template previewVega-Lite
Rendering…

Make it your own.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "title": "Near misses reported by potential severity - surface mine",
  "data": {
    "values": [
      {"month": "Jan", "severity": "Potential fatality", "n": 3}, {"month": "Jan", "severity": "Lost time potential", "n": 7}, {"month": "Jan", "severity": "First aid potential", "n": 11}, {"month": "Jan", "severity": "Property damage", "n": 6},
      {"month": "Feb", "severity": "Potential fatality", "n": 2}, {"month": "Feb", "severity": "Lost time potential", "n": 9}, {"month": "Feb", "severity": "First aid potential", "n": 15}, {"month": "Feb", "severity": "Property damage", "n": 8},
      {"month": "Mar", "severity": "Potential fatality", "n": 2}, {"month": "Mar", "severity": "Lost time potential", "n": 8}, {"month": "Mar", "severity": "First aid potential", "n": 19}, {"month": "Mar", "severity": "Property damage", "n": 9},
      {"month": "Apr", "severity": "Potential fatality", "n": 1}, {"month": "Apr", "severity": "Lost time potential", "n": 6}, {"month": "Apr", "severity": "First aid potential", "n": 24}, {"month": "Apr", "severity": "Property damage", "n": 11},
      {"month": "May", "severity": "Potential fatality", "n": 1}, {"month": "May", "severity": "Lost time potential", "n": 5}, {"month": "May", "severity": "First aid potential", "n": 28}, {"month": "May", "severity": "Property damage", "n": 12},
      {"month": "Jun", "severity": "Potential fatality", "n": 0}, {"month": "Jun", "severity": "Lost time potential", "n": 4}, {"month": "Jun", "severity": "First aid potential", "n": 33}, {"month": "Jun", "severity": "Property damage", "n": 14}
    ]
  },
  "mark": "bar",
  "encoding": {
    "x": {"field": "month", "type": "ordinal", "sort": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"], "title": null},
    "y": {"field": "n", "type": "quantitative", "stack": "zero", "title": "Reports"},
    "color": {
      "field": "severity", "type": "nominal", "title": "Potential severity",
      "scale": {
        "domain": ["Potential fatality", "Lost time potential", "First aid potential", "Property damage"],
        "range": ["#b91c1c", "#f97316", "#facc15", "#94a3b8"]
      }
    }
  }
}