Format: Ro: Diferență între versiuni
De la alegeri.md
Oleg (Discuție | contribuții) |
Oleg (Discuție | contribuții) |
||
(Nu s-au afișat 17 versiuni intermediare efectuate de același utilizator) | |||
Linia 1: | Linia 1: | ||
+ | <!-- | ||
<graph>{ | <graph>{ | ||
"version": 2, | "version": 2, | ||
Linia 12: | Linia 13: | ||
"name": "table", | "name": "table", | ||
"values": [ | "values": [ | ||
− | {"x": "7 mar", "y": 99 | + | {"x": "7 mar", "y": 99}, |
− | {"x": "B", "y": 55 | + | {"x": "B", "y": 55}, |
{"x": "C", "y": 43}, | {"x": "C", "y": 43}, | ||
{"x": "D", "y": 91}, | {"x": "D", "y": 91}, | ||
Linia 26: | Linia 27: | ||
"type": "ordinal", | "type": "ordinal", | ||
"range": "width", | "range": "width", | ||
− | "padding": 0. | + | "padding": 0.8, |
"round": true, | "round": true, | ||
"domain": {"data": "table", "field": "x"} | "domain": {"data": "table", "field": "x"} | ||
Linia 43: | Linia 44: | ||
"type": "x", | "type": "x", | ||
"scale": "x", | "scale": "x", | ||
+ | // "grid": true, | ||
"values": ["7 mar", "31 iul"], | "values": ["7 mar", "31 iul"], | ||
"properties": | "properties": | ||
{ | { | ||
− | "ticks": {"stroke": {"value": "# | + | "ticks": {"stroke": {"value": "#aaa"}}, |
"labels": {"fill": {"value": "#666"}, "fontSize": {"value": 12}}, | "labels": {"fill": {"value": "#666"}, "fontSize": {"value": 12}}, | ||
"axis": {"stroke": {"value": "#ccc"}} | "axis": {"stroke": {"value": "#ccc"}} | ||
Linia 55: | Linia 57: | ||
"scale": "y", | "scale": "y", | ||
// "offset": 5, // отступ от графика | // "offset": 5, // отступ от графика | ||
− | "ticks": 5, // кол-во значений на оси y | + | // "ticks": 5, // кол-во значений на оси y |
// "tickSize": 2, | // "tickSize": 2, | ||
// "tickSizeEnd": 10, | // "tickSizeEnd": 10, | ||
Linia 62: | Linia 64: | ||
"properties": | "properties": | ||
{ | { | ||
− | "ticks": {"stroke": {"value": "# | + | "ticks": {"stroke": {"value": "#d9d9d9"}}, |
"labels": {"fill": {"value": "#666"}, "fontSize": {"value": 12}}, | "labels": {"fill": {"value": "#666"}, "fontSize": {"value": 12}}, | ||
"axis": {"stroke": {"value": "#ccc"}} | "axis": {"stroke": {"value": "#ccc"}} | ||
Linia 68: | Linia 70: | ||
} | } | ||
], | ], | ||
− | + | // | |
"marks": [ | "marks": [ | ||
− | { | + | { |
− | " | + | "type": "rect", |
− | " | + | "from": {"data": "table"}, |
− | " | + | "properties": { |
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "x"}, | ||
+ | "width": {"scale": "x", "band": 1, "offset": 0}, | ||
+ | "y": {"scale": "y", "field": "y"}, | ||
+ | "y2": {"scale": "y", "value": 0} | ||
+ | }, | ||
+ | "update": { | ||
+ | "fill": {"value": "#ff8a88"} | ||
+ | }, | ||
+ | "hover": { | ||
+ | "fill": {"value": "#c33"} | ||
}, | }, | ||
− | + | } | |
− | + | } | |
− | + | ] | |
− | + | }</graph> | |
− | + | ||
− | + | ---- | |
− | + | ||
− | + | --> | |
− | + | ||
− | + | ===-1=== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | " | + | <graph>{ |
− | + | "width": 400, | |
− | + | "height": 120, | |
− | + | "data": [ | |
− | + | { | |
− | + | "name": "table", | |
− | + | "values": [ | |
− | + | {"year":2008, "daily":26.541}, | |
− | + | {"year":2009, "daily":24.748}, | |
− | + | {"year":2010, "daily":24.803}, | |
− | + | {"year":2011, "daily":25.483}, | |
− | + | {"year":2012, "daily":24.729}, | |
− | + | {"year":2013, "daily":24.413}, | |
− | + | {"year":2014, "daily":24.879}, | |
− | + | ] | |
− | + | } | |
− | + | ], | |
− | + | "signals": [ | |
− | + | { | |
− | + | "name": "tooltip", | |
− | + | "init": {}, | |
− | + | "streams": [ | |
− | + | {"type": "symbol:mouseover", "expr": "datum"}, | |
− | + | {"type": "symbol:mouseout", "expr": "{}"} | |
− | + | ] | |
− | + | } | |
− | + | ], | |
− | + | "predicates": [ | |
− | + | { | |
− | + | "name": "tooltip", "type": "==", | |
− | + | "operands": [{"signal": "tooltip._id"}, {"arg": "id"}] | |
− | + | } | |
− | + | ], | |
− | + | "scales": [ | |
− | + | {"name": "time", "type": "linear", "nice": true, "zero": false, "round": true, | |
− | + | "range": "width", "domain": {"data":"table", "field":"year"}}, | |
− | + | {"name": "traffic", "nice": true, "zero": false, "round": true, | |
− | + | "range": "height", "domain": {"data":"table", "field":"daily"}}, | |
− | + | { | |
− | + | "name": "align", | |
− | + | "type": "ordinal", | |
− | + | "domain": ["left", "right", "top", "bottom"], | |
− | + | "range": ["right", "left", "center", "center"] | |
− | + | }, | |
− | + | { | |
− | + | "name": "base", | |
− | + | "type": "ordinal", | |
− | + | "domain": ["left", "right", "top", "bottom"], | |
− | + | "range": ["middle", "middle", "bottom", "top"] | |
− | + | }, | |
− | + | { | |
− | + | "name": "dx", | |
− | + | "type": "ordinal", | |
− | + | "domain": ["left", "right", "top", "bottom"], | |
− | + | "range": [-7, 6, 0, 50] | |
− | + | }, | |
− | + | { | |
− | + | "name": "dy", | |
− | + | "type": "ordinal", | |
− | + | "domain": ["left", "right", "top", "bottom"], | |
− | + | "range": [1, 1, -5, 6] | |
− | + | } | |
− | + | ], | |
− | + | "axes": [ | |
− | + | {"type": "x", "scale": "time", "title": "Year", "titleOffset": 35, "format": "4d", "ticks": 7}, | |
− | + | {"type": "y", "scale": "traffic", "title": "Daily (10k)", "titleOffset": 40, "grid": true, "ticks": 7} | |
− | + | ], | |
− | + | "marks": [ | |
− | + | { | |
− | + | "type": "line", | |
− | + | "from": {"data": "table"}, | |
− | + | "properties": { | |
− | + | "enter": { | |
− | + | "interpolate": {"value": "monotone"}, | |
− | + | "x": {"scale": "time", "field": "year"}, | |
− | + | "y": {"scale": "traffic", "field": "daily"}, | |
− | + | "stroke": {"value": "#000"}, | |
− | + | "strokeWidth": {"value": 3} | |
− | + | } | |
− | + | } | |
− | + | }, | |
− | + | { | |
− | + | "type": "symbol", | |
− | + | "from": {"data": "table"}, | |
− | + | "properties": { | |
− | + | "enter": { | |
− | + | "x": {"scale": "time", "field": "year"}, | |
− | + | "y": {"scale": "traffic", "field": "daily"}, | |
− | + | "fill": {"value": "#fff"}, | |
− | + | "stroke": {"value": "#000"}, | |
− | + | "strokeWidth": {"value": 1}, | |
− | + | "size": {"value": 49} | |
− | + | } | |
− | + | } | |
− | + | }, | |
+ | { | ||
+ | "type": "text", | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "align": {"value": "center"}, | ||
+ | "fill": {"value": "#333"} | ||
+ | }, | ||
+ | "update": { | ||
+ | "x": {"scale": "time", "signal": "tooltip.year"}, | ||
+ | "dx": {"scale": "dx", "field": "right"}, | ||
+ | "y": {"scale": "traffic", "signal": "tooltip.daily", "offset": -12}, | ||
+ | "dy": {"scale": "dy", "field": "right"}, | ||
+ | "text": {"signal": "tooltip.daily"}, | ||
+ | "fillOpacity": { | ||
+ | "rule": [ | ||
+ | { | ||
+ | "predicate": { | ||
+ | "name": "tooltip", | ||
+ | "id": {"value": null} | ||
+ | }, | ||
+ | "value": 0 | ||
+ | }, | ||
+ | {"value": 1} | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | |||
+ | ===0=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "scales": [ | ||
+ | { | ||
+ | "padding": 0.2, | ||
+ | "range": "height", | ||
+ | "type": "ordinal", | ||
+ | "domain": { | ||
+ | "field": "category", | ||
+ | "data": "table" | ||
+ | }, | ||
+ | "name": "cat" | ||
+ | }, | ||
+ | { | ||
+ | "domain": { | ||
+ | "field": "value", | ||
+ | "data": "table" | ||
+ | }, | ||
+ | "name": "val", | ||
+ | "range": "width", | ||
+ | "type": "linear", | ||
+ | "round": "true", | ||
+ | "nice": "true" | ||
+ | }, | ||
+ | { | ||
+ | "range": "category20", | ||
+ | "type": "ordinal", | ||
+ | "domain": { | ||
+ | "field": "position", | ||
+ | "data": "table" | ||
+ | }, | ||
+ | "name": "color" | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | { | ||
+ | "tickSize": 0, | ||
+ | "scale": "cat", | ||
+ | "type": "y", | ||
+ | "tickPadding": 8 | ||
+ | }, | ||
+ | { | ||
+ | "scale": "val", | ||
+ | "type": "x" | ||
+ | } | ||
+ | ], | ||
+ | "signals": [ | ||
+ | { | ||
+ | "name": "tooltip", | ||
+ | "init": {}, | ||
+ | "streams": [ | ||
+ | {"type": "rect:mouseover", "expr": "datum"}, | ||
+ | {"type": "rect:mouseout", "expr": "{}"} | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "predicates": [ | ||
+ | { | ||
+ | "name": "tooltip", "type": "==", | ||
+ | "operands": [{"signal": "tooltip._id"}, {"arg": "id"}] | ||
+ | } | ||
+ | ], | ||
+ | "height": 800, | ||
+ | "width": 600, | ||
+ | "marks": [ | ||
+ | { | ||
+ | "from": { | ||
+ | "data": "table", | ||
+ | "transform": [ | ||
+ | { | ||
+ | "type": "facet", | ||
+ | "groupby": [ | ||
+ | "category" | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "name": "bars", | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "y": { | ||
+ | "field": "position", | ||
+ | "scale": "pos" | ||
+ | }, | ||
+ | "x": { | ||
+ | "field": "value", | ||
+ | "scale": "val" | ||
+ | }, | ||
+ | "x2": { | ||
+ | "scale": "val", | ||
+ | "value": 0 | ||
+ | }, | ||
+ | "fill": { | ||
+ | "field": "position", | ||
+ | "scale": "color" | ||
+ | }, | ||
+ | "height": { | ||
+ | "band": "true", | ||
+ | "scale": "pos" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "from": { | ||
+ | "mark": "bars" | ||
+ | }, | ||
+ | "type": "text", | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "align": {"value": "center"}, | ||
+ | "fill": {"value": "#333"} | ||
+ | }, | ||
+ | "update": { | ||
+ | "x": { "field": "x2"}, | ||
+ | "dy": {"field":"height", "mult": 0.5}, | ||
+ | "y": {"field":"y"}, | ||
+ | "text": {"field": "datum.label"}, | ||
+ | "align": {"value":"center"}, | ||
+ | "baseline":{"value":"middle"}, | ||
+ | "fillOpacity": { | ||
+ | "rule": [ | ||
+ | { | ||
+ | "predicate": {"name": "tooltip", "id": {"value": null}}, | ||
+ | "value": 0 | ||
+ | }, | ||
+ | {"value": 1} | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "type": "group", | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "y": { | ||
+ | "field": "key", | ||
+ | "scale": "cat" | ||
+ | }, | ||
+ | "height": { | ||
+ | "band": "true", | ||
+ | "scale": "cat" | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "scales": [ | ||
+ | { | ||
+ | "range": "height", | ||
+ | "type": "ordinal", | ||
+ | "name": "pos", | ||
+ | "domain": { | ||
+ | "field": "position" | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "data": [ | ||
+ | { | ||
+ | "values": [ | ||
+ | { | ||
+ | "category": "A", | ||
+ | "position": 1, | ||
+ | "value": 1661.0, | ||
+ | "label": 40.0 | ||
+ | }, | ||
+ | { | ||
+ | "category": "A", | ||
+ | "position": 2, | ||
+ | "value": 2928.0, | ||
+ | "label": 35.0 | ||
+ | }, | ||
+ | { | ||
+ | "category": "A", | ||
+ | "position": 3, | ||
+ | "value": 9010.0, | ||
+ | "label": 69.0 | ||
+ | }, | ||
+ | { | ||
+ | "category": "A", | ||
+ | "position": 4, | ||
+ | "value": 6459.0, | ||
+ | "label": 97.0 | ||
+ | }, | ||
+ | { | ||
+ | "category": "B", | ||
+ | "position": 1, | ||
+ | "value": 1022.0, | ||
+ | "label": 39.0 | ||
+ | }, | ||
+ | { | ||
+ | "category": "B", | ||
+ | "position": 2, | ||
+ | "value": 1185.0, | ||
+ | "label": 33.0 | ||
+ | }, | ||
+ | { | ||
+ | "category": "B", | ||
+ | "position": 3, | ||
+ | "value": 567.0, | ||
+ | "label": 60.0 | ||
+ | }, | ||
+ | { | ||
+ | "category": "B", | ||
+ | "position": 4, | ||
+ | "value": 759.0, | ||
+ | "label": 84.0 | ||
+ | } | ||
+ | ], | ||
+ | "name": "table" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </graph> | ||
+ | |||
+ | ===1=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "version": 2, | ||
+ | "width": 500, | ||
+ | "height": 250, | ||
+ | "padding": "auto", | ||
+ | "data": [ | ||
{ | { | ||
− | " | + | "name": "table", |
− | " | + | "values": [ |
− | + | {"year": 2005,"population": 6, "photo" : 6 }, | |
− | + | {"year": 2006,"population": 15, "photo" : 17}, | |
− | + | {"year": 2007,"population": 16, "photo" : 21}, | |
− | + | {"year": 2008,"population": 22, "photo" : 28}, | |
− | + | {"year": 2009,"population": 19, "photo" : 25}, | |
− | + | {"year": 2010,"population": 25, "photo" : 50}, | |
+ | {"year": 2011,"population": 18, "photo" : 33}, | ||
+ | {"year": 2012,"population": 22, "photo" : 67}, | ||
+ | {"year": 2013,"population": 34, "photo" : 174}, | ||
+ | {"year": 2014,"population": 17, "photo" : 183}, | ||
+ | {"year": 2015,"population": 22, "photo" : 206}, | ||
+ | {"year": 2016,"population": 30, "photo" : 338}, | ||
+ | {"year": 2017,"population": 31, "photo" : 1102}, | ||
+ | {"year": 2018,"population": 48, "photo" : 2008}, | ||
+ | {"year": 2019,"population": 48, "photo" : 2008}, | ||
+ | ] | ||
+ | }, | ||
{ | { | ||
− | " | + | "name": "annotation", |
− | " | + | "values": [ |
− | + | {"start": 2013,"end": 2014,"text": "Wiki Loves Public Art"}, | |
− | + | {"start": 2016,"end": 2019,"text": "Public art project"} | |
− | + | ] | |
− | + | } | |
− | + | ], | |
− | + | "scales": [ | |
− | + | { | |
− | + | "name": "x", | |
− | + | "type": "linear", | |
− | + | "range": "width", | |
+ | "zero": false, | ||
+ | "domain": {"data": "table","field": "year"} | ||
}, | }, | ||
{ | { | ||
− | " | + | "name": "y", |
− | " | + | "type": "linear", |
− | " | + | "range": "height", |
− | + | "nice": true, | |
− | + | "domain": {"data": "table","field": "population"} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
}, | }, | ||
{ | { | ||
− | "type": " | + | "name": "color", |
− | " | + | "type": "ordinal", |
− | " | + | "domain": {"data": "annotation","field": "text"}, |
− | + | "range": ["black","red"] | |
− | + | } | |
− | + | ], | |
− | + | "axes": [ | |
− | + | { | |
− | + | "type": "x", | |
− | + | "scale": "x", | |
− | + | "format": "d", | |
+ | "title": "Year", | ||
+ | "ticks": 15 | ||
+ | }, | ||
+ | { | ||
+ | "type": "y", | ||
+ | "scale": "y", | ||
+ | "title": "Population", | ||
+ | "grid": true, | ||
+ | "layer": "back" | ||
}, | }, | ||
{ | { | ||
− | "type": " | + | "type": "y", |
− | " | + | "scale": "y", |
− | + | "title": "Photos", | |
− | + | "grid": false, | |
− | + | "layer": "back" | |
− | + | } | |
− | + | ], | |
− | + | "marks": [ | |
− | + | { | |
− | + | "type": "rect", | |
+ | "from": {"data": "annotation"}, | ||
"properties": { | "properties": { | ||
"enter": { | "enter": { | ||
− | "x": {" | + | "x": {"scale": "x","field": "start"}, |
− | "y": {"value": | + | "y": {"value": 0}, |
− | " | + | "x2": {"scale": "x","field": "end"}, |
− | + | "y2": {"signal": "height"}, | |
− | + | "fill": {"scale": "color","field": "text"}, | |
− | " | + | "opacity": {"value": 0.2} |
− | " | ||
− | |||
− | " | ||
} | } | ||
} | } | ||
− | } | + | }, |
− | |||
− | |||
{ | { | ||
− | " | + | "type": "line", |
− | " | + | "from": {"data": "table"}, |
"properties": { | "properties": { | ||
− | " | + | "enter": { |
− | " | + | "interpolate": {"value": "monotone"}, |
− | " | + | "x": {"scale": "x","field": "year"}, |
− | " | + | "y": {"scale": "y","field": "population"}, |
− | + | "stroke": {"value": "steelblue"}, | |
− | + | "strokeWidth": {"value": 3}, | |
− | " | + | "interpolate": {"value": "step-after"} |
− | " | ||
− | |||
} | } | ||
} | } | ||
− | } | + | }, |
− | + | { | |
− | + | "type": "symbol", | |
− | + | "from": {"data": "table"}, | |
− | + | "properties": { | |
− | + | "enter": { | |
− | + | "x": {"scale": "x","field": "year"}, | |
− | + | "y": {"scale": "y","field": "population"}, | |
− | + | "stroke": {"value": "steelblue"}, | |
− | + | "fill": {"value": "white"}, | |
− | + | "size": {"value": 30} | |
− | " | + | } |
− | + | } | |
− | + | }, | |
− | + | { | |
− | + | "type": "text", | |
− | + | "from": { | |
− | + | "data": "table", | |
− | + | "transform": [ | |
− | + | { | |
− | + | "type": "aggregate", | |
− | + | "summarize": {"year": ["min","max"]} | |
− | + | } | |
− | + | ] | |
− | + | }, | |
− | + | "properties": { | |
− | + | "enter": { | |
− | + | "x": {"signal": "width","mult": 0.5}, | |
− | + | "y": {"value": -10}, | |
− | + | "text": { | |
− | + | "template": "Population of Falkensee from \u007b{datum.min_year}\u007d to \u007b{datum.max_year}\u007d" | |
− | + | }, | |
− | + | "fill": {"value": "black"}, | |
− | + | "fontSize": {"value": 16}, | |
− | + | "align": {"value": "center"}, | |
− | + | "fontWeight": {"value": "bold"} | |
− | + | } | |
− | + | } | |
− | + | } | |
− | + | ], | |
− | + | "legends": [ | |
− | + | { | |
− | + | "fill": "color", | |
− | + | "title": "Period", | |
− | + | "properties": { | |
− | + | "symbols": { | |
− | + | "strokeWidth": {"value": 0}, | |
− | + | "shape": {"value": "square"}, | |
− | + | "opacity": {"value": 0.3} | |
− | + | }, | |
− | + | "legend": { | |
− | + | "x": {"value": 10}, | |
− | + | "y": {"value": 5}, | |
− | + | "fill": {"value": "white"} | |
− | + | } | |
− | + | } | |
− | + | } | |
− | + | ] | |
− | + | } | |
− | " | + | </graph> |
− | + | ||
− | + | ||
− | + | <!-- | |
− | " | + | {{Graph:Chart|width=380|height=200|xAxisTitle=Quarter|yAxisTitle=Developers|type=rect|x=Q3-2017 (5.1%),Q4-2017 (5.5%),Q1-2018 (12.7%),Q2-2018 (7.0%)|y1=39,55,63,43|y2=2,3,8,3|y1Title=Total number, attracted four quarters earlier|y2Title=Still active in this very quarter|colors=seagreen, steelblue|showValues=offset:3,fontcolor:#999,name1:value1, name2:value2|xAxisAngle=-90|xGrid=false}} |
+ | --> | ||
+ | <!-- | ||
+ | <graph>{ | ||
+ | "width": 500, | ||
+ | "height": 200, | ||
+ | "padding": {"top": 10, "left": 30, "bottom": 30, "right": 10}, | ||
+ | "data": [ | ||
{ | { | ||
− | " | + | "name": "table", |
− | " | + | "values": [ |
− | " | + | {"x": 0, "y": 28, "c":0}, {"x": 0, "y": 55, "c":1}, |
− | + | {"x": 1, "y": 43, "c":0}, {"x": 1, "y": 91, "c":1}, | |
− | + | {"x": 2, "y": 81, "c":0}, {"x": 2, "y": 53, "c":1}, | |
− | + | {"x": 3, "y": 19, "c":0}, {"x": 3, "y": 87, "c":1}, | |
− | + | {"x": 4, "y": 52, "c":0}, {"x": 4, "y": 48, "c":1}, | |
− | + | {"x": 5, "y": 24, "c":0}, {"x": 5, "y": 49, "c":1}, | |
− | + | {"x": 6, "y": 87, "c":0}, {"x": 6, "y": 66, "c":1}, | |
− | { | + | {"x": 7, "y": 17, "c":0}, {"x": 7, "y": 27, "c":1}, |
− | + | {"x": 8, "y": 68, "c":0}, {"x": 8, "y": 16, "c":1}, | |
− | + | {"x": 9, "y": 49, "c":0}, {"x": 9, "y": 15, "c":1} | |
− | + | ] | |
− | + | }, | |
− | + | { | |
− | + | "name": "stats", | |
− | + | "source": "table", | |
− | + | "transform": [ | |
− | + | {"type": "facet", "keys": ["data.x"]}, | |
− | + | {"type": "stats", "value": "data.y"} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | } | ||
] | ] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | }, | + | ], |
− | "autosize": "none", | + | "scales": [ |
− | + | { | |
− | "padding": { | + | "name": "x", |
− | "top": 10, | + | "type": "ordinal", |
− | "left": 30, | + | "range": "width", |
− | "bottom": 30, | + | "domain": {"data": "table", "field": "data.x"} |
− | "right": 0 | + | }, |
− | }, | + | { |
− | "data": [ | + | "name": "y", |
− | { | + | "type": "linear", |
− | "name": "table", | + | "range": "height", |
− | "values": [ | + | "nice": true, |
− | { | + | "domain": {"data": "stats", "field": "sum"} |
− | "x": 1, | + | }, |
− | "y": 100 | + | { |
− | }, | + | "name": "color", |
− | { | + | "type": "ordinal", |
− | "x": 2, | + | "range": "category10" |
− | "y": 55 | + | } |
− | }, | + | ], |
− | { | + | "axes": [ |
− | "x": 3, | + | {"type": "x", "scale": "x"}, |
− | "y": 43 | + | {"type": "y", "scale": "y"} |
− | }, | + | ], |
− | { | + | "marks": [ |
− | "x": 4, | + | { |
− | "y": 91 | + | "type": "group", |
− | }, | + | "from": { |
− | { | + | "data": "table", |
− | "x": 5, | + | "transform": [ |
− | "y": 81 | + | {"type": "facet", "keys": ["data.c"]}, |
− | }, | + | {"type": "stack", "point": "data.x", "height": "data.y"} |
− | { | + | ] |
− | "x": 6, | + | }, |
− | "y": 53 | + | "marks": [ |
− | }, | + | { |
− | { | + | "type": "rect", |
− | "x": 7, | + | "properties": { |
− | "y": 19 | + | "enter": { |
− | }, | + | "x": {"scale": "x", "field": "data.x"}, |
+ | "width": {"scale": "x", "band": true, "offset": -1}, | ||
+ | "y": {"scale": "y", "field": "y"}, | ||
+ | "y2": {"scale": "y", "field": "y2"}, | ||
+ | "fill": {"scale": "color", "field": "data.c"} | ||
+ | }, | ||
+ | "update": { | ||
+ | "fillOpacity": {"value": 1} | ||
+ | }, | ||
+ | "hover": { | ||
+ | "fillOpacity": {"value": 0.5} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | --> | ||
+ | |||
+ | ===2=== | ||
+ | |||
+ | <graph>{"version":2,"width":741,"height":269,"data":[{"name":"table","values":[{"x":0,"y":1},{"x":1,"y":3},{"x":2,"y":2},{"x":3,"y":4},{"x":4,"y":5}]}],"scales":[{"name":"x","type":"linear","range":"width","zero":false,"domain":{"data":"table","field":"x"}},{"name":"y","type":"linear","range":"height","nice":true,"domain":{"data":"table","field":"y"}}],"axes":[{"type":"x","scale":"x"},{"type":"y","scale":"y"}],"marks":[{"type":"line","from":{"data":"table"},"properties":{"enter":{"x":{"scale":"x","field":"x"},"y":{"scale":"y","field":"y"},"y2":{"scale":"y","value":0},"interpolate":{"value":"monotone"},"stroke":{"value":"steelblue"},"strokeWidth":{"value":3}}}}]}</graph> | ||
+ | |||
+ | ===3=== | ||
+ | |||
+ | <graph>{ | ||
+ | "version": 2, | ||
+ | "description": "A specification outline example.", | ||
+ | "height": 200, | ||
+ | "width": 915, | ||
+ | "config": { | ||
+ | "axis": { | ||
+ | "grid": true, | ||
+ | "gridColor": "#dedede" | ||
+ | } | ||
+ | }, | ||
+ | "autosize": "none", | ||
+ | |||
+ | "padding": { | ||
+ | "top": 10, | ||
+ | "left": 30, | ||
+ | "bottom": 30, | ||
+ | "right": 0 | ||
+ | }, | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y": 100 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y": 55 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y": 43 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y": 91 | ||
+ | }, | ||
+ | { | ||
+ | "x": 5, | ||
+ | "y": 81 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y": 53 | ||
+ | }, | ||
+ | { | ||
+ | "x": 7, | ||
+ | "y": 19 | ||
+ | }, | ||
{ | { | ||
"x": 8, | "x": 8, | ||
Linia 782: | Linia 1.100: | ||
} | } | ||
] | ] | ||
− | }</graph><graph>{ | + | }</graph> |
+ | |||
+ | ===4=== | ||
+ | |||
+ | <graph>{ | ||
"version": 2, | "version": 2, | ||
"width": 400, | "width": 400, | ||
Linia 916: | Linia 1.238: | ||
<tr><td width="33%">18293 <span class="lgrey">/ 2018</span></td><td width="34%" class="green1" align="center">'''18793''' / 2018</td><td width="33%" align="right">147<span class="lgrey"> / 2019</span></td> | <tr><td width="33%">18293 <span class="lgrey">/ 2018</span></td><td width="34%" class="green1" align="center">'''18793''' / 2018</td><td width="33%" align="right">147<span class="lgrey"> / 2019</span></td> | ||
</table> | </table> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===5=== | ||
+ | |||
+ | <graph>{ | ||
+ | "version": 2, | ||
+ | "name": "Vega Visualization", | ||
+ | "height": 20, | ||
+ | "padding": "auto", | ||
+ | "marks": [ | ||
+ | { | ||
+ | "name": "cell", | ||
+ | "marks": [ | ||
+ | { | ||
+ | "properties": { | ||
+ | "update": { | ||
+ | "height": { | ||
+ | "value": 14 | ||
+ | }, | ||
+ | "x": { | ||
+ | "field": "x", | ||
+ | "scale": "x" | ||
+ | }, | ||
+ | "width": { | ||
+ | "value": 1 | ||
+ | }, | ||
+ | "fill": { | ||
+ | "value": "#4682b4" | ||
+ | }, | ||
+ | "opacity": { | ||
+ | "value": 0.7 | ||
+ | }, | ||
+ | "y": { | ||
+ | "value": 0 | ||
+ | } | ||
+ | }, | ||
+ | "enter": { | ||
+ | "height": { | ||
+ | "value": 14 | ||
+ | }, | ||
+ | "x": { | ||
+ | "field": "x", | ||
+ | "scale": "x" | ||
+ | }, | ||
+ | "width": { | ||
+ | "value": 1 | ||
+ | }, | ||
+ | "fill": { | ||
+ | "value": "#4682b4" | ||
+ | }, | ||
+ | "opacity": { | ||
+ | "value": 0.7 | ||
+ | }, | ||
+ | "y": { | ||
+ | "value": 0 | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "from": { | ||
+ | "data": "table" | ||
+ | }, | ||
+ | "type": "rect" | ||
+ | } | ||
+ | ], | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "height": { | ||
+ | "value": 20 | ||
+ | }, | ||
+ | "width": { | ||
+ | "value": 400 | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "axes": [ | ||
+ | { | ||
+ | "titleOffset": 38, | ||
+ | "format": "", | ||
+ | "layer": "back", | ||
+ | "properties": { | ||
+ | "stroke": { | ||
+ | "value": "#000000" | ||
+ | }, | ||
+ | "opacity": { | ||
+ | "value": 0.08 | ||
+ | } | ||
+ | }, | ||
+ | "title": "", | ||
+ | "grid": true, | ||
+ | "type": "x", | ||
+ | "scale": "x", | ||
+ | "ticks": 5 | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "reverse": false, | ||
+ | "name": "x", | ||
+ | "nice": true, | ||
+ | "zero": true, | ||
+ | "range": [ | ||
+ | 0, | ||
+ | 400 | ||
+ | ], | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": "x" | ||
+ | }, | ||
+ | "type": "linear", | ||
+ | "round": true | ||
+ | } | ||
+ | ], | ||
+ | "type": "group" | ||
+ | } | ||
+ | ], | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | { | ||
+ | "x": 160, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 160, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 108, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 258, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 360, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 225, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 360, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 146.7, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 140.8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 167.6, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 167.6, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 275.8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 275.8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 275.8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 472, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 460, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 440, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 78.7, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 75.7, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 71.1, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 120.1, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 318, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 304, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 350, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 400, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 79, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 120.3, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 95.1, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 351, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 145, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 301, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 121, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "width": 400 | ||
+ | } | ||
+ | </graph> | ||
+ | |||
+ | ===6=== | ||
+ | |||
+ | <graph>{ | ||
+ | "version": 2, | ||
+ | "width": 500, | ||
+ | "height": 200, | ||
+ | "padding": "auto", | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | {"x": 0, "y": 28, "c":0}, {"x": 0, "y": 55, "c":1}, | ||
+ | {"x": 1, "y": 43, "c":0}, {"x": 1, "y": 91, "c":1}, | ||
+ | {"x": 2, "y": 81, "c":0}, {"x": 2, "y": 53, "c":1}, | ||
+ | {"x": 3, "y": 19, "c":0}, {"x": 3, "y": 87, "c":1}, | ||
+ | {"x": 4, "y": 52, "c":0}, {"x": 4, "y": 48, "c":1}, | ||
+ | {"x": 5, "y": 24, "c":0}, {"x": 5, "y": 49, "c":1}, | ||
+ | {"x": 6, "y": 87, "c":0}, {"x": 6, "y": 66, "c":1}, | ||
+ | {"x": 7, "y": 17, "c":0}, {"x": 7, "y": 27, "c":1}, | ||
+ | {"x": 8, "y": 68, "c":0}, {"x": 8, "y": 16, "c":1}, | ||
+ | {"x": 9, "y": 49, "c":0}, {"x": 9, "y": 15, "c":1} | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "stats", | ||
+ | "source": "table", | ||
+ | "transform": [ | ||
+ | { | ||
+ | "type": "aggregate", | ||
+ | "groupby": ["x"], | ||
+ | "summarize": [{"field": "y", "ops": ["sum"]}] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "x", | ||
+ | "type": "ordinal", | ||
+ | "range": "width", | ||
+ | "points": true, | ||
+ | "domain": {"data": "table", "field": "x"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "y", | ||
+ | "type": "linear", | ||
+ | "range": "height", | ||
+ | "nice": true, | ||
+ | "domain": [0,1] | ||
+ | }, | ||
+ | { | ||
+ | "name": "color", | ||
+ | "type": "ordinal", | ||
+ | "range": "category20", | ||
+ | "domain": {"data": "table", "field": "c"} | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | {"type": "x", "scale": "x"}, | ||
+ | {"type": "y", "scale": "y", "format": "%"} | ||
+ | ], | ||
+ | |||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "group", | ||
+ | "from": { | ||
+ | "data": "table", | ||
+ | "transform": [ | ||
+ | {"type": "lookup", "on": "stats", "onKey": "x", "keys": "x", "as": "sum_y"}, | ||
+ | {"type": "formula", "field": "pcttot", "expr": "datum.y/datum.sum_y.sum_y"}, | ||
+ | {"type": "stack", "groupby": ["x"], "sortby": ["c"], "field": "pcttot"}, | ||
+ | {"type": "facet", "groupby": ["c"]} | ||
+ | ] | ||
+ | }, | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "area", | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "interpolate": {"value": "monotone"}, | ||
+ | "x": {"scale": "x", "field": "x"}, | ||
+ | "y": {"scale": "y", "field": "layout_start"}, | ||
+ | "y2": {"scale": "y", "field": "layout_end"}, | ||
+ | "fill": {"scale": "color", "field": "c"} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </graph> | ||
+ | |||
+ | ===7=== | ||
+ | |||
+ | <graph>{ | ||
+ | "version": 2, | ||
+ | "width": 600, | ||
+ | "height": 300, | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "obesity", | ||
+ | "values": [ | ||
+ | { | ||
+ | "x": 95, | ||
+ | "y": 95, | ||
+ | "z": 13.8, | ||
+ | "name": "BE", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 86.5, | ||
+ | "y": 102.9, | ||
+ | "z": 14.7, | ||
+ | "name": "DE", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 80.8, | ||
+ | "y": 91.5, | ||
+ | "z": 15.8, | ||
+ | "name": "FI", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 80.4, | ||
+ | "y": 102.5, | ||
+ | "z": 12, | ||
+ | "name": "NL", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 80.3, | ||
+ | "y": 86.1, | ||
+ | "z": 11.8, | ||
+ | "name": "SE", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 78.4, | ||
+ | "y": 70.1, | ||
+ | "z": 16.6, | ||
+ | "name": "ES", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 74.2, | ||
+ | "y": 68.5, | ||
+ | "z": 14.5, | ||
+ | "name": "FR", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 73.5, | ||
+ | "y": 83.1, | ||
+ | "z": 10, | ||
+ | "name": "NO", | ||
+ | "cont": "NO" | ||
+ | }, | ||
+ | { | ||
+ | "x": 71, | ||
+ | "y": 93.2, | ||
+ | "z": 24.7, | ||
+ | "name": "UK", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 69.2, | ||
+ | "y": 57.6, | ||
+ | "z": 10.4, | ||
+ | "name": "IT", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 68.6, | ||
+ | "y": 20, | ||
+ | "z": 16, | ||
+ | "name": "RU", | ||
+ | "cont": "RU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 65.5, | ||
+ | "y": 126.4, | ||
+ | "z": 35.3, | ||
+ | "name": "US", | ||
+ | "cont": "US" | ||
+ | }, | ||
+ | { | ||
+ | "x": 65.4, | ||
+ | "y": 50.8, | ||
+ | "z": 28.5, | ||
+ | "name": "HU", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 63.4, | ||
+ | "y": 51.8, | ||
+ | "z": 15.4, | ||
+ | "name": "PT", | ||
+ | "cont": "EU" | ||
+ | }, | ||
+ | { | ||
+ | "x": 64, | ||
+ | "y": 82.9, | ||
+ | "z": 31.3, | ||
+ | "name": "NZ", | ||
+ | "cont": "NZ" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "x", | ||
+ | "nice": true, | ||
+ | "range": "width", | ||
+ | "zero": false, | ||
+ | "domain": [ | ||
+ | 60, | ||
+ | 100 | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "y", | ||
+ | "zero": false, | ||
+ | "range": "height", | ||
+ | "domain": [ | ||
+ | 10, | ||
+ | 150 | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "cont", | ||
+ | "type": "ordinal", | ||
+ | "domain": { | ||
+ | "data": "obesity", | ||
+ | "field": "cont" | ||
+ | }, | ||
+ | "range": "category20" | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | { | ||
+ | "type": "x", | ||
+ | "scale": "x", | ||
+ | "offset": 5, | ||
+ | "title": "Daily Fat Intake", | ||
+ | "grid": true | ||
+ | }, | ||
+ | { | ||
+ | "type": "y", | ||
+ | "scale": "y", | ||
+ | "offset": 5, | ||
+ | "ticks": 6, | ||
+ | "title": "Daily Sugar Intake", | ||
+ | "grid": true | ||
+ | } | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "rule", | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": { | ||
+ | "field": { | ||
+ | "group": "x" | ||
+ | } | ||
+ | }, | ||
+ | "x2": { | ||
+ | "field": { | ||
+ | "group": "width" | ||
+ | } | ||
+ | }, | ||
+ | "y": { | ||
+ | "scale": "y", | ||
+ | "value": 50 | ||
+ | }, | ||
+ | "stroke": { | ||
+ | "value": "black" | ||
+ | }, | ||
+ | "strokeWidth": { | ||
+ | "value": 1 | ||
+ | }, | ||
+ | "strokeDash": { | ||
+ | "value": [ | ||
+ | 5 | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "rule", | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "y": { | ||
+ | "field": { | ||
+ | "group": "y" | ||
+ | } | ||
+ | }, | ||
+ | "y2": { | ||
+ | "field": { | ||
+ | "group": "height" | ||
+ | } | ||
+ | }, | ||
+ | "x": { | ||
+ | "scale": "x", | ||
+ | "value": 65 | ||
+ | }, | ||
+ | "stroke": { | ||
+ | "value": "black" | ||
+ | }, | ||
+ | "strokeWidth": { | ||
+ | "value": 1 | ||
+ | }, | ||
+ | "strokeDash": { | ||
+ | "value": [ | ||
+ | 5 | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "name": "circles", | ||
+ | "type": "symbol", | ||
+ | "from": { | ||
+ | "data": "obesity" | ||
+ | }, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": { | ||
+ | "scale": "x", | ||
+ | "field": "x" | ||
+ | }, | ||
+ | "y": { | ||
+ | "scale": "y", | ||
+ | "field": "y" | ||
+ | }, | ||
+ | "fill": { | ||
+ | "scale": "cont", | ||
+ | "field": "cont" | ||
+ | }, | ||
+ | "fillOpacity": { | ||
+ | "value": 0.8 | ||
+ | }, | ||
+ | "size": { | ||
+ | "field": "z", | ||
+ | "mult": 50 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "text", | ||
+ | "from": { | ||
+ | "mark": "circles" | ||
+ | }, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": { | ||
+ | "field": "x" | ||
+ | }, | ||
+ | "y": { | ||
+ | "field": "y" | ||
+ | }, | ||
+ | "dy": { | ||
+ | "field": "height" | ||
+ | }, | ||
+ | "fill": { | ||
+ | "value": "white" | ||
+ | }, | ||
+ | "align": { | ||
+ | "value": "center" | ||
+ | }, | ||
+ | "baseline": { | ||
+ | "value": "middle" | ||
+ | }, | ||
+ | "text": { | ||
+ | "field": "datum.name" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "align": { | ||
+ | "value": "center" | ||
+ | }, | ||
+ | "fontWeight": { | ||
+ | "value": "bold" | ||
+ | }, | ||
+ | "x": { | ||
+ | "value": 300 | ||
+ | }, | ||
+ | "font": { | ||
+ | "value": "" | ||
+ | }, | ||
+ | "fontSize": { | ||
+ | "value": 16 | ||
+ | }, | ||
+ | "fill": { | ||
+ | "value": "black" | ||
+ | }, | ||
+ | "baseline": { | ||
+ | "value": "top" | ||
+ | }, | ||
+ | "text": { | ||
+ | "value": "Sugar and Fat Intake Per Country" | ||
+ | }, | ||
+ | "y": { | ||
+ | "value": -40 | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "type": "text" | ||
+ | }, | ||
+ | { | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "align": { | ||
+ | "value": "center" | ||
+ | }, | ||
+ | "fontWeight": { | ||
+ | "value": "bold" | ||
+ | }, | ||
+ | "x": { | ||
+ | "value": 300 | ||
+ | }, | ||
+ | "font": { | ||
+ | "value": "" | ||
+ | }, | ||
+ | "fontSize": { | ||
+ | "value": 10 | ||
+ | }, | ||
+ | "fill": { | ||
+ | "value": "black" | ||
+ | }, | ||
+ | "baseline": { | ||
+ | "value": "top" | ||
+ | }, | ||
+ | "text": { | ||
+ | "value": "Source: Euromonitor and OECD" | ||
+ | }, | ||
+ | "y": { | ||
+ | "value": -20 | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "type": "text" | ||
+ | }, | ||
+ | { | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "align": { | ||
+ | "value": "center" | ||
+ | }, | ||
+ | "fontWeight": { | ||
+ | "value": "bold" | ||
+ | }, | ||
+ | "x": { | ||
+ | "value": 525 | ||
+ | }, | ||
+ | "font": { | ||
+ | "value": "" | ||
+ | }, | ||
+ | "fontSize": { | ||
+ | "value": 10 | ||
+ | }, | ||
+ | "fill": { | ||
+ | "value": "black" | ||
+ | }, | ||
+ | "baseline": { | ||
+ | "value": "top" | ||
+ | }, | ||
+ | "text": { | ||
+ | "value": "Safe Sugar Intake 50g/day" | ||
+ | }, | ||
+ | "y": { | ||
+ | "value": 200 | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "type": "text" | ||
+ | }, | ||
+ | { | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "align": { | ||
+ | "value": "center" | ||
+ | }, | ||
+ | "fontWeight": { | ||
+ | "value": "bold" | ||
+ | }, | ||
+ | "x": { | ||
+ | "value": 135 | ||
+ | }, | ||
+ | "font": { | ||
+ | "value": "" | ||
+ | }, | ||
+ | "fontSize": { | ||
+ | "value": 10 | ||
+ | }, | ||
+ | "fill": { | ||
+ | "value": "black" | ||
+ | }, | ||
+ | "baseline": { | ||
+ | "value": "top" | ||
+ | }, | ||
+ | "text": { | ||
+ | "value": "Safe Fat Intake 65g/day" | ||
+ | }, | ||
+ | "y": { | ||
+ | "value": 0 | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "type": "text" | ||
+ | } | ||
+ | ], | ||
+ | "legends": [ | ||
+ | { | ||
+ | "fill": "cont", | ||
+ | "title": "Political Entity" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </graph> | ||
+ | |||
+ | ===8=== | ||
+ | |||
+ | <graph>{ | ||
+ | "version": 2, | ||
+ | "name": "Vega Visualization", | ||
+ | "height": 450, | ||
+ | "padding": "auto", | ||
+ | "marks": [ | ||
+ | { | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": { | ||
+ | "offset": 31, | ||
+ | "field": "x", | ||
+ | "scale": "x" | ||
+ | }, | ||
+ | "y2": { | ||
+ | "field": "y2", | ||
+ | "scale": "y" | ||
+ | }, | ||
+ | "width": { | ||
+ | "mult": 0.5, | ||
+ | "scale": "x", | ||
+ | "band": true | ||
+ | }, | ||
+ | "fill": { | ||
+ | "field": "group", | ||
+ | "scale": "group" | ||
+ | }, | ||
+ | "y": { | ||
+ | "field": "y", | ||
+ | "scale": "y" | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "from": { | ||
+ | "data": "table" | ||
+ | }, | ||
+ | "type": "rect" | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | { | ||
+ | "format": "", | ||
+ | "layer": "front", | ||
+ | "properties": { | ||
+ | "title": { | ||
+ | "fontSize": { | ||
+ | "value": 14 | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "title": "", | ||
+ | "grid": false, | ||
+ | "type": "x", | ||
+ | "scale": "x", | ||
+ | "ticks": 0 | ||
+ | }, | ||
+ | { | ||
+ | "titleOffset": 40, | ||
+ | "format": "", | ||
+ | "layer": "front", | ||
+ | "properties": { | ||
+ | "title": { | ||
+ | "fontSize": { | ||
+ | "value": 14 | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "title": "", | ||
+ | "grid": false, | ||
+ | "type": "y", | ||
+ | "scale": "y", | ||
+ | "ticks": 0 | ||
+ | } | ||
+ | ], | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | { | ||
+ | "x": "Product Revenue", | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 420000 | ||
+ | }, | ||
+ | { | ||
+ | "x": "Services Revenue", | ||
+ | "y2": 420000, | ||
+ | "group": 0, | ||
+ | "y": 630000 | ||
+ | }, | ||
+ | { | ||
+ | "x": "Fixed Costs", | ||
+ | "y2": 630000, | ||
+ | "group": 1, | ||
+ | "y": 460000 | ||
+ | }, | ||
+ | { | ||
+ | "x": "Variable Costs", | ||
+ | "y2": 460000, | ||
+ | "group": 1, | ||
+ | "y": 320000 | ||
+ | }, | ||
+ | { | ||
+ | "x": "One-Time Costs", | ||
+ | "y2": 320000, | ||
+ | "group": 1, | ||
+ | "y": 245000 | ||
+ | }, | ||
+ | { | ||
+ | "x": "Total", | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 245000 | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "x", | ||
+ | "range": "width", | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": "x" | ||
+ | }, | ||
+ | "type": "ordinal" | ||
+ | }, | ||
+ | { | ||
+ | "name": "y", | ||
+ | "range": "height", | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": "y" | ||
+ | }, | ||
+ | "type": "linear" | ||
+ | }, | ||
+ | { | ||
+ | "name": "group", | ||
+ | "range": [ | ||
+ | "#4daf4a", | ||
+ | "#e41a1c", | ||
+ | "#377eb8" | ||
+ | ], | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": "group" | ||
+ | }, | ||
+ | "type": "ordinal" | ||
+ | } | ||
+ | ], | ||
+ | "width": 660, | ||
+ | "legends": [] | ||
+ | } | ||
+ | </graph> | ||
+ | |||
+ | ===9=== | ||
+ | |||
+ | <graph>{ | ||
+ | "version": 2, | ||
+ | "name":"Vega Visualization","height":300,"padding":"auto","marks":[{"properties":{"enter":{"shape":{"value":"circle"},"x":{"field":"x","scale":"x"},"size":{"mult":30,"field":"y2"},"fill":{"field":"group","scale":"group"},"y":{"field":"y","scale":"y"}}},"from":{"data":"table_dcsw3"},"type":"symbol"}],"axes":[{"layer":"front","offset":20,"properties":{"axis":{"strokeWidth":{"value":0}},"title":{"fontSize":{"value":14}}},"title":"","grid":false,"type":"x","scale":"x","tickSize":0},{"layer":"front","offset":20,"properties":{"axis":{"strokeWidth":{"value":0}},"title":{"fontSize":{"value":14}}},"title":"","grid":false,"type":"y","scale":"y","tickSize":0}],"data":[{"name":"table_dcsw3","values":[{"x":0,"y2":0,"group":1,"y":"Sunday"},{"x":1,"y2":0,"group":1,"y":"Sunday"},{"x":2,"y2":0,"group":1,"y":"Sunday"},{"x":3,"y2":0,"group":1,"y":"Sunday"},{"x":4,"y2":0,"group":1,"y":"Sunday"},{"x":5,"y2":17,"group":1,"y":"Sunday"},{"x":6,"y2":2,"group":1,"y":"Sunday"},{"x":7,"y2":16,"group":1,"y":"Sunday"},{"x":8,"y2":7,"group":1,"y":"Sunday"},{"x":9,"y2":11,"group":1,"y":"Sunday"},{"x":10,"y2":0,"group":1,"y":"Sunday"},{"x":11,"y2":4,"group":1,"y":"Sunday"},{"x":12,"y2":1,"group":1,"y":"Sunday"},{"x":13,"y2":10,"group":1,"y":"Sunday"},{"x":14,"y2":9,"group":1,"y":"Sunday"},{"x":15,"y2":5,"group":1,"y":"Sunday"},{"x":16,"y2":2,"group":1,"y":"Sunday"},{"x":17,"y2":19,"group":1,"y":"Sunday"},{"x":18,"y2":10,"group":1,"y":"Sunday"},{"x":19,"y2":13,"group":1,"y":"Sunday"},{"x":20,"y2":12,"group":1,"y":"Sunday"},{"x":21,"y2":15,"group":1,"y":"Sunday"},{"x":22,"y2":12,"group":1,"y":"Sunday"},{"x":23,"y2":3,"group":1,"y":"Sunday"},{"x":0,"y2":1,"group":1,"y":"Monday"},{"x":1,"y2":0,"group":1,"y":"Monday"},{"x":2,"y2":0,"group":1,"y":"Monday"},{"x":3,"y2":0,"group":1,"y":"Monday"},{"x":4,"y2":0,"group":1,"y":"Monday"},{"x":5,"y2":0,"group":1,"y":"Monday"},{"x":6,"y2":1,"group":1,"y":"Monday"},{"x":7,"y2":8,"group":1,"y":"Monday"},{"x":8,"y2":11,"group":1,"y":"Monday"},{"x":9,"y2":19,"group":1,"y":"Monday"},{"x":10,"y2":20,"group":1,"y":"Monday"},{"x":11,"y2":10,"group":1,"y":"Monday"},{"x":12,"y2":10,"group":1,"y":"Monday"},{"x":13,"y2":3,"group":1,"y":"Monday"},{"x":14,"y2":5,"group":1,"y":"Monday"},{"x":15,"y2":8,"group":1,"y":"Monday"},{"x":16,"y2":12,"group":1,"y":"Monday"},{"x":17,"y2":3,"group":1,"y":"Monday"},{"x":18,"y2":13,"group":1,"y":"Monday"},{"x":19,"y2":9,"group":1,"y":"Monday"},{"x":20,"y2":19,"group":1,"y":"Monday"},{"x":21,"y2":10,"group":1,"y":"Monday"},{"x":22,"y2":12,"group":1,"y":"Monday"},{"x":23,"y2":12,"group":1,"y":"Monday"},{"x":0,"y2":17,"group":1,"y":"Tuesday"},{"x":1,"y2":8,"group":1,"y":"Tuesday"},{"x":2,"y2":19,"group":1,"y":"Tuesday"},{"x":3,"y2":20,"group":1,"y":"Tuesday"},{"x":4,"y2":12,"group":1,"y":"Tuesday"},{"x":5,"y2":0,"group":1,"y":"Tuesday"},{"x":6,"y2":0,"group":1,"y":"Tuesday"},{"x":7,"y2":11,"group":1,"y":"Tuesday"},{"x":8,"y2":0,"group":1,"y":"Tuesday"},{"x":9,"y2":9,"group":1,"y":"Tuesday"},{"x":10,"y2":20,"group":1,"y":"Tuesday"},{"x":11,"y2":20,"group":1,"y":"Tuesday"},{"x":12,"y2":9,"group":1,"y":"Tuesday"},{"x":13,"y2":19,"group":1,"y":"Tuesday"},{"x":14,"y2":12,"group":1,"y":"Tuesday"},{"x":15,"y2":17,"group":1,"y":"Tuesday"},{"x":16,"y2":20,"group":1,"y":"Tuesday"},{"x":17,"y2":17,"group":1,"y":"Tuesday"},{"x":18,"y2":1,"group":1,"y":"Tuesday"},{"x":19,"y2":17,"group":1,"y":"Tuesday"},{"x":20,"y2":16,"group":1,"y":"Tuesday"},{"x":21,"y2":18,"group":1,"y":"Tuesday"},{"x":22,"y2":16,"group":1,"y":"Tuesday"},{"x":23,"y2":3,"group":1,"y":"Tuesday"},{"x":0,"y2":8,"group":1,"y":"Wednesday"},{"x":1,"y2":19,"group":1,"y":"Wednesday"},{"x":2,"y2":1,"group":1,"y":"Wednesday"},{"x":3,"y2":0,"group":1,"y":"Wednesday"},{"x":4,"y2":4,"group":1,"y":"Wednesday"},{"x":5,"y2":16,"group":1,"y":"Wednesday"},{"x":6,"y2":15,"group":1,"y":"Wednesday"},{"x":7,"y2":8,"group":1,"y":"Wednesday"},{"x":8,"y2":4,"group":1,"y":"Wednesday"},{"x":9,"y2":3,"group":1,"y":"Wednesday"},{"x":10,"y2":1,"group":1,"y":"Wednesday"},{"x":11,"y2":15,"group":1,"y":"Wednesday"},{"x":12,"y2":4,"group":1,"y":"Wednesday"},{"x":13,"y2":13,"group":1,"y":"Wednesday"},{"x":14,"y2":8,"group":1,"y":"Wednesday"},{"x":15,"y2":20,"group":1,"y":"Wednesday"},{"x":16,"y2":9,"group":1,"y":"Wednesday"},{"x":17,"y2":6,"group":1,"y":"Wednesday"},{"x":18,"y2":4,"group":1,"y":"Wednesday"},{"x":19,"y2":4,"group":1,"y":"Wednesday"},{"x":20,"y2":14,"group":1,"y":"Wednesday"},{"x":21,"y2":19,"group":1,"y":"Wednesday"},{"x":22,"y2":0,"group":1,"y":"Wednesday"},{"x":23,"y2":0,"group":1,"y":"Wednesday"},{"x":0,"y2":0,"group":1,"y":"Thursday"},{"x":1,"y2":0,"group":1,"y":"Thursday"},{"x":2,"y2":0,"group":1,"y":"Thursday"},{"x":3,"y2":19,"group":1,"y":"Thursday"},{"x":4,"y2":11,"group":1,"y":"Thursday"},{"x":5,"y2":14,"group":1,"y":"Thursday"},{"x":6,"y2":16,"group":1,"y":"Thursday"},{"x":7,"y2":14,"group":1,"y":"Thursday"},{"x":8,"y2":1,"group":1,"y":"Thursday"},{"x":9,"y2":15,"group":1,"y":"Thursday"},{"x":10,"y2":11,"group":1,"y":"Thursday"},{"x":11,"y2":0,"group":1,"y":"Thursday"},{"x":12,"y2":0,"group":1,"y":"Thursday"},{"x":13,"y2":16,"group":1,"y":"Thursday"},{"x":14,"y2":7,"group":1,"y":"Thursday"},{"x":15,"y2":13,"group":1,"y":"Thursday"},{"x":16,"y2":18,"group":1,"y":"Thursday"},{"x":17,"y2":0,"group":1,"y":"Thursday"},{"x":18,"y2":0,"group":1,"y":"Thursday"},{"x":19,"y2":2,"group":1,"y":"Thursday"},{"x":20,"y2":3,"group":1,"y":"Thursday"},{"x":21,"y2":13,"group":1,"y":"Thursday"},{"x":22,"y2":5,"group":1,"y":"Thursday"},{"x":23,"y2":5,"group":1,"y":"Thursday"},{"x":0,"y2":0,"group":1,"y":"Friday"},{"x":1,"y2":8,"group":1,"y":"Friday"},{"x":2,"y2":5,"group":1,"y":"Friday"},{"x":3,"y2":9,"group":1,"y":"Friday"},{"x":4,"y2":17,"group":1,"y":"Friday"},{"x":5,"y2":14,"group":1,"y":"Friday"},{"x":6,"y2":4,"group":1,"y":"Friday"},{"x":7,"y2":2,"group":1,"y":"Friday"},{"x":8,"y2":3,"group":1,"y":"Friday"},{"x":9,"y2":8,"group":1,"y":"Friday"},{"x":10,"y2":6,"group":1,"y":"Friday"},{"x":11,"y2":0,"group":1,"y":"Friday"},{"x":12,"y2":0,"group":1,"y":"Friday"},{"x":13,"y2":0,"group":1,"y":"Friday"},{"x":14,"y2":17,"group":1,"y":"Friday"},{"x":15,"y2":8,"group":1,"y":"Friday"},{"x":16,"y2":6,"group":1,"y":"Friday"},{"x":17,"y2":10,"group":1,"y":"Friday"},{"x":18,"y2":9,"group":1,"y":"Friday"},{"x":19,"y2":6,"group":1,"y":"Friday"},{"x":20,"y2":4,"group":1,"y":"Friday"},{"x":21,"y2":17,"group":1,"y":"Friday"},{"x":22,"y2":1,"group":1,"y":"Friday"},{"x":23,"y2":18,"group":1,"y":"Friday"},{"x":0,"y2":2,"group":1,"y":"Saturday"},{"x":1,"y2":17,"group":1,"y":"Saturday"},{"x":2,"y2":15,"group":1,"y":"Saturday"},{"x":3,"y2":1,"group":1,"y":"Saturday"},{"x":4,"y2":3,"group":1,"y":"Saturday"},{"x":5,"y2":16,"group":1,"y":"Saturday"},{"x":6,"y2":2,"group":1,"y":"Saturday"},{"x":7,"y2":12,"group":1,"y":"Saturday"},{"x":8,"y2":7,"group":1,"y":"Saturday"},{"x":9,"y2":14,"group":1,"y":"Saturday"},{"x":10,"y2":10,"group":1,"y":"Saturday"},{"x":11,"y2":17,"group":1,"y":"Saturday"},{"x":12,"y2":10,"group":1,"y":"Saturday"},{"x":13,"y2":2,"group":1,"y":"Saturday"},{"x":14,"y2":18,"group":1,"y":"Saturday"},{"x":15,"y2":20,"group":1,"y":"Saturday"},{"x":16,"y2":4,"group":1,"y":"Saturday"},{"x":17,"y2":4,"group":1,"y":"Saturday"},{"x":18,"y2":0,"group":1,"y":"Saturday"},{"x":19,"y2":0,"group":1,"y":"Saturday"},{"x":20,"y2":0,"group":1,"y":"Saturday"},{"x":21,"y2":0,"group":1,"y":"Saturday"},{"x":22,"y2":0,"group":1,"y":"Saturday"},{"x":23,"y2":0,"group":1,"y":"Saturday"}]}],"scales":[{"name":"x","points":true,"range":"width","domain":{"sort":true,"data":"table_dcsw3","field":"x"},"type":"ordinal"},{"name":"y","points":true,"range":"height","domain":{"data":"table_dcsw3","field":"y"},"type":"ordinal"},{"name":"group","range":["black"],"domain":{"data":"table_dcsw3","field":"group"},"type":"ordinal"}],"width":700} | ||
+ | </graph> | ||
+ | |||
+ | ===10=== | ||
+ | |||
+ | <graph>{ | ||
+ | |||
+ | "name": "boxplot", | ||
+ | "height": 200, | ||
+ | "padding": "auto", | ||
+ | "width": 600, | ||
+ | "signals": [ | ||
+ | { | ||
+ | "name": "boxSize", | ||
+ | "init": 40 | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | { | ||
+ | "type": "x", | ||
+ | "scale": "x" | ||
+ | }, | ||
+ | { | ||
+ | "offset": 5, | ||
+ | "properties": { | ||
+ | "axis": { | ||
+ | "stroke": { | ||
+ | "value": "transparent" | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "type": "y", | ||
+ | "scale": "y", | ||
+ | "tickSize": 0 | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "y", | ||
+ | "points": true, | ||
+ | "padding": 1.5, | ||
+ | "range": "height", | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": "x" | ||
+ | }, | ||
+ | "type": "ordinal", | ||
+ | "round": true | ||
+ | }, | ||
+ | { | ||
+ | "name": "x", | ||
+ | "nice": true, | ||
+ | "range": "width", | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": [ | ||
+ | "y" | ||
+ | ] | ||
+ | }, | ||
+ | "type": "linear", | ||
+ | "round": true | ||
+ | } | ||
+ | ], | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 21 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 21 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 22.8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 21.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 18.7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 18.1 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 14.3 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 24.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 22.8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 19.2 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 17.8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 16.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 17.3 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 15.2 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 10.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 10.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 14.7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 32.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 30.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 33.9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 21.5 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 15.5 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 15.2 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 13.3 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 19.2 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 27.3 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 26 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 30.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 15.8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 19.7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 15 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 21.4 | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "stats", | ||
+ | "source": "table", | ||
+ | "transform": [ | ||
+ | { | ||
+ | "type": "aggregate", | ||
+ | "groupby": [ | ||
+ | "x" | ||
+ | ], | ||
+ | "summarize": { | ||
+ | "y": ["min","max", "median", "q1", "q3", "valid"] | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "iqrcalcs", | ||
+ | "source": "stats", | ||
+ | "transform": [{"type": "formula", "field": "lower", "expr": "max(datum.min_y,datum.q1_y-1.5*(datum.q3_y-datum.q1_y))"}, | ||
+ | {"type": "formula", "field": "upper", "expr": "min(datum.max_y,datum.q3_y+1.5*(datum.q3_y-datum.q1_y))"}] | ||
+ | } | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "height": { | ||
+ | "value": 1 | ||
+ | }, | ||
+ | "x2": { | ||
+ | "field": "upper", | ||
+ | "scale": "x" | ||
+ | }, | ||
+ | "x": { | ||
+ | "field": "lower", | ||
+ | "scale": "x" | ||
+ | }, | ||
+ | "yc": { | ||
+ | "field": "x", | ||
+ | "scale": "y" | ||
+ | }, | ||
+ | "fill": { | ||
+ | "value": "#888" | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "from": { | ||
+ | "data": "iqrcalcs" | ||
+ | }, | ||
+ | "type": "rect" | ||
+ | }, | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "from": {"data": "iqrcalcs"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "q1_y"}, | ||
+ | "x2": {"scale": "x", "field": "q3_y"}, | ||
+ | "yc": {"scale": "y", "field": "x"}, | ||
+ | "height": {"signal": "boxSize"}, | ||
+ | "fill": {"value": "green"}, | ||
+ | "stroke": {"value": "#888"} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "from": {"data": "iqrcalcs"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "median_y"}, | ||
+ | "width": {"value": 2}, | ||
+ | "yc": {"scale": "y", "field": "x"}, | ||
+ | "height": {"signal": "boxSize"}, | ||
+ | "fill": {"value": "#000"} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "from": {"data": "iqrcalcs"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "lower"}, | ||
+ | "width": {"value": 1}, | ||
+ | "yc": {"scale": "y", "field": "x"}, | ||
+ | "height": {"signal": "boxSize", "mult": 0.5}, | ||
+ | "fill": {"value": "#000"} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "from": {"data": "iqrcalcs"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "upper"}, | ||
+ | "width": {"value": 1}, | ||
+ | "yc": {"scale": "y", "field": "x"}, | ||
+ | "height": {"signal": "boxSize", "mult": 0.5}, | ||
+ | "fill": {"value": "#000"} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "symbol", | ||
+ | "from": {"data": "stats"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "min_y"}, | ||
+ | "yc": {"scale": "y", "field": "x"}, | ||
+ | "size": {"value": 20}, | ||
+ | "stroke": {"value": "#000"}, | ||
+ | "fill": {"value": "#fff"} | ||
+ | |||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "symbol", | ||
+ | "from": {"data": "stats"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "max_y"}, | ||
+ | "yc": {"scale": "y", "field": "x"}, | ||
+ | "size": {"value": 20}, | ||
+ | "stroke": {"value": "#000"}, | ||
+ | "fill": {"value": "#fff"} | ||
+ | |||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | |||
+ | ===11=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "name": "Vega Visualization", | ||
+ | "height": 250, | ||
+ | "padding": "auto", | ||
+ | "marks": [ | ||
+ | { | ||
+ | "properties": { | ||
+ | "update": {"fillOpacity": {"value": 1}}, | ||
+ | "hover": {"fillOpacity": {"value": 0.5}}, | ||
+ | "enter": { | ||
+ | "innerRadius": {"value": 75}, | ||
+ | "stroke": {"value": "white"}, | ||
+ | "startAngle": {"field": "layout_start"}, | ||
+ | "x": {"mult": 0.5,"group": "width"}, | ||
+ | "outerRadius": {"field": "calcOuterRadius"}, | ||
+ | "endAngle": {"field": "layout_end"}, | ||
+ | "fill": {"field": "x","scale": "color"}, | ||
+ | "y": {"mult": 0.5,"group": "height"} | ||
+ | } | ||
+ | }, | ||
+ | "from": { | ||
+ | "data": "table", | ||
+ | "transform": [ | ||
+ | {"field": "y2","type": "pie"}, | ||
+ | { | ||
+ | "field": "calcOuterRadius", | ||
+ | "expr": "(250 - 75) * (datum.y/100.0) + 75", | ||
+ | "type": "formula" | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | "type": "arc" | ||
+ | }, | ||
+ | { | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "innerRadius": {"value": 75}, | ||
+ | "stroke": {"value": "gray"}, | ||
+ | "startAngle": {"field": "layout_start"}, | ||
+ | "x": {"mult": 0.5,"group": "width"}, | ||
+ | "outerRadius": {"value": 250}, | ||
+ | "endAngle": {"field": "layout_end"}, | ||
+ | "y": {"mult": 0.5,"group": "height"} | ||
+ | } | ||
+ | }, | ||
+ | "from": { | ||
+ | "data": "table", | ||
+ | "transform": [ | ||
+ | {"field": "y2","type": "pie"}, | ||
+ | { | ||
+ | "field": "calcOuterRadius", | ||
+ | "expr": "(250 - 75) * (datum.y/100.0) + 75", | ||
+ | "type": "formula" | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | "type": "arc" | ||
+ | } | ||
+ | ], | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | {"x": "FIS","y2": 0.5,"group": 1,"y": 59}, | ||
+ | {"x": "MAR","y2": 0.5,"group": 1,"y": 24}, | ||
+ | {"x": "AO","y2": 1,"group": 1,"y": 98}, | ||
+ | {"x": "NP","y2": 1,"group": 1,"y": 60}, | ||
+ | {"x": "CS","y2": 1,"group": 1,"y": 74}, | ||
+ | {"x": "CP","y2": 1,"group": 1,"y": 70}, | ||
+ | {"x": "TR","y2": 1,"group": 1,"y": 42}, | ||
+ | {"x": "LIV","y2": 0.5,"group": 1,"y": 77}, | ||
+ | {"x": "ECO","y2": 0.5,"group": 1,"y": 88}, | ||
+ | {"x": "ICO","y2": 0.5,"group": 1,"y": 60}, | ||
+ | {"x": "LSP","y2": 0.5,"group": 1,"y": 65}, | ||
+ | {"x": "CW","y2": 1,"group": 1,"y": 71}, | ||
+ | {"x": "HAB","y2": 0.5,"group": 1,"y": 88}, | ||
+ | {"x": "SPP","y2": 0.5,"group": 1,"y": 83} | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "color", | ||
+ | "range": [ | ||
+ | "#9E0041", | ||
+ | "#C32F4B", | ||
+ | "#E1514B", | ||
+ | "#F47245", | ||
+ | "#FB9F59", | ||
+ | "#FEC574", | ||
+ | "#FAE38C", | ||
+ | "#EAF195", | ||
+ | "#C7E89E", | ||
+ | "#9CD6A4", | ||
+ | "#6CC4A4", | ||
+ | "#4D9DB4", | ||
+ | "#4776B4", | ||
+ | "#5E4EA1" | ||
+ | ], | ||
+ | "domain": {"data": "table","field": "x"}, | ||
+ | "type": "ordinal" | ||
+ | } | ||
+ | ], | ||
+ | "width": 250, | ||
+ | "legends": [{"title": "group","fill": "color"}] | ||
+ | } | ||
+ | </graph> | ||
+ | |||
+ | ===12=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "name": "Vega Visualization", | ||
+ | "height": 500, | ||
+ | "padding": "auto", | ||
+ | "marks": [ | ||
+ | { | ||
+ | "marks": [ | ||
+ | { | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "interpolate": { | ||
+ | "value": "cardinal" | ||
+ | }, | ||
+ | "x": { | ||
+ | "field": "x", | ||
+ | "scale": "x" | ||
+ | }, | ||
+ | "y2": { | ||
+ | "field": "layout_end", | ||
+ | "scale": "y" | ||
+ | }, | ||
+ | "fill": { | ||
+ | "field": "group", | ||
+ | "scale": "group" | ||
+ | }, | ||
+ | "y": { | ||
+ | "field": "layout_start", | ||
+ | "scale": "y" | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "type": "area" | ||
+ | } | ||
+ | ], | ||
+ | "from": { | ||
+ | "data": "table", | ||
+ | "transform": [ | ||
+ | { | ||
+ | "field": "y", | ||
+ | "groupby": [ | ||
+ | "x" | ||
+ | ], | ||
+ | "type": "stack", | ||
+ | "offset": "center" | ||
+ | }, | ||
+ | { | ||
+ | "groupby": [ | ||
+ | "group" | ||
+ | ], | ||
+ | "type": "facet" | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | "type": "group" | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | { | ||
+ | "type": "x", | ||
+ | "scale": "x" | ||
+ | }, | ||
+ | { | ||
+ | "type": "y", | ||
+ | "scale": "y", | ||
+ | "tickSize": 0, | ||
+ | "properties": { | ||
+ | "labels": { | ||
+ | "fontSize": {"value": 0} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | { | ||
+ | "x": "01/08/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.1 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/09/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.15 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/10/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/11/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.38 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/12/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/13/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.16 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/14/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.07 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/15/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.02 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/16/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.17 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/17/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.33 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/18/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/19/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.32 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/20/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/21/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/22/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/23/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.32 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/24/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/25/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/26/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.16 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/27/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/28/2013", | ||
+ | "y2": 0, | ||
+ | "group": "AR", | ||
+ | "y": 0.1 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/08/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/09/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.36 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/10/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.37 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/11/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/12/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.24 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/13/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/14/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.34 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/15/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.21 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/16/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.18 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/17/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.45 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/18/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.32 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/19/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/20/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.3 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/21/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.28 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/22/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.27 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/23/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/24/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.15 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/25/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.3 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/26/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/27/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.42 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/28/2013", | ||
+ | "y2": 0, | ||
+ | "group": "DJ", | ||
+ | "y": 0.42 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/08/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.21 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/09/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.25 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/10/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.27 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/11/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.23 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/12/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.24 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/13/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.21 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/14/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/15/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.39 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/16/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/17/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.36 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/18/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.33 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/19/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.43 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/20/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/21/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.34 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/22/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.28 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/23/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/24/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.37 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/25/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.41 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/26/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.46 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/27/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.47 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/28/2013", | ||
+ | "y2": 0, | ||
+ | "group": "MS", | ||
+ | "y": 0.41 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/08/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.1 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/09/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.15 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/10/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/11/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.38 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/12/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/13/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.16 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/14/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.07 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/15/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.02 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/16/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.17 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/17/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.33 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/18/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/19/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.32 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/20/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/21/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/22/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/23/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.32 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/24/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/25/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/26/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.16 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/27/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/28/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RC", | ||
+ | "y": 0.1 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/08/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.1 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/09/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.15 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/10/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/11/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.38 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/12/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/13/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.16 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/14/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.07 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/15/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.02 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/16/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.17 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/17/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.33 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/18/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/19/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.32 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/20/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/21/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/22/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/23/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.32 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/24/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/25/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/26/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.16 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/27/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/28/2013", | ||
+ | "y2": 0, | ||
+ | "group": "CG", | ||
+ | "y": 0.1 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/08/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.1 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/09/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.15 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/10/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/11/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.38 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/12/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/13/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.16 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/14/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.07 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/15/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.02 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/16/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.17 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/17/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.33 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/18/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/19/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.32 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/20/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/21/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.35 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/22/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.4 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/23/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.32 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/24/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.26 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/25/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/26/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.16 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/27/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.22 | ||
+ | }, | ||
+ | { | ||
+ | "x": "01/28/2013", | ||
+ | "y2": 0, | ||
+ | "group": "RI", | ||
+ | "y": 0.1 | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "stats", | ||
+ | "source": "table", | ||
+ | "transform": [ | ||
+ | { | ||
+ | "groupby": [ | ||
+ | "x" | ||
+ | ], | ||
+ | "type": "aggregate", | ||
+ | "summarize": [ | ||
+ | { | ||
+ | "ops": [ | ||
+ | "sum" | ||
+ | ], | ||
+ | "field": "y" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "x", | ||
+ | "points": true, | ||
+ | "range": "width", | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": "x" | ||
+ | }, | ||
+ | "type": "ordinal" | ||
+ | }, | ||
+ | { | ||
+ | "name": "y", | ||
+ | "range": "height", | ||
+ | "domain": { | ||
+ | "data": "stats", | ||
+ | "field": "sum_y" | ||
+ | }, | ||
+ | "type": "linear" | ||
+ | }, | ||
+ | { | ||
+ | "name": "group", | ||
+ | "range":["#B30000", "#E34A33", "#FC8D59", "#FDBB84", "#FDD49E", "#FEF0D9"], | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": "group" | ||
+ | }, | ||
+ | "type": "ordinal" | ||
+ | } | ||
+ | ], | ||
+ | "width": 1200, | ||
+ | "legends": [ | ||
+ | { | ||
+ | "title": "Group", | ||
+ | "fill": "group" | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | |||
+ | ===14=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "name": "Vega Visualization", | ||
+ | "height": 450, | ||
+ | "padding": "auto", | ||
+ | "marks": [ | ||
+ | { | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": { | ||
+ | "field": "x", | ||
+ | "scale": "x", | ||
+ | "offset": -10 | ||
+ | }, | ||
+ | "fillOpacity": { | ||
+ | "value": 0.9 | ||
+ | }, | ||
+ | "fill": { | ||
+ | "field": "group", | ||
+ | "scale": "group" | ||
+ | }, | ||
+ | "y": { | ||
+ | "field": "y", | ||
+ | "scale": "y", | ||
+ | "offset": 4 | ||
+ | }, | ||
+ | "text": {"field": "group"}, | ||
+ | "fontSize": {"value": 11} | ||
+ | } | ||
+ | }, | ||
+ | "from": { | ||
+ | "data": "table" | ||
+ | }, | ||
+ | "type": "text" | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | { | ||
+ | "titleOffset": 40, | ||
+ | "layer": "front", | ||
+ | "properties": { | ||
+ | "title": { | ||
+ | "fontSize": { | ||
+ | "value": 14 | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | "grid": false, | ||
+ | "type": "y", | ||
+ | "scale": "y", | ||
+ | "ticks": 15, | ||
+ | "tickSize": 0, | ||
+ | "tickPadding": 10 | ||
+ | } | ||
+ | ], | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 0 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 1 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 3 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 4 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 5 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 6 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 6 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 6 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 6 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 5, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 7, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 9, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 10, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 7 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 5, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 7, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 9, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 10, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 11, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 12, | ||
+ | "y2": 0, | ||
+ | "group": 8, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 13, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 8 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 5, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 7, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 9, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 10, | ||
+ | "y2": 0, | ||
+ | "group": 8, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 11, | ||
+ | "y2": 0, | ||
+ | "group": 8, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 12, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 13, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 14, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 15, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 16, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 9 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 5, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 7, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 9, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 10, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 11, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 12, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 13, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 14, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 15, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 16, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 17, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 18, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 19, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 20, | ||
+ | "y2": 0, | ||
+ | "group": 8, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 21, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 22, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 10 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 5, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 7, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 9, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 10, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 11, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 12, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 13, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 14, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 15, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 11 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 5, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 7, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 9, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 10, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 11, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 12, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 13, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 14, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 15, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 16, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 17, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 18, | ||
+ | "y2": 0, | ||
+ | "group": 8, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 19, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 12 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 5, | ||
+ | "y2": 0, | ||
+ | "group": 1, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 7, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 9, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 10, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 11, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 12, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 13, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 14, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 15, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 16, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 17, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 18, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 19, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 20, | ||
+ | "y2": 0, | ||
+ | "group": 6, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 21, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 22, | ||
+ | "y2": 0, | ||
+ | "group": 8, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 23, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 13 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 0, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 3, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 5, | ||
+ | "y2": 0, | ||
+ | "group": 4, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 6, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 7, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 8, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 9, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 10, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 11, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 12, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 14 | ||
+ | }, | ||
+ | { | ||
+ | "x": 1, | ||
+ | "y2": 0, | ||
+ | "group": 2, | ||
+ | "y": 15 | ||
+ | }, | ||
+ | { | ||
+ | "x": 2, | ||
+ | "y2": 0, | ||
+ | "group": 5, | ||
+ | "y": 15 | ||
+ | }, | ||
+ | { | ||
+ | "x": 3, | ||
+ | "y2": 0, | ||
+ | "group": 7, | ||
+ | "y": 15 | ||
+ | }, | ||
+ | { | ||
+ | "x": 4, | ||
+ | "y2": 0, | ||
+ | "group": 9, | ||
+ | "y": 15 | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "x", | ||
+ | "range": "width", | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": "x" | ||
+ | }, | ||
+ | "type": "linear" | ||
+ | }, | ||
+ | { | ||
+ | "reverse": true, | ||
+ | "name": "y", | ||
+ | "zero": true, | ||
+ | "domainMax": 15, | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": "y" | ||
+ | }, | ||
+ | "domainMin": 0, | ||
+ | "range": "height", | ||
+ | "type": "linear", | ||
+ | "round": false | ||
+ | }, | ||
+ | { | ||
+ | "name": "group", | ||
+ | "range": [ | ||
+ | "black" | ||
+ | ], | ||
+ | "domain": { | ||
+ | "data": "table", | ||
+ | "field": "group" | ||
+ | }, | ||
+ | "type": "ordinal" | ||
+ | } | ||
+ | ], | ||
+ | "width": 500 | ||
+ | }</graph> | ||
+ | |||
+ | ===15=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "width": 400, | ||
+ | "height": 400, | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [12, 23, 47, 6, 52, 19], | ||
+ | "transform": [{"type": "pie", "field": "data"}] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "r", | ||
+ | "type": "sqrt", | ||
+ | "domain": {"data": "table", "field": "data"}, | ||
+ | "range": [20, 100] | ||
+ | } | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "arc", | ||
+ | "from": {"data": "table"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"field": {"group": "width"}, "mult": 0.5}, | ||
+ | "y": {"field": {"group": "height"}, "mult": 0.5}, | ||
+ | "startAngle": {"field": "layout_start"}, | ||
+ | "endAngle": {"field": "layout_end"}, | ||
+ | "innerRadius": {"value": 20}, | ||
+ | "outerRadius": {"scale": "r", "field": "data"}, | ||
+ | "stroke": {"value": "#fff"} | ||
+ | }, | ||
+ | "update": { | ||
+ | "fill": {"value": "#ccc"} | ||
+ | }, | ||
+ | "hover": { | ||
+ | "fill": {"value": "pink"} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "text", | ||
+ | "from": {"data": "table"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"field": {"group": "width"}, "mult": 0.5}, | ||
+ | "y": {"field": {"group": "height"}, "mult": 0.5}, | ||
+ | "radius": {"scale": "r", "field": "data", "offset": 8}, | ||
+ | "theta": {"field": "layout_mid"}, | ||
+ | "fill": {"value": "#000"}, | ||
+ | "align": {"value": "center"}, | ||
+ | "baseline": {"value": "middle"}, | ||
+ | "text": {"field": "data"} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </graph> | ||
+ | |||
+ | ===16=== | ||
+ | |||
+ | <graph>{ | ||
+ | "width": 500, | ||
+ | "height": 50, | ||
+ | |||
+ | "signals": [ | ||
+ | { "name": "layers", "init": 2, | ||
+ | "streams": [ | ||
+ | {"type": "click", "expr": "1 + (layers % 4)"} | ||
+ | ] | ||
+ | }, | ||
+ | { "name": "vheight", "init": {"expr": "height * layers"}, | ||
+ | "streams": [ | ||
+ | {"type": "layers, height", "expr": "height * layers"} | ||
+ | ] | ||
+ | }, | ||
+ | { "name": "opacity", "init": {"expr": "pow(layers, -2/3)"}, | ||
+ | "streams": [ | ||
+ | {"type": "layers", "expr": "pow(layers, -2/3)"} | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | |||
+ | "data": [ | ||
+ | { | ||
+ | "name": "layer_indices", | ||
+ | "values": [0, 1, 2, 3], | ||
+ | "transform": [ | ||
+ | {"type": "filter", "test": "datum.data < layers"}, | ||
+ | {"type": "formula", "field": "offset", "expr": "datum.data * -height"} | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | {"x": 1, "y": 28}, {"x": 2, "y": 55}, | ||
+ | {"x": 3, "y": 43}, {"x": 4, "y": 91}, | ||
+ | {"x": 5, "y": 81}, {"x": 6, "y": 53}, | ||
+ | {"x": 7, "y": 19}, {"x": 8, "y": 87}, | ||
+ | {"x": 9, "y": 52}, {"x": 10, "y": 48}, | ||
+ | {"x": 11, "y": 24}, {"x": 12, "y": 49}, | ||
+ | {"x": 13, "y": 87}, {"x": 14, "y": 66}, | ||
+ | {"x": 15, "y": 17}, {"x": 16, "y": 27}, | ||
+ | {"x": 17, "y": 68}, {"x": 18, "y": 16}, | ||
+ | {"x": 19, "y": 49}, {"x": 20, "y": 15} | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "x", | ||
+ | "type": "linear", | ||
+ | "range": "width", | ||
+ | "zero": false, "round": true, | ||
+ | "domain": {"data": "table", "field": "x"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "y", | ||
+ | "type": "linear", | ||
+ | "range": [{"signal":"vheight"}, 0], | ||
+ | "nice": true, | ||
+ | "domain": {"data": "table", "field": "y"} | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | {"type": "x", "scale": "x", "ticks": 20} | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "group", | ||
+ | "properties": { | ||
+ | "update": { | ||
+ | "width": {"field": {"group": "width"}}, | ||
+ | "height": {"field": {"group": "height"}}, | ||
+ | "clip": {"value": true} | ||
+ | } | ||
+ | }, | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "group", | ||
+ | "from": {"data": "layer_indices"}, | ||
+ | "properties": { | ||
+ | "update": { | ||
+ | "y": {"field": "offset"} | ||
+ | } | ||
+ | }, | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "area", | ||
+ | "from": {"data": "table"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "interpolate": {"value": "monotone"}, | ||
+ | "x": {"scale": "x", "field": "x"}, | ||
+ | "fill": {"value": "steelblue"} | ||
+ | }, | ||
+ | "update": { | ||
+ | "y": {"scale": "y", "field": "y"}, | ||
+ | "y2": {"scale": "y", "value": 0}, | ||
+ | "fillOpacity": {"signal": "opacity"} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | |||
+ | ===17=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "width": 400, | ||
+ | "height": 100, | ||
+ | "padding": {"top": 30, "left": 30, "bottom": 30, "right": 10}, | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "aggregate", | ||
+ | "values": [ | ||
+ | {"label": "Category A", "mean": 1, "lo": 0, "hi": 2}, | ||
+ | {"label": "Category B", "mean": 2, "lo": 1.5, "hi": 2.5}, | ||
+ | {"label": "Category C", "mean": 3, "lo": 1.7, "hi": 4.3}, | ||
+ | {"label": "Category D", "mean": 4, "lo": 3, "hi": 5}, | ||
+ | {"label": "Category E", "mean": 5, "lo": 4.1, "hi": 5.9} | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "y", | ||
+ | "type": "ordinal", | ||
+ | "range": "height", | ||
+ | "domain": {"data": "aggregate", "field": "label"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "x", | ||
+ | "type": "linear", | ||
+ | "domain": {"data": "aggregate", "field": "hi"}, | ||
+ | "range": [100, 400], | ||
+ | "nice": true, | ||
+ | "zero": true | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | {"type": "x", "scale": "x", "ticks": 6} | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "text", | ||
+ | "from": {"data": "aggregate"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"value": 0}, | ||
+ | "y": {"scale": "y", "field": "label"}, | ||
+ | "baseline": {"value": "middle"}, | ||
+ | "fill": {"value": "#000"}, | ||
+ | "text": {"field": "label"}, | ||
+ | "font": {"value": "Helvetica Neue"}, | ||
+ | "fontSize": {"value": 13} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "from": {"data": "aggregate"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "lo"}, | ||
+ | "x2": {"scale": "x", "field": "hi"}, | ||
+ | "y": {"scale": "y", "field": "label", "offset": -1}, | ||
+ | "height": {"value": 1}, | ||
+ | "fill": {"value": "#888"} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "symbol", | ||
+ | "from": {"data": "aggregate"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "mean"}, | ||
+ | "y": {"scale": "y", "field": "label"}, | ||
+ | "size": {"value": 40}, | ||
+ | "fill": {"value": "#000"} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | |||
+ | ===18=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "width": 500, | ||
+ | "height": 250, | ||
+ | "padding": "auto", | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | {"year": 1875,"population": 1309}, | ||
+ | {"year": 1890,"population": 1558}, | ||
+ | {"year": 1910,"population": 4512}, | ||
+ | {"year": 1925,"population": 8180}, | ||
+ | {"year": 1933,"population": 15915}, | ||
+ | {"year": 1939,"population": 24824}, | ||
+ | {"year": 1946,"population": 28275}, | ||
+ | {"year": 1950,"population": 29189}, | ||
+ | {"year": 1964,"population": 29881}, | ||
+ | {"year": 1971,"population": 26007}, | ||
+ | {"year": 1981,"population": 24029}, | ||
+ | {"year": 1985,"population": 23340}, | ||
+ | {"year": 1989,"population": 22307}, | ||
+ | {"year": 1990,"population": 22087}, | ||
+ | {"year": 1991,"population": 22139}, | ||
+ | {"year": 1992,"population": 22105}, | ||
+ | {"year": 1993,"population": 22242}, | ||
+ | {"year": 1994,"population": 22801}, | ||
+ | {"year": 1995,"population": 24273}, | ||
+ | {"year": 1996,"population": 25640}, | ||
+ | {"year": 1997,"population": 27393}, | ||
+ | {"year": 1998,"population": 29505}, | ||
+ | {"year": 1999,"population": 32124}, | ||
+ | {"year": 2000,"population": 33791}, | ||
+ | {"year": 2001,"population": 35297}, | ||
+ | {"year": 2002,"population": 36179}, | ||
+ | {"year": 2003,"population": 36829}, | ||
+ | {"year": 2004,"population": 37493}, | ||
+ | {"year": 2005,"population": 38376}, | ||
+ | {"year": 2006,"population": 39008}, | ||
+ | {"year": 2007,"population": 39366}, | ||
+ | {"year": 2008,"population": 39821}, | ||
+ | {"year": 2009,"population": 40179}, | ||
+ | {"year": 2010,"population": 40511}, | ||
+ | {"year": 2011,"population": 40465}, | ||
+ | {"year": 2012,"population": 40905}, | ||
+ | {"year": 2013,"population": 41258}, | ||
+ | {"year": 2014,"population": 41777} | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "annotation", | ||
+ | "values": [ | ||
+ | {"start": 1933,"end": 1945,"text": "Nazi rule"}, | ||
+ | { | ||
+ | "start": 1948, | ||
+ | "end": 1989, | ||
+ | "text": "GDR (East Germany)" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "x", | ||
+ | "type": "linear", | ||
+ | "range": "width", | ||
+ | "zero": false, | ||
+ | "domain": {"data": "table","field": "year"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "y", | ||
+ | "type": "linear", | ||
+ | "range": "height", | ||
+ | "nice": true, | ||
+ | "domain": {"data": "table","field": "population"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "color", | ||
+ | "type": "ordinal", | ||
+ | "domain": {"data": "annotation","field": "text"}, | ||
+ | "range": ["black","red"] | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | { | ||
+ | "type": "x", | ||
+ | "scale": "x", | ||
+ | "format": "d", | ||
+ | "title": "Year", | ||
+ | "ticks": 15 | ||
+ | }, | ||
+ | { | ||
+ | "type": "y", | ||
+ | "scale": "y", | ||
+ | "title": "Population", | ||
+ | "grid": true, | ||
+ | "layer": "back" | ||
+ | } | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "from": {"data": "annotation"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x","field": "start"}, | ||
+ | "x2": {"scale": "x","field": "end"}, | ||
+ | "y": {"value": 0}, | ||
+ | "y2": {"signal": "height"}, | ||
+ | "fill": {"scale": "color","field": "text"}, | ||
+ | "opacity": {"value": 0.2} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "line", | ||
+ | "from": {"data": "table"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "interpolate": {"value": "monotone"}, | ||
+ | "x": {"scale": "x","field": "year"}, | ||
+ | "y": {"scale": "y","field": "population"}, | ||
+ | "stroke": {"value": "steelblue"}, | ||
+ | "strokeWidth": {"value": 3} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "symbol", | ||
+ | "from": {"data": "table"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x","field": "year"}, | ||
+ | "y": {"scale": "y","field": "population"}, | ||
+ | "stroke": {"value": "steelblue"}, | ||
+ | "fill": {"value": "white"}, | ||
+ | "size": {"value": 30} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "text", | ||
+ | "from": { | ||
+ | "data": "table", | ||
+ | "transform": [ | ||
+ | { | ||
+ | "type": "aggregate", | ||
+ | "summarize": {"year": ["min","max"]} | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"signal": "width","mult": 0.5}, | ||
+ | "y": {"value": -10}, | ||
+ | "text": { | ||
+ | "template": "Population of Falkensee from {{datum.min_year}} to {{datum.max_year}}" | ||
+ | }, | ||
+ | "fill": {"value": "black"}, | ||
+ | "fontSize": {"value": 16}, | ||
+ | "align": {"value": "center"}, | ||
+ | "fontWeight": {"value": "bold"} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "legends": [ | ||
+ | { | ||
+ | "fill": "color", | ||
+ | "title": "Period", | ||
+ | "properties": { | ||
+ | "symbols": { | ||
+ | "strokeWidth": {"value": 0}, | ||
+ | "shape": {"value": "square"}, | ||
+ | "opacity": {"value": 0.3} | ||
+ | }, | ||
+ | "legend": { | ||
+ | "x": {"value": 10}, | ||
+ | "y": {"value": 5}, | ||
+ | "fill": {"value": "white"} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | |||
+ | ===19=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "width": 300, | ||
+ | "height": 240, | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | {"category":"A", "position":0, "value":0.1}, | ||
+ | {"category":"A", "position":1, "value":0.6}, | ||
+ | {"category":"A", "position":2, "value":0.9}, | ||
+ | {"category":"A", "position":3, "value":0.4}, | ||
+ | {"category":"B", "position":0, "value":0.7}, | ||
+ | {"category":"B", "position":1, "value":0.2}, | ||
+ | {"category":"B", "position":2, "value":1.1}, | ||
+ | {"category":"B", "position":3, "value":0.8}, | ||
+ | {"category":"C", "position":0, "value":0.6}, | ||
+ | {"category":"C", "position":1, "value":0.1}, | ||
+ | {"category":"C", "position":2, "value":0.2}, | ||
+ | {"category":"C", "position":3, "value":0.7} | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "cat", | ||
+ | "type": "ordinal", | ||
+ | "domain": {"data": "table", "field": "category"}, | ||
+ | "range": "height", | ||
+ | "padding": 0.2 | ||
+ | }, | ||
+ | { | ||
+ | "name": "val", | ||
+ | "type": "linear", | ||
+ | "domain": {"data": "table", "field": "value"}, | ||
+ | "range": "width", | ||
+ | "round": true, | ||
+ | "nice": true | ||
+ | }, | ||
+ | { | ||
+ | "name": "color", | ||
+ | "type": "ordinal", | ||
+ | "domain": {"data": "table", "field": "position"}, | ||
+ | "range": "category10" | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | {"type": "y", "scale": "cat", "tickSize": 0, "tickPadding": 8}, | ||
+ | {"type": "x", "scale": "val"} | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "group", | ||
+ | "from": { | ||
+ | "data": "table", | ||
+ | "transform": [{"type":"facet", "groupby": ["category"]}] | ||
+ | }, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "y": {"scale": "cat", "field": "key"}, | ||
+ | "height": {"scale": "cat", "band": true} | ||
+ | } | ||
+ | }, | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "pos", | ||
+ | "type": "ordinal", | ||
+ | "range": "height", | ||
+ | "domain": {"field": "position"} | ||
+ | } | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "name": "bars", | ||
+ | "type": "rect", | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "y": {"scale": "pos", "field": "position"}, | ||
+ | "height": {"scale": "pos", "band": true}, | ||
+ | "x": {"scale": "val", "field": "value"}, | ||
+ | "x2": {"scale": "val", "value": 0}, | ||
+ | "fill": {"scale": "color", "field": "position"} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "text", | ||
+ | "from": {"mark": "bars"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"field": "x2", "offset": -5}, | ||
+ | "y": {"field": "y"}, | ||
+ | "dy": {"field": "height", "mult": 0.5}, | ||
+ | "fill": {"value": "white"}, | ||
+ | "align": {"value": "right"}, | ||
+ | "baseline": {"value": "middle"}, | ||
+ | "text": {"field": "datum.value"} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | |||
+ | ===20=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "width": 400, | ||
+ | "height": 100, | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "people", | ||
+ | "values": [ | ||
+ | {"label":"Washington", "born":-7506057600000, "died":-5366196000000, | ||
+ | "enter":-5701424400000, "leave":-5453884800000}, | ||
+ | {"label":"Adams", "born":-7389766800000, "died":-4528285200000, | ||
+ | "enter":-5453884800000, "leave":-5327740800000}, | ||
+ | {"label":"Jefferson", "born":-7154586000000, "died":-4528285200000, | ||
+ | "enter":-5327740800000, "leave":-5075280000000}, | ||
+ | {"label":"Madison", "born":-6904544400000, "died":-4213184400000, | ||
+ | "enter":-5075280000000, "leave":-4822819200000}, | ||
+ | {"label":"Monroe", "born":-6679904400000, "died":-4370518800000, | ||
+ | "enter":-4822819200000, "leave":-4570358400000} | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "events", | ||
+ | "format": {"type":"json", "parse":{"when":"date"}}, | ||
+ | "values": [ | ||
+ | {"name":"Decl. of Independence", "when":"July 4, 1776"}, | ||
+ | {"name":"U.S. Constitution", "when":"3/4/1789"}, | ||
+ | {"name":"Louisiana Purchase", "when":"April 30, 1803"}, | ||
+ | {"name":"Monroe Doctrine", "when":"Dec 2, 1823"} | ||
+ | ] | ||
+ | } | ||
+ | |||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "y", | ||
+ | "type": "ordinal", | ||
+ | "range": "height", | ||
+ | "domain": {"data": "people", "field": "label"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "x", | ||
+ | "type": "time", | ||
+ | "range": "width", | ||
+ | "round": true, | ||
+ | "nice": "year", | ||
+ | "domain": {"data": "people", "field": ["born", "died"]} | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | {"type": "x", "scale": "x"} | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "text", | ||
+ | "from": {"data": "events"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "when"}, | ||
+ | "y": {"value": -10}, | ||
+ | "angle": {"value": -25}, | ||
+ | "fill": {"value": "#000"}, | ||
+ | "text": {"field": "name"}, | ||
+ | "font": {"value": "Helvetica Neue"}, | ||
+ | "fontSize": {"value": 10} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "from": {"data": "events"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "when"}, | ||
+ | "y": {"value": -8}, | ||
+ | "width": {"value": 1}, | ||
+ | "height": {"field": {"group": "height"}, "offset": 8}, | ||
+ | "fill": {"value": "#c00"} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "text", | ||
+ | "from": {"data": "people"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "born"}, | ||
+ | "y": {"scale": "y", "field": "label", "offset": -3}, | ||
+ | "fill": {"value": "#000"}, | ||
+ | "text": {"field": "label"}, | ||
+ | "font": {"value": "Helvetica Neue"}, | ||
+ | "fontSize": {"value": 10} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "from": {"data": "people"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "born"}, | ||
+ | "x2": {"scale": "x", "field": "died"}, | ||
+ | "y": {"scale": "y", "field": "label"}, | ||
+ | "height": {"value": 2}, | ||
+ | "fill": {"value": "#557"} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "from": {"data": "people"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "enter"}, | ||
+ | "x2": {"scale": "x", "field": "leave"}, | ||
+ | "y": {"scale": "y", "field": "label", "offset":-1}, | ||
+ | "height": {"value": 4}, | ||
+ | "fill": {"value": "#e44"} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </graph> | ||
+ | |||
+ | ===21=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "width": 500, | ||
+ | "height": 200, | ||
+ | "padding": {"top": 10, "left": 30, "bottom": 30, "right": 10}, | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | {"x": 0, "y": 28, "c":0}, {"x": 0, "y": 55, "c":1}, | ||
+ | {"x": 1, "y": 43, "c":0}, {"x": 1, "y": 91, "c":1}, | ||
+ | {"x": 2, "y": 81, "c":0}, {"x": 2, "y": 53, "c":1}, | ||
+ | {"x": 3, "y": 19, "c":0}, {"x": 3, "y": 87, "c":1}, | ||
+ | {"x": 4, "y": 52, "c":0}, {"x": 4, "y": 48, "c":1}, | ||
+ | {"x": 5, "y": 24, "c":0}, {"x": 5, "y": 49, "c":1}, | ||
+ | {"x": 6, "y": 87, "c":0}, {"x": 6, "y": 66, "c":1}, | ||
+ | {"x": 7, "y": 17, "c":0}, {"x": 7, "y": 27, "c":1}, | ||
+ | {"x": 8, "y": 68, "c":0}, {"x": 8, "y": 16, "c":1}, | ||
+ | {"x": 9, "y": 49, "c":0}, {"x": 9, "y": 15, "c":1} | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "stats", | ||
+ | "source": "table", | ||
+ | "transform": [ | ||
+ | { | ||
+ | "type": "aggregate", | ||
+ | "groupby": ["x"], | ||
+ | "summarize": [{"field": "y", "ops": ["sum"]}] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "x", | ||
+ | "type": "ordinal", | ||
+ | "range": "width", | ||
+ | "points": true, | ||
+ | "domain": {"data": "table", "field": "x"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "y", | ||
+ | "type": "linear", | ||
+ | "range": "height", | ||
+ | "nice": true, | ||
+ | "domain": {"data": "stats", "field": "sum_y"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "color", | ||
+ | "type": "ordinal", | ||
+ | "range": "category10", | ||
+ | "domain": {"data": "table", "field": "c"} | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | {"type": "x", "scale": "x"}, | ||
+ | {"type": "y", "scale": "y"} | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "group", | ||
+ | "from": { | ||
+ | "data": "table", | ||
+ | "transform": [ | ||
+ | {"type": "stack", "groupby": ["x"], "sortby": ["c"], "field": "y"}, | ||
+ | {"type": "facet", "groupby": ["c"]} | ||
+ | ] | ||
+ | }, | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "area", | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "interpolate": {"value": "monotone"}, | ||
+ | "x": {"scale": "x", "field": "x"}, | ||
+ | "y": {"scale": "y", "field": "layout_start"}, | ||
+ | "y2": {"scale": "y", "field": "layout_end"}, | ||
+ | "fill": {"scale": "color", "field": "c"} | ||
+ | }, | ||
+ | "update": { | ||
+ | "fillOpacity": {"value": 1} | ||
+ | }, | ||
+ | "hover": { | ||
+ | "fillOpacity": {"value": 0.5} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | |||
+ | ===22=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "width": 500, | ||
+ | "height": 200, | ||
+ | "padding": {"top": 10, "left": 30, "bottom": 30, "right": 10}, | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | {"x": 0, "y": 28, "c":0}, {"x": 0, "y": 55, "c":1}, | ||
+ | {"x": 1, "y": 43, "c":0}, {"x": 1, "y": 91, "c":1}, | ||
+ | {"x": 2, "y": 81, "c":0}, {"x": 2, "y": 53, "c":1}, | ||
+ | {"x": 3, "y": 19, "c":0}, {"x": 3, "y": 87, "c":1}, | ||
+ | {"x": 4, "y": 52, "c":0}, {"x": 4, "y": 48, "c":1}, | ||
+ | {"x": 5, "y": 24, "c":0}, {"x": 5, "y": 49, "c":1}, | ||
+ | {"x": 6, "y": 87, "c":0}, {"x": 6, "y": 66, "c":1}, | ||
+ | {"x": 7, "y": 17, "c":0}, {"x": 7, "y": 27, "c":1}, | ||
+ | {"x": 8, "y": 68, "c":0}, {"x": 8, "y": 16, "c":1}, | ||
+ | {"x": 9, "y": 49, "c":0}, {"x": 9, "y": 15, "c":1} | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "name": "stats", | ||
+ | "source": "table", | ||
+ | "transform": [ | ||
+ | { | ||
+ | "type": "aggregate", | ||
+ | "groupby": ["x"], | ||
+ | "summarize": [{"field": "y", "ops": ["sum"]}] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "x", | ||
+ | "type": "ordinal", | ||
+ | "range": "width", | ||
+ | "domain": {"data": "table", "field": "x"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "y", | ||
+ | "type": "linear", | ||
+ | "range": "height", | ||
+ | "nice": true, | ||
+ | "domain": {"data": "stats", "field": "sum_y"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "color", | ||
+ | "type": "ordinal", | ||
+ | "range": "category10", | ||
+ | "domain": {"data": "table", "field": "c"} | ||
+ | } | ||
+ | ], | ||
+ | "axes": [ | ||
+ | {"type": "x", "scale": "x"}, | ||
+ | {"type": "y", "scale": "y"} | ||
+ | ], | ||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "rect", | ||
+ | "from": { | ||
+ | "data": "table", | ||
+ | "transform": [ | ||
+ | {"type": "stack", "groupby": ["x"], "sortby": ["c"], "field": "y"} | ||
+ | ] | ||
+ | }, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"scale": "x", "field": "x"}, | ||
+ | "width": {"scale": "x", "band": true, "offset": -1}, | ||
+ | "y": {"scale": "y", "field": "layout_start"}, | ||
+ | "y2": {"scale": "y", "field": "layout_end"}, | ||
+ | "fill": {"scale": "color", "field": "c"} | ||
+ | }, | ||
+ | "update": { | ||
+ | "fillOpacity": {"value": 1} | ||
+ | }, | ||
+ | "hover": { | ||
+ | "fillOpacity": {"value": 0.5} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | |||
+ | ===23=== | ||
+ | |||
+ | <graph> | ||
+ | { | ||
+ | "name": "wordcloud", | ||
+ | "width": 800, | ||
+ | "height": 400, | ||
+ | "padding": {"top":0, "bottom":0, "left":0, "right":0}, | ||
+ | |||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | // "Declarative visualization grammars can accelerate development, facilitate retargeting across platforms, and allow language-level optimizations. However, existing declarative visualization languages are primarily concerned with visual encoding, and rely on imperative event handlers for interactive behaviors. In response, we introduce a model of declarative interaction design for data visualizations. Adopting methods from reactive programming, we model low-level events as composable data streams from which we form higher-level semantic signals. Signals feed predicates and scale inversions, which allow us to generalize interactive selections at the level of item geometry (pixels) into interactive queries over the data domain. Production rules then use these queries to manipulate the visualization’s appearance. To facilitate reuse and sharing, these constructs can be encapsulated as named interactors: standalone, purely declarative specifications of interaction techniques. We assess our model’s feasibility and expressivity by instantiating it with extensions to the Vega visualization grammar. Through a diverse range of examples, we demonstrate coverage over an established taxonomy of visualization interaction techniques.", | ||
+ | // "We present Reactive Vega, a system architecture that provides the first robust and comprehensive treatment of declarative visual and interaction design for data visualization. Starting from a single declarative specification, Reactive Vega constructs a dataflow graph in which input data, scene graph elements, and interaction events are all treated as first-class streaming data sources. To support expressive interactive visualizations that may involve time-varying scalar, relational, or hierarchical data, Reactive Vega’s dataflow graph can dynamically re-write itself at runtime by extending or pruning branches in a data-driven fashion. We discuss both compile- and run-time optimizations applied within Reactive Vega, and share the results of benchmark studies that indicate superior interactive performance to both D3 and the original, non-reactive Vega system." | ||
+ | |||
+ | "Autoritatile Republicii Moldova s-au sesizat pe marginea propagarii virusului la sfarsitul lunii ianuarie, dupa care situatia epidemiologica la infectia cu noul tip de coronavirus a fost examinata de Comisia Nationala Extraordinara de Sanatate Publica (CNESP) la 2 februarie 2020. In dependenta de gradul de risc pentru sanatatea publica, Comisia a instituit succesiv din 24 februarie pana la 13 martie grad de alerta cod galben, portocaliu si rosu. Ultimul a fost atribuit dupa ce in Republica Moldova fusese confirmate 6 cazuri de COVID-19, iar Organizatia Mondiala a Sanatatii a anuntat la 11 martie faza de transmitere pandemica a virusului. Principale masuri aprobate de Comisie au vizat suspendarea procesului educational, sistarea transportului aerian regulat cu zonele afectate de pandemia COVID-19, intreruperea activitatii institutiilor de agrement, antrenament si recreere si a intrunirilor religioase. Cresterea numarului de cazuri de infectie cu virusul COVID-19 a determinat CNESP sa extinda la 15 martie numarul masurilor preventive prin sistarea transportului feroviar international de pasageri si oprirea temporara a activitatii comerciale, cu exceptia magazinelor alimentare, farmaciilor si a benzinariilor. Totusi, avand cod rosu de alerta si un focar de infectie in doua din satele raionului Hincesti, autoritatile nu au interzis desfasurarea alegerilor parlamentare noi in circumscriptia uninominala nr. 38, Hincesti pe 15 martie 2020, care au fost castigate de candidatul PSRM.", | ||
+ | |||
+ | "Numarul cazurilor active este obtinut dupa deducerea numarului de persoane vindecate si decedate din numarul total de cazuri confirmate. Dupa ce catre inceputul lunii mai infectia a atins un platou de cazuri noi, redeschiderea tuturor magazinelor si reluarea serviciilor religioase, precum si organizarea mai multor evenimente publice dedicate zilei de 9 mai in Balti, Chisinau, Comrat si Tiraspol a generat o crestere rapida de cazuri noi, care a culminat pe 20 mai. Ulterior, pe parcursul unei saptamani s-a produs o scadere semnificativa a numarului cazurilor active. Ridicarea mai multor restrictii dupa incetarea starii de urgenta a rasturnat aceasta tendinta si a provocat o explozie de noi cazuri. Incepand cu ultima saptamana din luna mai, evolutia cazurilor active arata o crestere continua, cu numarul maxim de cazuri, inregistrat pe 2 august 2020." | ||
+ | |||
+ | |||
+ | ], | ||
+ | "transform": [ | ||
+ | { | ||
+ | "type": "countpattern", | ||
+ | "field": "data", | ||
+ | "case": "upper", | ||
+ | "pattern": "[\\w']{3,}", | ||
+ | "stopwords": "(cu|de|pe|si|a|o|dupa|din|pana|i|me|my|myself|we|us|our|ours|ourselves|you|your|yours|yourself|yourselves|he|him|his|himself|she|her|hers|herself|it|its|itself|they|them|their|theirs|themselves|what|which|who|whom|whose|this|that|these|those|am|is|are|was|were|be|been|being|have|has|had|having|do|does|did|doing|will|would|should|can|could|ought|i'm|you're|he's|she's|it's|we're|they're|i've|you've|we've|they've|i'd|you'd|he'd|she'd|we'd|they'd|i'll|you'll|he'll|she'll|we'll|they'll|isn't|aren't|wasn't|weren't|hasn't|haven't|hadn't|doesn't|don't|didn't|won't|wouldn't|shan't|shouldn't|can't|cannot|couldn't|mustn't|let's|that's|who's|what's|here's|there's|when's|where's|why's|how's|a|an|the|and|but|if|or|because|as|until|while|of|at|by|for|with|about|against|between|into|through|during|before|after|above|below|to|from|up|upon|down|in|out|on|off|over|under|again|further|then|once|here|there|when|where|why|how|all|any|both|each|few|more|most|other|some|such|no|nor|not|only|own|same|so|than|too|very|say|says|said|shall)" | ||
+ | }, | ||
+ | { | ||
+ | "type": "formula", "field": "angle", | ||
+ | "expr": "[-45, 0, 45][~~(random() * 3)]" | ||
+ | }, | ||
+ | { | ||
+ | "type": "formula", "field": "weight", | ||
+ | "expr": "if(datum.text=='VEGA', 600, 300)" | ||
+ | }, | ||
+ | { | ||
+ | "type": "wordcloud", | ||
+ | "size": [800, 400], | ||
+ | "text": {"field": "text"}, | ||
+ | "rotate": {"field": "angle"}, | ||
+ | "font": {"value": "Helvetica Neue"}, | ||
+ | "fontSize": {"field": "count"}, | ||
+ | "fontWeight": {"field": "weight"}, | ||
+ | "fontScale": [12, 56] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | |||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "color", | ||
+ | "type": "ordinal", | ||
+ | "range": ["#d5a928", "#652c90", "#939597"] | ||
+ | } | ||
+ | ], | ||
+ | |||
+ | "marks": [ | ||
+ | { | ||
+ | "type": "text", | ||
+ | "from": {"data": "table"}, | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "x": {"field": "layout_x"}, | ||
+ | "y": {"field": "layout_y"}, | ||
+ | "angle": {"field": "layout_rotate"}, | ||
+ | "font": {"field": "layout_font"}, | ||
+ | "fontSize": {"field": "layout_fontSize"}, | ||
+ | "fontStyle": {"field": "layout_fontStyle"}, | ||
+ | "fontWeight": {"field": "layout_fontWeight"}, | ||
+ | "text": {"field": "text"}, | ||
+ | "align": {"value": "center"}, | ||
+ | "baseline": {"value": "alphabetic"}, | ||
+ | "fill": {"scale": "color", "field": "text"} | ||
+ | }, | ||
+ | "update": { | ||
+ | "fillOpacity": {"value": 1} | ||
+ | }, | ||
+ | "hover": { | ||
+ | "fillOpacity": {"value": 0.5} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }</graph> |