{ "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "Show a line chart corresponding to selected points.", "background": "white", "padding": 5, "width": 300, "data": [ {"name": "pts_store"}, { "name": "source_0", "values": [ { "id": "001", "ra": 243.35, "dec": "+54.6", "lc": [{"time": 1, "mag": 18.5}, {"time": 2, "mag": 19}] }, { "id": "002", "ra": 210.35, "dec": "+14.6", "lc": [{"time": 1, "mag": 19.5}, {"time": 2, "mag": 20}] }, { "id": "003", "ra": 143.35, "dec": "+33.6", "lc": [{"time": 1, "mag": 19}, {"time": 2, "mag": 18}] } ] }, { "name": "data_0", "source": "source_0", "transform": [ {"type": "flatten", "fields": ["lc"], "as": ["lc"]}, { "type": "formula", "expr": "datum[\"lc\"] && datum[\"lc\"][\"time\"]", "as": "lc.time" }, { "type": "formula", "expr": "datum[\"lc\"] && datum[\"lc\"][\"mag\"]", "as": "lc.mag" } ] }, { "name": "data_1", "source": "data_0", "transform": [ { "type": "aggregate", "groupby": ["ra", "dec", "id"], "ops": [], "fields": [], "as": [] }, { "type": "filter", "expr": "isValid(datum[\"ra\"]) && isFinite(+datum[\"ra\"]) && isValid(datum[\"dec\"]) && isFinite(+datum[\"dec\"])" } ] }, { "name": "data_2", "source": "data_0", "transform": [ { "type": "filter", "expr": "!length(data(\"pts_store\")) || vlSelectionTest(\"pts_store\", datum)" } ] } ], "signals": [ {"name": "childHeight", "value": 200}, { "name": "unit", "value": {}, "on": [ {"events": "mousemove", "update": "isTuple(group()) ? group() : unit"} ] }, { "name": "pts", "update": "vlSelectionResolve(\"pts_store\", \"union\", true, true)" } ], "layout": {"padding": 20, "columns": 1, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", "name": "concat_0_group", "title": {"text": "Sky position", "frame": "group"}, "style": "cell", "encode": { "update": { "width": {"signal": "width"}, "height": {"signal": "childHeight"} } }, "signals": [ { "name": "pts_tuple", "on": [ { "events": [{"source": "scope", "type": "click"}], "update": "datum && item().mark.marktype !== 'group' ? {unit: \"concat_0\", fields: pts_tuple_fields, values: [(item().isVoronoi ? datum.datum : datum)[\"id\"]]} : null", "force": true }, { "events": [{"source": "view", "type": "dblclick"}], "update": "null" } ] }, {"name": "pts_tuple_fields", "value": [{"type": "E", "field": "id"}]}, { "name": "pts_toggle", "value": false, "on": [ { "events": [{"source": "scope", "type": "click"}], "update": "event.shiftKey" }, { "events": [{"source": "view", "type": "dblclick"}], "update": "false" } ] }, { "name": "pts_modify", "on": [ { "events": {"signal": "pts_tuple"}, "update": "modify(\"pts_store\", pts_toggle ? null : pts_tuple, pts_toggle ? null : true, pts_toggle ? pts_tuple : null)" } ] } ], "marks": [ { "name": "concat_0_marks", "type": "symbol", "style": ["circle"], "interactive": true, "from": {"data": "data_1"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": [ { "test": "!length(data(\"pts_store\")) || vlSelectionTest(\"pts_store\", datum)", "value": "steelblue" }, {"value": "grey"} ], "ariaRoleDescription": {"value": "circle"}, "description": { "signal": "\"ra: \" + (format(datum[\"ra\"], \"\")) + \"; dec: \" + (format(datum[\"dec\"], \"\"))" }, "x": {"scale": "concat_0_x", "field": "ra"}, "y": {"scale": "concat_0_y", "field": "dec"}, "size": {"value": 100}, "shape": {"value": "circle"} } } } ], "axes": [ { "scale": "concat_0_x", "orient": "bottom", "gridScale": "concat_0_y", "grid": true, "tickCount": {"signal": "ceil(width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "concat_0_y", "orient": "left", "gridScale": "concat_0_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "concat_0_x", "orient": "bottom", "grid": false, "title": "ra", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, { "scale": "concat_0_y", "orient": "left", "grid": false, "title": "dec", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "concat_1_group", "title": {"text": "Light curve", "frame": "group"}, "style": "cell", "encode": { "update": { "width": {"signal": "width"}, "height": {"signal": "childHeight"} } }, "marks": [ { "name": "concat_1_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_concat_1_main", "data": "data_2", "groupby": ["id"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "concat_1_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"lc.time\"]"}, "interactive": false, "from": {"data": "faceted_path_concat_1_main"}, "encode": { "update": { "stroke": {"value": "steelblue"}, "description": { "signal": "\"lc.time: \" + (format(datum[\"lc.time\"], \"\")) + \"; lc.mag: \" + (format(datum[\"lc.mag\"], \"\")) + \"; id: \" + (isValid(datum[\"id\"]) ? datum[\"id\"] : \"\"+datum[\"id\"])" }, "x": {"scale": "concat_1_x", "field": "lc\\.time"}, "y": {"scale": "concat_1_y", "field": "lc\\.mag"}, "defined": { "signal": "isValid(datum[\"lc.time\"]) && isFinite(+datum[\"lc.time\"]) && isValid(datum[\"lc.mag\"]) && isFinite(+datum[\"lc.mag\"])" } } } } ] } ], "axes": [ { "scale": "concat_1_x", "orient": "bottom", "gridScale": "concat_1_y", "grid": true, "tickCount": {"signal": "ceil(width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "concat_1_y", "orient": "left", "gridScale": "concat_1_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "concat_1_x", "orient": "bottom", "grid": false, "title": "lc.time", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, { "scale": "concat_1_y", "orient": "left", "grid": false, "title": "lc.mag", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] } ], "scales": [ { "name": "concat_0_x", "type": "linear", "domain": {"data": "data_1", "field": "ra"}, "range": [0, {"signal": "width"}], "zero": false, "nice": true }, { "name": "concat_0_y", "type": "linear", "domain": {"data": "data_1", "field": "dec"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "concat_1_x", "type": "linear", "domain": {"data": "data_2", "field": "lc\\.time"}, "range": [0, {"signal": "width"}], "zero": false, "nice": true }, { "name": "concat_1_y", "type": "linear", "domain": {"data": "data_2", "field": "lc\\.mag"}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true } ] }