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

Function parseChartStyleId

apps/sim/lib/pptx-renderer/renderer/chart-renderer.ts:2503–2518  ·  view source on GitHub ↗
(chartXml: SafeXmlNode)

Source from the content-addressed store, hash-verified

2501}
2502
2503function 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
2520function clamp01(v: number): number {
2521 if (v < 0) return 0

Callers 1

buildChartPaletteFunction · 0.85

Calls 4

childMethod · 0.80
numAttrMethod · 0.80
existsMethod · 0.80
allChildrenMethod · 0.80

Tested by

no test coverage detected