MCPcopy Index your code
hub / github.com/simstudioai/sim / parseAxisNode

Function parseAxisNode

apps/sim/lib/pptx-renderer/renderer/chart-renderer.ts:1155–1184  ·  view source on GitHub ↗

* Parse a single axis node (c:valAx, c:catAx, or c:dateAx) into AxisInfo.

(ax: SafeXmlNode, ctx: RenderContext)

Source from the content-addressed store, hash-verified

1153 * Parse a single axis node (c:valAx, c:catAx, or c:dateAx) into AxisInfo.
1154 */
1155function parseAxisNode(ax: SafeXmlNode, ctx: RenderContext): AxisInfo {
1156 if (!ax.exists()) return { ...DEFAULT_AXIS_INFO }
1157 const deleted = ax.child('delete').attr('val') === '1'
1158 const tickLblPos = ax.child('tickLblPos').attr('val') || 'nextTo'
1159 const numFmtNode = ax.child('numFmt')
1160 const numFmt = numFmtNode.exists() ? numFmtNode.attr('formatCode') || undefined : undefined
1161 const scaling = ax.child('scaling')
1162 const minNode = scaling.child('min')
1163 const maxNode = scaling.child('max')
1164 const min = minNode.exists() ? Number.parseFloat(minNode.attr('val') || '') : undefined
1165 const max = maxNode.exists() ? Number.parseFloat(maxNode.attr('val') || '') : undefined
1166 const hasMajorGridlines = ax.child('majorGridlines').exists()
1167 const orientation = scaling.child('orientation').attr('val') || 'minMax'
1168 const txStyle = extractTxPrStyle(ax, ctx)
1169 const labelColor = txStyle?.color ?? extractAxisLabelColor(ax, ctx)
1170 const labelFontSize = txStyle?.fontSize
1171 const lineColor = extractAxisLineColor(ax, ctx)
1172 return {
1173 deleted,
1174 tickLblPos,
1175 numFmt: numFmt && numFmt !== 'General' ? numFmt : undefined,
1176 min: min !== undefined && !Number.isNaN(min) ? min : undefined,
1177 max: max !== undefined && !Number.isNaN(max) ? max : undefined,
1178 hasMajorGridlines,
1179 orientation,
1180 labelColor,
1181 labelFontSize,
1182 lineColor,
1183 }
1184}
1185
1186/** Parse value axis and category axis from plotArea. Also checks dateAx as category fallback. */
1187function parseAxes(

Callers 2

parseAxesFunction · 0.85
parseScatterAxesFunction · 0.85

Calls 6

extractTxPrStyleFunction · 0.85
extractAxisLabelColorFunction · 0.85
extractAxisLineColorFunction · 0.85
existsMethod · 0.80
attrMethod · 0.80
childMethod · 0.80

Tested by

no test coverage detected