MCPcopy Index your code
hub / github.com/microsoft/SandDance / axisSelectionLayer

Function axisSelectionLayer

docs/app/js/sanddance-app.js:10116–10157  ·  view source on GitHub ↗
(presenter, specCapabilities, columns, stage, clickHandler, highlightColor, polygonZ)

Source from the content-addressed store, hash-verified

10114var _sanddanceSpecs = require("@msrvida/sanddance-specs");
10115var _vegaDeckGl = require("@msrvida/vega-deck.gl");
10116function axisSelectionLayer(presenter, specCapabilities, columns, stage, clickHandler, highlightColor, polygonZ) {
10117 const polygons = [];
10118 const xRole = specCapabilities.roles.filter((r)=>r.role === "x")[0];
10119 if (xRole && xRole.axisSelection) stage.axes.x.filter((axis)=>axis.tickText.length).forEach((axis)=>{
10120 polygons.push.apply(polygons, axisSelectionPolygons(axis, false, xRole.axisSelection, columns.x));
10121 });
10122 const yRole = specCapabilities.roles.filter((r)=>r.role === "y")[0];
10123 if (yRole && yRole.axisSelection) stage.axes.y.filter((axis)=>axis.tickText.length).forEach((axis)=>{
10124 polygons.push.apply(polygons, axisSelectionPolygons(axis, true, yRole.axisSelection, columns.y));
10125 });
10126 if (stage.facets && columns.facet) polygons.push.apply(polygons, facetSelectionPolygons(stage.facets));
10127 //move polygons to Z
10128 polygons.forEach((datum)=>{
10129 datum.polygon.forEach((p)=>{
10130 p[2] = polygonZ;
10131 });
10132 });
10133 const onClick = (o, e)=>clickHandler(e.srcEvent, o.object.search);
10134 const polygonLayer = new _vegaDeckGl.base.layers.PolygonLayer({
10135 autoHighlight: true,
10136 coordinateSystem: _vegaDeckGl.base.deck.COORDINATE_SYSTEM.CARTESIAN,
10137 data: polygons,
10138 extruded: false,
10139 highlightColor: _vegaDeckGl.util.colorFromString(highlightColor),
10140 id: "selections",
10141 onHover: (o, e)=>{
10142 if (o.index === -1) presenter.deckgl.interactiveState.onAxisSelection = false;
10143 else presenter.deckgl.interactiveState.onAxisSelection = true;
10144 },
10145 onClick,
10146 getElevation: ()=>0,
10147 getFillColor: ()=>[
10148 0,
10149 0,
10150 0,
10151 0
10152 ],
10153 pickable: true,
10154 stroked: false
10155 });
10156 return polygonLayer;
10157}
10158function axisSelectionPolygons(axis, vertical, axisSelectionType, column) {
10159 const polygons = [];
10160 const size = 50;

Callers

nothing calls this directly

Calls 4

axisSelectionPolygonsFunction · 0.70
facetSelectionPolygonsFunction · 0.70
filterMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected