{
"version": 2, "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'"} } } } ] } ]
}