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

Function createAxis

packages/sanddance-specs/src/axes.ts:127–171  ·  view source on GitHub ↗
(props: AxisProps)

Source from the content-addressed store, hash-verified

125}
126
127function createAxis(props: AxisProps) {
128 const { column, horizontal, labelBaseline, lineColor, scale, showLabels, showTitle, showLines, specViewOptions, title, titlePadding, zindex } = props;
129 const axis: Axis = {
130 zindex,
131 scale: scale.name,
132 orient: horizontal ? 'bottom' : 'left',
133 domain: showLines,
134 ticks: showLines,
135 ...showLines && {
136 domainColor: lineColor,
137 tickColor: lineColor,
138 tickSize: specViewOptions.tickSize,
139 },
140 ...showTitle && {
141 title,
142 titleAlign: horizontal ? 'left' : 'right',
143 titleAngle: {
144 signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY,
145 },
146 titleColor: specViewOptions.colors.axisText,
147 titleFontSize: {
148 signal: SignalNames.TextTitleSize,
149 },
150 titleLimit: axesTitleLimit,
151 titlePadding,
152 },
153 labels: showLabels,
154 ...showLabels && {
155 labelAlign: horizontal ? 'left' : 'right',
156 labelBaseline,
157 labelAngle: {
158 signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY,
159 },
160 labelColor: specViewOptions.colors.axisText,
161 labelFontSize: {
162 signal: SignalNames.TextSize,
163 },
164 labelLimit: axesLabelLimit,
165 },
166 };
167 if (column.quantitative) {
168 axis.format = '~r';
169 }
170 return axis;
171}

Callers 1

addGlobalAxesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected