{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "height": 200, "style": "cell", "data": [ {"name": "pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_store"}, { "name": "user_sessions", "values": [ { "CALC_NAME": "A", "GLOBAL_SESSION_ID": 1, "SESSION_DATE": "2022-12-01" }, { "CALC_NAME": "A", "GLOBAL_SESSION_ID": 2, "SESSION_DATE": "2022-12-01" }, { "CALC_NAME": "A", "GLOBAL_SESSION_ID": 2, "SESSION_DATE": "2022-12-01" }, { "CALC_NAME": "A", "GLOBAL_SESSION_ID": 3, "SESSION_DATE": "2023-01-01" }, { "CALC_NAME": "BB", "GLOBAL_SESSION_ID": 4, "SESSION_DATE": "2022-12-01" }, { "CALC_NAME": "BB", "GLOBAL_SESSION_ID": 4, "SESSION_DATE": "2022-12-01" }, { "CALC_NAME": "BB", "GLOBAL_SESSION_ID": -5, "SESSION_DATE": "2023-01-01" } ] }, { "name": "data_0", "source": "user_sessions", "transform": [ { "type": "formula", "expr": "toDate(datum[\"SESSION_DATE\"])", "as": "SESSION_DATE" } ] }, { "name": "data_1", "source": "data_0", "transform": [ {"type": "filter", "expr": "isValid(datum[\"SESSION_DATE\"])"}, { "field": "SESSION_DATE", "type": "timeunit", "units": ["year", "month", "date"], "timezone": "utc", "as": ["yearmonthdate_SESSION_DATE", "yearmonthdate_SESSION_DATE_end"] }, { "type": "aggregate", "groupby": ["yearmonthdate_SESSION_DATE", "CALC_NAME"], "ops": ["distinct"], "fields": ["GLOBAL_SESSION_ID"], "as": ["distinct_GLOBAL_SESSION_ID"] } ] }, { "name": "data_2", "source": "data_1", "transform": [ { "type": "filter", "expr": "isValid(datum[\"distinct_GLOBAL_SESSION_ID\"]) && isFinite(+datum[\"distinct_GLOBAL_SESSION_ID\"])" } ] }, { "name": "data_3", "source": "data_0", "transform": [ { "field": "SESSION_DATE", "type": "timeunit", "timezone": "utc", "units": ["year", "month", "date"], "as": ["yearmonthdate_SESSION_DATE", "yearmonthdate_SESSION_DATE_end"] }, { "type": "pivot", "field": "CALC_NAME", "value": "GLOBAL_SESSION_ID", "op": "distinct", "groupby": ["yearmonthdate_SESSION_DATE"] } ] }, { "name": "data_4", "source": "data_0", "transform": [ { "type": "aggregate", "groupby": ["CALC_NAME"], "ops": [], "fields": [], "as": [] }, { "type": "window", "params": [null], "as": ["rank"], "ops": ["rank"], "fields": [null], "sort": {"field": [], "order": []} }, {"type": "filter", "expr": "datum.rank <= 21"} ] } ], "signals": [ {"name": "x_step", "value": 100}, {"name": "width", "update": "bandspace(domain('x').length, 0, 0) * x_step"}, { "name": "unit", "value": {}, "on": [ {"events": "mousemove", "update": "isTuple(group()) ? group() : unit"} ] }, { "name": "pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573", "update": "vlSelectionResolve(\"pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_store\", \"union\", true, true)" }, { "name": "pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_tuple", "on": [ { "events": [ { "source": "scope", "type": "mouseover", "markname": "layer_0_layer_1_layer_0_voronoi" } ], "update": "datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0 ? {unit: \"layer_0_layer_1_layer_0\", fields: pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_tuple_fields, values: [(item().isVoronoi ? datum.datum : datum)[\"yearmonthdate_SESSION_DATE\"]]} : null", "force": true }, {"events": [{"source": "view", "type": "mouseout"}], "update": "null"} ] }, { "name": "pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_tuple_fields", "value": [{"type": "E", "field": "yearmonthdate_SESSION_DATE"}] }, { "name": "pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_toggle", "value": false, "on": [ { "events": [ { "source": "scope", "type": "mouseover", "markname": "layer_0_layer_1_layer_0_voronoi" } ], "update": "event.shiftKey" }, {"events": [{"source": "view", "type": "mouseout"}], "update": "false"} ] }, { "name": "pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_modify", "on": [ { "events": { "signal": "pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_tuple" }, "update": "modify(\"pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_store\", pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_toggle ? null : pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_tuple, pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_toggle ? null : true, pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_toggle ? pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_tuple : null)" } ] } ], "marks": [ { "name": "layer_0_layer_0_layer_0_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_layer_0_layer_0_layer_0_main", "data": "data_1", "groupby": ["CALC_NAME"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "layer_0_layer_0_layer_0_marks", "type": "line", "clip": true, "style": ["line"], "sort": {"field": "datum[\"yearmonthdate_SESSION_DATE\"]"}, "interactive": false, "from": {"data": "faceted_path_layer_0_layer_0_layer_0_main"}, "encode": { "update": { "stroke": { "scale": "layer_0_layer_0_color", "field": "CALC_NAME" }, "opacity": {"value": 1}, "description": { "signal": "\"SESSION_DATE (year-month-date): \" + (timeFormat(datum[\"yearmonthdate_SESSION_DATE\"], timeUnitSpecifier([\"year\",\"month\",\"date\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))) + \"; Distinct of GLOBAL_SESSION_ID: \" + (format(datum[\"distinct_GLOBAL_SESSION_ID\"], \"\")) + \"; CALC_NAME: \" + (isValid(datum[\"CALC_NAME\"]) ? datum[\"CALC_NAME\"] : \"\"+datum[\"CALC_NAME\"])" }, "x": { "scale": "x", "field": "yearmonthdate_SESSION_DATE", "band": 0.5 }, "y": {"scale": "y", "field": "distinct_GLOBAL_SESSION_ID"}, "defined": { "signal": "isValid(datum[\"distinct_GLOBAL_SESSION_ID\"]) && isFinite(+datum[\"distinct_GLOBAL_SESSION_ID\"])" } } } } ] }, { "name": "layer_0_layer_0_layer_1_marks", "type": "symbol", "clip": true, "style": ["point"], "interactive": false, "from": {"data": "data_2"}, "encode": { "update": { "fill": {"value": "transparent"}, "stroke": {"scale": "layer_0_layer_0_color", "field": "CALC_NAME"}, "opacity": [ { "test": "length(data(\"pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_store\")) && vlSelectionTest(\"pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_store\", datum)", "value": 1 }, {"value": 0} ], "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"SESSION_DATE (year-month-date): \" + (timeFormat(datum[\"yearmonthdate_SESSION_DATE\"], timeUnitSpecifier([\"year\",\"month\",\"date\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))) + \"; Distinct of GLOBAL_SESSION_ID: \" + (format(datum[\"distinct_GLOBAL_SESSION_ID\"], \"\")) + \"; CALC_NAME: \" + (isValid(datum[\"CALC_NAME\"]) ? datum[\"CALC_NAME\"] : \"\"+datum[\"CALC_NAME\"])" }, "x": { "scale": "x", "field": "yearmonthdate_SESSION_DATE", "band": 0.5 }, "y": {"scale": "y", "field": "distinct_GLOBAL_SESSION_ID"}, "size": {"value": 80} } } }, { "name": "layer_0_layer_1_layer_0_marks", "type": "rule", "clip": true, "style": ["rule"], "interactive": true, "from": {"data": "data_3"}, "encode": { "update": { "stroke": {"value": "CHART_DEFAULT_RULE_COLOR_MARKER"}, "opacity": [ { "test": "length(data(\"pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_store\")) && vlSelectionTest(\"pivot_hover_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_store\", datum)", "value": 0.3 }, {"value": 0} ], "tooltip": { "signal": "{\"SESSION_DATE (year-month-date)\": timeFormat(datum[\"yearmonthdate_SESSION_DATE\"], timeUnitSpecifier([\"year\",\"month\",\"date\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))}" }, "description": { "signal": "\"SESSION_DATE (year-month-date): \" + (timeFormat(datum[\"yearmonthdate_SESSION_DATE\"], timeUnitSpecifier([\"year\",\"month\",\"date\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})))" }, "x": { "scale": "x", "field": "yearmonthdate_SESSION_DATE", "band": 0.5 }, "y": {"value": 0}, "y2": {"field": {"group": "height"}} } } }, { "name": "layer_0_layer_1_layer_0_voronoi", "type": "path", "interactive": true, "from": {"data": "layer_0_layer_1_layer_0_marks"}, "encode": { "update": { "fill": {"value": "transparent"}, "strokeWidth": {"value": 0.35}, "stroke": {"value": "transparent"}, "isVoronoi": {"value": true}, "tooltip": { "signal": "{\"SESSION_DATE (year-month-date)\": timeFormat(datum.datum[\"yearmonthdate_SESSION_DATE\"], timeUnitSpecifier([\"year\",\"month\",\"date\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))}" } } }, "transform": [ { "type": "voronoi", "x": {"expr": "datum.datum.x || 0"}, "y": {"expr": "datum.datum.y || 0"}, "size": [{"signal": "width"}, {"signal": "height"}] } ] }, { "name": "aggregate_color_spec_3eb8ffb8_6f35_4e9d_93f2_512f1caca573_marks", "type": "rule", "clip": true, "style": ["rule"], "interactive": false, "from": {"data": "data_4"}, "encode": {"update": {}} } ], "scales": [ { "name": "x", "type": "band", "domain": { "fields": [ {"data": "data_1", "field": "yearmonthdate_SESSION_DATE"}, {"data": "data_2", "field": "yearmonthdate_SESSION_DATE"}, {"data": "data_3", "field": "yearmonthdate_SESSION_DATE"} ], "sort": true }, "range": {"step": {"signal": "x_step"}}, "paddingInner": 0, "paddingOuter": 0 }, { "name": "y", "type": "linear", "domain": { "fields": [ {"data": "data_1", "field": "distinct_GLOBAL_SESSION_ID"}, {"data": "data_2", "field": "distinct_GLOBAL_SESSION_ID"} ] }, "range": [{"signal": "height"}, 0], "nice": true, "zero": true }, { "name": "layer_0_layer_0_color", "type": "ordinal", "domain": { "fields": [ {"data": "data_1", "field": "CALC_NAME"}, {"data": "data_2", "field": "CALC_NAME"} ], "sort": true }, "range": [ "#2c90ed", "#fc632a", "#585858", "#4cd964", "#b9e09b", "#a50fa9", "#f7daf6", "#553096", "#72e5ef", "#871d32", "#1c9820", "#f53176", "#658114", "#f989a4", "#04a38f", "#18519b", "#eb67f9", "#e8ea35", "#562fff", "#a77ae9" ] } ], "axes": [ { "scale": "x", "orient": "bottom", "grid": true, "gridScale": "y", "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": true, "gridScale": "x", "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": "SESSION_DATE (year-month-date)", "labels": true, "ticks": true, "format": { "signal": "timeUnitSpecifier([\"year\",\"month\",\"date\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" }, "formatType": "time", "labelOverlap": true, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "Distinct of GLOBAL_SESSION_ID", "labels": true, "ticks": true, "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ], "legends": [ { "symbolOpacity": 1, "symbolType": "stroke", "stroke": "layer_0_layer_0_color", "title": "CALC_NAME", "encode": {"symbols": {"update": {"fill": {"value": "transparent"}}}} } ], "config": {"legend": {"orient": "right"}}, "usermeta": {"selectionConfigs": {}} }