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

Function parseDataLabels

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

* Parse c:dLbls (data labels) configuration from a chart type node or series.

(node: SafeXmlNode, ctx: RenderContext)

Source from the content-addressed store, hash-verified

473 * Parse c:dLbls (data labels) configuration from a chart type node or series.
474 */
475function parseDataLabels(node: SafeXmlNode, ctx: RenderContext): DataLabelConfig | undefined {
476 const dLbls = node.child('dLbls')
477 if (!dLbls.exists()) return undefined
478
479 const showVal = parseDlblBool(dLbls, 'showVal')
480 const showCatName = parseDlblBool(dLbls, 'showCatName')
481 const showSerName = parseDlblBool(dLbls, 'showSerName')
482 const showPercent = parseDlblBool(dLbls, 'showPercent')
483 const posNode = dLbls.child('dLblPos')
484 const position = posNode.exists() ? posNode.attr('val') || undefined : undefined
485
486 const txStyle = extractTxPrStyle(dLbls, ctx)
487 const color = txStyle?.color ?? extractTxPrColor(dLbls, ctx)
488 const fontSize = txStyle?.fontSize
489 const bold = txStyle?.bold
490
491 // If nothing is shown, return undefined
492 if (!showVal && !showCatName && !showSerName && !showPercent) return undefined
493
494 return { showVal, showCatName, showSerName, showPercent, position, color, fontSize, bold }
495}
496
497function parseDlblBoolOptional(dLbl: SafeXmlNode, childName: string): boolean | undefined {
498 const el = dLbl.child(childName)

Callers 2

buildBarChartOptionFunction · 0.85
buildPieChartOptionFunction · 0.85

Calls 6

parseDlblBoolFunction · 0.85
extractTxPrStyleFunction · 0.85
extractTxPrColorFunction · 0.85
childMethod · 0.80
existsMethod · 0.80
attrMethod · 0.80

Tested by

no test coverage detected