MCPcopy Create free account
hub / github.com/microsoft/SandDance / getSelectedColorMap

Function getSelectedColorMap

docs/tests/v2/es6/js/sanddance.js:148241–148272  ·  view source on GitHub ↗
(currentData, showSelectedData, showActive, viewerOptions)

Source from the content-addressed store, hash-verified

148239// Copyright (c) Microsoft Corporation. All rights reserved.
148240// Licensed under the MIT license.
148241function getSelectedColorMap(currentData, showSelectedData, showActive, viewerOptions) {
148242 function getSelectionColorItem(datum) {
148243 let item;
148244
148245 if (showSelectedData) {
148246 item = datum[_constants.FieldNames.Selected] ? {
148247 color: viewerOptions.colors.selectedCube
148248 } : {
148249 unSelected: true
148250 };
148251 }
148252
148253 if (showActive && datum[_constants.FieldNames.Active]) {
148254 item = {
148255 color: viewerOptions.colors.activeCube
148256 };
148257 }
148258
148259 return item;
148260 }
148261
148262 const colorMap = {};
148263 currentData.forEach(datum => {
148264 const selectionColor = getSelectionColorItem(datum);
148265
148266 if (selectionColor) {
148267 const ordinal = datum[VegaDeckGl.constants.GL_ORDINAL];
148268 colorMap[ordinal] = selectionColor;
148269 }
148270 });
148271 return colorMap;
148272}
148273
148274function colorMapFromCubes(cubes) {
148275 const map = {};

Callers

nothing calls this directly

Calls 2

getSelectionColorItemFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected