|
|
1번째 줄: |
1번째 줄: |
− | { | + | {{Graph:test|width=400|height=100|xAxisTitle=X|yAxisTitle=Y |
− | "version": 2,
| + | |type=rect|x=1,2,3,4,5,6,7,8|y=10,12,6,14,2,10,7,9|fallback=Graph test seddon.png}} |
− | "width": 200,
| |
− | "height": 100,
| |
− | | |
− | "data": [
| |
− | {
| |
− | "name": "table",
| |
− | "values": [
| |
− | {"C": -4, "L": 0, "f":"Pre"}, {"C": 0, "L": 3, "f":"Pre"},
| |
− | {"C": -4, "L": 0, "f":"Post"}, {"C": 0, "L": 4, "f":"Post"}
| |
− | ]
| |
− | }
| |
− | ],
| |
− | | |
− | "scales": [
| |
− | {
| |
− | "name": "xscale",
| |
− | "type": "linear",
| |
− | "range": "width",
| |
− | "nice": true,
| |
− | "zero": true,
| |
− | "domain": {"data": "table", "field": "C"},
| |
− | "domainMax": 4,
| |
− | "domainMin": -4
| |
− | },
| |
− | {
| |
− | "name": "yscale",
| |
− | "type": "linear",
| |
− | "range": "height",
| |
− | "domain": {"data": "table", "field": "L"},
| |
− | "domainMax": 4,
| |
− | "domainMin": 0
| |
− | },
| |
− | {
| |
− | "name": "color",
| |
− | "type": "ordinal",
| |
− | "range":"ordinal",
| |
− | "domain": {"data": "table", "field": "f"}
| |
− | }
| |
− | ],
| |
− | | |
− | "axes": [
| |
− | {"orient": "bottom", "scale": "xscale", "tickCount": 10 },
| |
− | {"orient": "left", "scale": "yscale", "tickCount": 5, "offset": { "signal": "-width / 2" } }
| |
− | ],
| |
− | | |
− | "marks": [
| |
− | {
| |
− | "type": "group",
| |
− | "from": {
| |
− | "facet": {
| |
− | "name": "series",
| |
− | "data": "table",
| |
− | "groupby": "f"
| |
− | }
| |
− | },
| |
− | "marks": [
| |
− | {
| |
− | "type": "area",
| |
− | "from": {"data": "series"},
| |
− | "encode": {
| |
− | "enter": {
| |
− | "x": {"scale": "xscale", "field": "C" },
| |
− | "y": {"scale": "yscale", "field": "L"},
| |
− | "y2": {"scale": "yscale", "value": 0 },
| |
− | "fillOpacity": [{ "test": "indata('series', 'f', 'Pre')", "value": 0.3 }, {"value": 0}],
| |
− | "strokeWidth": [{ "test": "indata('series', 'f', 'Pre')", "value": 0 }, {"value": 2}],
| |
− | "fill": { "signal": "datum.C > 0 ? 'green': 'red'"},
| |
− | "stroke": { "signal": "datum.C > 0 ? 'green': 'red'"}
| |
− | }
| |
− | }
| |
− | }
| |
− | ]
| |
− | }
| |
− | ]
| |
− | } | |