{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 200, "height": 200, "style": "cell", "data": [ { "name": "source_0", "values": [ {"wavelength": 250, "power": 1}, {"wavelength": 300, "power": 2}, {"wavelength": 420, "power": 4}, {"wavelength": 450, "power": 1.8}, {"wavelength": 500, "power": 1.1} ] }, { "name": "data_0", "source": "source_0", "transform": [ { "type": "formula", "expr": "toNumber(datum[\"wavelength\"])", "as": "wavelength" } ] } ], "marks": [ { "name": "marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"wavelength\"]"}, "from": {"data": "data_0"}, "encode": { "update": { "stroke": {"value": "#4c78a8"}, "description": { "signal": "\"wavelength: \" + (format(datum[\"wavelength\"], \"\")) + \"; power: \" + (format(datum[\"power\"], \"\"))" }, "x": {"scale": "x", "field": "wavelength"}, "y": {"scale": "y", "field": "power"}, "defined": { "signal": "isValid(datum[\"wavelength\"]) && isFinite(+datum[\"wavelength\"]) && isValid(datum[\"power\"]) && isFinite(+datum[\"power\"])" } } } } ], "scales": [ { "name": "x", "type": "linear", "domain": [300, 450], "range": [0, {"signal": "width"}], "zero": false }, { "name": "y", "type": "linear", "domain": {"data": "data_0", "field": "power"}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true } ], "axes": [ { "scale": "x", "orient": "bottom", "gridScale": "y", "grid": true, "tickCount": {"signal": "ceil(width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "y", "orient": "left", "gridScale": "x", "grid": true, "tickCount": {"signal": "ceil(height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "x", "orient": "bottom", "grid": false, "title": "wavelength", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "power", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] }