* Extract a series color from c:ser > c:spPr fill. * Supports solidFill and gradFill (converted to ECharts LinearGradient). * Also checks c:spPr > a:ln > a:solidFill as fallback (used by line/area charts).
(ser: SafeXmlNode, ctx: RenderContext)
| 327 | * Also checks c:spPr > a:ln > a:solidFill as fallback (used by line/area charts). |
| 328 | */ |
| 329 | function extractSeriesColor(ser: SafeXmlNode, ctx: RenderContext): string | object | undefined { |
| 330 | const spPr = ser.child('spPr') |
| 331 | if (!spPr.exists()) return undefined |
| 332 | |
| 333 | // Primary: solid fill |
| 334 | const solidFill = spPr.child('solidFill') |
| 335 | if (solidFill.exists()) { |
| 336 | const hex = resolveColorToHex(solidFill, ctx) |
| 337 | if (hex) return hex |
| 338 | } |
| 339 | |
| 340 | // Gradient fill → ECharts LinearGradient |
| 341 | const gradFill = spPr.child('gradFill') |
| 342 | if (gradFill.exists()) { |
| 343 | const grad = buildEChartsGradient(gradFill, ctx) |
| 344 | if (grad) return grad |
| 345 | } |
| 346 | |
| 347 | // Fallback: line color (used by lineChart, areaChart series) |
| 348 | const ln = spPr.child('ln') |
| 349 | if (ln.exists()) { |
| 350 | const lnFill = ln.child('solidFill') |
| 351 | if (lnFill.exists()) { |
| 352 | const hex = resolveColorToHex(lnFill, ctx) |
| 353 | if (hex) return hex |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | return undefined |
| 358 | } |
| 359 | |
| 360 | function extractSeriesLineWidth(ser: SafeXmlNode): number | undefined { |
| 361 | const lnWidthEmu = ser.child('spPr').child('ln').numAttr('w') |
no test coverage detected