Module

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

A concise grammar of interactive graphics, built on Vega.
Latest
File
{ "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "Plots two functions 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)"}, {"type": "formula", "expr": "cos(datum.x)", "as": "cos(x)"}, {"type": "fold", "fields": ["sin(x)", "cos(x)"], "as": ["key", "value"]} ] } ], "marks": [ { "name": "pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_main", "data": "source_0", "groupby": ["key"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"x\"]"}, "from": {"data": "faceted_path_main"}, "encode": { "update": { "stroke": {"scale": "color", "field": "key"}, "description": { "signal": "\"x: \" + (format(datum[\"x\"], \"\")) + \"; value: \" + (format(datum[\"value\"], \"\")) + \"; key: \" + (isValid(datum[\"key\"]) ? datum[\"key\"] : \"\"+datum[\"key\"])" }, "x": {"scale": "x", "field": "x"}, "y": {"scale": "y", "field": "value"}, "defined": { "signal": "isValid(datum[\"x\"]) && isFinite(+datum[\"x\"]) && isValid(datum[\"value\"]) && isFinite(+datum[\"value\"])" } } } } ] } ], "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": "value"}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true }, { "name": "color", "type": "ordinal", "domain": {"data": "source_0", "field": "key", "sort": true}, "range": "category" } ], "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": "value", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ], "legends": [{"stroke": "color", "symbolType": "stroke"}]}