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

Function parseChartNode

apps/sim/lib/pptx-renderer/model/nodes/chart-node.ts:21–55  ·  view source on GitHub ↗
(
  graphicFrame: SafeXmlNode,
  slideRels: Map<string, RelEntry>,
  slidePath: string
)

Source from the content-addressed store, hash-verified

19 * @param slidePath Full path of the slide (e.g. "ppt/slides/slide1.xml")
20 */
21export function parseChartNode(
22 graphicFrame: SafeXmlNode,
23 slideRels: Map<string, RelEntry>,
24 slidePath: string
25): ChartNodeData | undefined {
26 const base = parseBaseProps(graphicFrame)
27
28 // Find chart relationship
29 const graphic = graphicFrame.child('graphic')
30 const graphicData = graphic.child('graphicData')
31
32 // Find the chart reference - look for c:chart element with r:id
33 let chartRId: string | undefined
34 for (const child of graphicData.allChildren()) {
35 if (child.localName === 'chart') {
36 chartRId = child.attr('r:id') || child.attr('id')
37 break
38 }
39 }
40
41 if (!chartRId) return undefined
42
43 const rel = slideRels.get(chartRId)
44 if (!rel) return undefined
45
46 // Resolve chart path relative to slide
47 const slideDir = slidePath.substring(0, slidePath.lastIndexOf('/'))
48 const chartPath = resolveRelTarget(slideDir, rel.target)
49
50 return {
51 ...base,
52 nodeType: 'chart' as const,
53 chartPath,
54 }
55}

Callers 2

parseGroupChildFunction · 0.90
parseChildNodeFunction · 0.90

Calls 6

parseBasePropsFunction · 0.90
resolveRelTargetFunction · 0.90
childMethod · 0.80
allChildrenMethod · 0.80
attrMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected