Difference between revisions of "Template:Graph:Barchart"

From HPC Wiki
Jump to navigation Jump to search
(Mukund-pondkule-6a11@uni-paderborn.de moved page Template to Template:Graph:Chart)
Tag: New redirect
 
m (Mukund-pondkule-6a11@uni-paderborn.de moved page Template to Template:Graph:Barchart)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
#REDIRECT [[Template:Graph:Chart]]
+
<includeonly>{{#tag:graph| {
 +
  "version": 2,
 +
  "height": {{{height|200}}},
 +
  "width": {{{width|400}}},
 +
  "padding": "auto",
 +
  "marks": [
 +
    {
 +
      "type": "rect",
 +
      "from": {"data": "table"},
 +
      "properties": {
 +
        "enter": {
 +
          "x": {"scale": "x", "field": "x"},
 +
          "width": {"scale": "x", "band": true, "offset": -1},
 +
          "y": {"scale": "y", "field": "y"},
 +
          "y2": {"scale": "y", "value": 0}
 +
        },
 +
        "update": {
 +
          "fill": {"value": {{{color|"steelblue"}}} }
 +
        }
 +
      }
 +
    }
 +
  ],
 +
  "data": [
 +
    {
 +
      "name": "table", "values": {{{values| [
 +
        {"x": 1,  "y": 28}, {"x": 2,  "y": 55},
 +
        {"x": 3,  "y": 43}, {"x": 4,  "y": 91}
 +
    ] }}}
 +
    }
 +
  ],
 +
  "scales": [
 +
    {
 +
      "name": "x",
 +
      "type": "ordinal",
 +
      "range": "width",
 +
      "domain": {"data": "table", "field": "x"}
 +
    },
 +
    {
 +
      "name": "y",
 +
      "range": "height",
 +
      "nice": true,
 +
      "domain": {"data": "table", "field": "y"}
 +
    }
 +
  ],
 +
  "axes": [
 +
    {"type": "x", "scale": "x",
 +
    "properties":{
 +
      "labels": {
 +
      "angle": { "value": -40 },
 +
      "align": { "value": "right" },
 +
      "baseline": { "value": "middle" },
 +
      "radius": { "value": -2 }
 +
      }
 +
    }
 +
    },
 +
    {"type": "y", "scale": "y", "format":"%"}
 +
  ]
 +
} }}</includeonly>

Latest revision as of 10:19, 21 September 2020