Format: Ro/2: Diferență între versiuni
De la alegeri.md
Oleg (Discuție | contribuții) |
Oleg (Discuție | contribuții) |
||
Linia 93: | Linia 93: | ||
}</graph> | }</graph> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | <graph>{ | ||
+ | "version": 2, | ||
+ | "description": "Всплывающие данные", | ||
+ | "height": 200, | ||
+ | "width": 910, | ||
+ | // "viewport": [945,230], | ||
+ | // "padding": 5, | ||
+ | "padding": {"top": 15, "left": 33, "bottom": 25, "right": 1}, | ||
+ | // | ||
+ | "data": [ | ||
+ | { | ||
+ | "name": "table", | ||
+ | "values": [ | ||
+ | {"x": "7 mar", "y": 109}, | ||
+ | {"x": "B", "y": 55}, | ||
+ | {"x": "C", "y": 9}, | ||
+ | {"x": "D", "y": 91}, | ||
+ | {"x": "31 iul", "y": 81}, | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | // | ||
+ | "signals": [ | ||
+ | { | ||
+ | "name": "tooltip", | ||
+ | "init": {}, | ||
+ | "streams": [ | ||
+ | {"type": "rect:mouseover", "expr": "datum"}, | ||
+ | {"type": "rect:mouseout", "expr": "{}"} | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | // | ||
+ | "predicates": [ | ||
+ | { | ||
+ | "name": "tooltip", "type": "==", | ||
+ | "operands": [{"signal": "tooltip._id"}, {"arg": "id"}] | ||
+ | } | ||
+ | ], | ||
+ | // | ||
+ | "scales": [ | ||
+ | { | ||
+ | "name": "x", | ||
+ | "type": "ordinal", | ||
+ | "range": "width", | ||
+ | "padding": 0.01, | ||
+ | // "round": true, | ||
+ | "domain": {"data": "table", "field": "x"} | ||
+ | }, | ||
+ | { | ||
+ | "name": "y", | ||
+ | "type": "linear", | ||
+ | "range": "height", | ||
+ | "nice": true, | ||
+ | "domain": {"data": "table", "field": "y"} | ||
+ | } | ||
+ | ], | ||
+ | // | ||
+ | "axes": [ | ||
+ | { | ||
+ | "type": "x", | ||
+ | "scale": "x", | ||
+ | // "grid": true, | ||
+ | "values": ["7 mar", "31 iul"], | ||
+ | "properties": | ||
+ | { | ||
+ | "ticks": {"stroke": {"value": "#aaa"}}, | ||
+ | "labels": {"fill": {"value": "#666"}, "fontSize": {"value": 12}}, | ||
+ | "axis": {"stroke": {"value": "#ccc"}} | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "y", | ||
+ | "scale": "y", | ||
+ | // "offset": 5, // отступ от графика | ||
+ | // "ticks": 5, // кол-во значений на оси y | ||
+ | // "tickSize": 2, | ||
+ | // "tickSizeEnd": 10, | ||
+ | "grid": true, | ||
+ | "values": [10, 30, 50, 70, 110], | ||
+ | "properties": | ||
+ | { | ||
+ | "ticks": {"stroke": {"value": "#d9d9d9"}}, | ||
+ | "labels": {"fill": {"value": "#666"}, "fontSize": {"value": 12}}, | ||
+ | "axis": {"stroke": {"value": "#ccc"}} | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | // | ||
+ | "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"}}, | ||
+ | } | ||
+ | }, | ||
+ | { | ||
+ | "type": "text", | ||
+ | "properties": { | ||
+ | "enter": { | ||
+ | "align": {"value": "center"}, | ||
+ | "fill": {"value": "#666"}, | ||
+ | }, | ||
+ | "update": { | ||
+ | "x": {"scale": "x", "signal": "tooltip.x"}, | ||
+ | "dx": {"scale": "x", "mult": 0.5, "band": true}, | ||
+ | "y": {"scale": "y", "offset": -4, "signal": "tooltip.y"}, | ||
+ | "text": {"signal": "tooltip.y"}, | ||
+ | "fontSize": {"value": 12}, | ||
+ | "fillOpacity": { | ||
+ | "rule": [ | ||
+ | { | ||
+ | "predicate": {"name": "tooltip", "id": {"value": null}}, | ||
+ | "value": 0 | ||
+ | }, | ||
+ | {"value": 1} | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | }</graph> | ||
Linia 134: | Linia 269: | ||
"nice": true, | "nice": true, | ||
"domain": {"data": "table", "field": "y"} | "domain": {"data": "table", "field": "y"} | ||
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
], | ], | ||
// | // | ||
Linia 189: | Linia 318: | ||
} | } | ||
}, | }, | ||
− | { | + | { |
− | "type":"text", | + | "type": "text", |
− | " | + | "from": {"data": "table"}, |
− | + | "properties": { | |
− | + | "enter": { | |
− | + | "align": {"value": "center"}, | |
− | + | "text": {"field": "y"}, | |
− | + | "y": {"scale": "y", "offset": -4, "field": "y"}, | |
− | + | "x": {"scale": "x", "field": "x"}, | |
− | + | "dx": {"scale": "x", "mult": 0.5, "band": true}, | |
− | + | // "angle": {"value": 0}, | |
− | + | "fontSize": {"value": 12}, | |
− | + | "fill": {"value": "#666"} | |
− | + | } | |
− | + | } | |
− | + | } | |
− | |||
− | } | ||
− | |||
] | ] | ||
}</graph> | }</graph> | ||
text | text |
Versiunea de la data 2 august 2020 12:25
text