* Parse a single axis node (c:valAx, c:catAx, or c:dateAx) into AxisInfo.
(ax: SafeXmlNode, ctx: RenderContext)
| 1153 | * Parse a single axis node (c:valAx, c:catAx, or c:dateAx) into AxisInfo. |
| 1154 | */ |
| 1155 | function 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. */ |
| 1187 | function parseAxes( |
no test coverage detected