Module

x/vega_lite/examples/compiled/sequence_line.vg.json

A concise grammar of interactive graphics, built on Vega.
Latest
File
{ "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "Plots a function using a generated sequence.", "background": "white", "padding": 5, "width": 300, "height": 150, "style": "cell", "data": [ { "name": "source_0", "transform": [ {"type": "sequence", "start": 0, "stop": 12.7, "step": 0.1, "as": "x"}, {"type": "formula", "expr": "sin(datum.x)", "as": "sin(x)"} ] } ], "marks": [ { "name": "marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"x\"]"}, "from": {"data": "source_0"}, "encode": { "update": { "stroke": {"value": "#4c78a8"}, "description": { "signal": "\"x: \" + (format(datum[\"x\"], \"\")) + \"; sin(x): \" + (format(datum[\"sin(x)\"], \"\"))" }, "x": {"scale": "x", "field": "x"}, "y": {"scale": "y", "field": "sin(x)"}, "defined": { "signal": "isValid(datum[\"x\"]) && isFinite(+datum[\"x\"]) && isValid(datum[\"sin(x)\"]) && isFinite(+datum[\"sin(x)\"])" } } } } ], "scales": [ { "name": "x", "type": "linear", "domain": {"data": "source_0", "field": "x"}, "range": [0, {"signal": "width"}], "nice": true, "zero": false }, { "name": "y", "type": "linear", "domain": {"data": "source_0", "field": "sin(x)"}, "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": "x", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "sin(x)", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ]}