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

Function cloneAxis

packages/sanddance/src/axes.ts:6–19  ·  view source on GitHub ↗
(axes: VegaDeckGl.types.Axis[], axisColor: VegaDeckGl.RGBAColor, axisTextColor: VegaDeckGl.RGBAColor)

Source from the content-addressed store, hash-verified

4import * as VegaDeckGl from '@msrvida/vega-deck.gl';
5
6function cloneAxis(axes: VegaDeckGl.types.Axis[], axisColor: VegaDeckGl.RGBAColor, axisTextColor: VegaDeckGl.RGBAColor) {
7 return axes.map(axis => {
8 const newAxis = VegaDeckGl.util.deepMerge(axis);
9 if (newAxis.domain) {
10 newAxis.domain.color = axisColor;
11 }
12 if (newAxis.title) {
13 newAxis.title.color = axisTextColor;
14 }
15 newAxis.ticks.forEach(t => { t.color = axisColor; });
16 newAxis.tickText.forEach(t => { t.color = axisTextColor; });
17 return newAxis;
18 });
19}
20
21function cloneTextData(textData: VegaDeckGl.types.VegaTextLayerDatum[], color: VegaDeckGl.RGBAColor) {
22 return textData.map(t => {

Callers 1

recolorAxesFunction · 0.70

Calls 1

forEachMethod · 0.45

Tested by

no test coverage detected