(chartXml: SafeXmlNode)
| 2501 | } |
| 2502 | |
| 2503 | function parseChartStyleId(chartXml: SafeXmlNode): number | undefined { |
| 2504 | // c:chartSpace > c:style val="N" |
| 2505 | const styleNode = chartXml.child('style') |
| 2506 | const direct = styleNode.numAttr('val') |
| 2507 | if (direct !== undefined) return direct |
| 2508 | |
| 2509 | // Some files use mc:AlternateContent > mc:Choice(c14) > c14:style |
| 2510 | const alt = chartXml.child('AlternateContent') |
| 2511 | if (!alt.exists()) return undefined |
| 2512 | for (const branch of alt.allChildren()) { |
| 2513 | const s = branch.child('style') |
| 2514 | const v = s.numAttr('val') |
| 2515 | if (v !== undefined) return v |
| 2516 | } |
| 2517 | return undefined |
| 2518 | } |
| 2519 | |
| 2520 | function clamp01(v: number): number { |
| 2521 | if (v < 0) return 0 |
no test coverage detected