* Parse c:dLbls (data labels) configuration from a chart type node or series.
(node: SafeXmlNode, ctx: RenderContext)
| 473 | * Parse c:dLbls (data labels) configuration from a chart type node or series. |
| 474 | */ |
| 475 | function 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 | |
| 497 | function parseDlblBoolOptional(dLbl: SafeXmlNode, childName: string): boolean | undefined { |
| 498 | const el = dLbl.child(childName) |
no test coverage detected