Format: Ro: Diferență între versiuni
De la alegeri.md
Oleg (Discuție | contribuții) |
Oleg (Discuție | contribuții) |
||
Linia 4.829: | Linia 4.829: | ||
"baseline": {"value": "middle"}, | "baseline": {"value": "middle"}, | ||
"text": {"field": "datum.value"} | "text": {"field": "datum.value"} | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
+ | |||
+ | |||
+ | <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": "#888"} | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "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> | ||
+ | |||
+ | |||
+ | <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} | ||
} | } | ||
} | } |
Versiunea de la data 3 august 2020 21:13
18293 / 2018 | 18793 / 2018 | 147 / 2019 |