@oicl/openbridge-webcomponents 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"polar-chart.js","names":[],"sources":["../../../src/bars-graphs/polar-chart/polar-chart.ts"],"sourcesContent":["import {LitElement, PropertyValues, html, unsafeCSS} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport componentStyle from './polar-chart.css?inline';\nimport chartCommonStyle from '../../charthelpers/chart-common.css?inline';\nimport chartDebugStyle from '../../charthelpers/chart-debug.css?inline';\nimport chartLegendStyle from '../../charthelpers/chart-legend.css?inline';\nimport {customElement} from '../../decorator.js';\nimport {Priority} from '../../navigation-instruments/types.js';\nimport {\n Chart,\n PolarAreaController,\n RadialLinearScale,\n ArcElement,\n Tooltip,\n} from 'chart.js';\nimport type {Plugin, ChartOptions, Chart as ChartInstance} from 'chart.js';\nimport type {RadialLinearScale as RadialLinearScaleType} from 'chart.js';\nimport {\n CHART_SECTOR_DEFAULT_COLORS,\n CHART_SECTOR_ENHANCED_COLORS,\n CHART_DIMENSIONS,\n getCssVariableValue,\n getChartColorsOrDefault,\n observeThemeChanges,\n createArcOuterLabelPlugin,\n calculateFixedHeightChartLayout,\n getChartTooltipOptions,\n formatChartNumber,\n generateLegendHTML,\n observeLabelThreshold,\n} from '../../charthelpers/index.js';\nimport type {FixedHeightChartDimensions} from '../../charthelpers/canvas-layout.js';\n\ntype PolarScale = RadialLinearScaleType & {\n xCenter: number;\n yCenter: number;\n drawingArea: number;\n};\n\n// Register Chart.js components\nChart.register(PolarAreaController, RadialLinearScale, ArcElement, Tooltip);\n\n// Polar-specific dimension constants\nconst POLAR_BAR_DIMENSIONS = {\n ...CHART_DIMENSIONS,\n GAP_AND_BORDER_COLOR: '--instrument-frame-tertiary-color',\n} as const;\n\n// Properties that require chart recreation (destroy and create)\nconst POLAR_RECREATE_PROP_NAMES = [\n 'showOuterLabels',\n 'outerLabelUnit',\n 'outerLabelMaxLength',\n 'outerLabelDecimalPlaces',\n 'showSectorLabels',\n 'discreteColorStops',\n 'showDebugOverlay',\n 'fixedHeight',\n 'showUnit',\n] as const;\n\n// All properties that trigger chart updates\nconst POLAR_WATCHED_PROP_NAMES = [\n 'legend',\n 'data',\n 'colors',\n 'priority',\n 'monochrome',\n 'discreteColorStops',\n 'showSectorLabels',\n 'showOuterLabels',\n 'outerLabelUnit',\n 'outerLabelMaxLength',\n 'outerLabelDecimalPlaces',\n 'showDebugOverlay',\n 'fixedHeight',\n 'showUnit',\n] as const;\n\nexport type PolarChartDataItem = {\n label: string;\n value: number;\n};\n\n/**\n * `<obc-polar-chart>` – A customizable polar area chart component for visualizing proportional data as sectors, with optional outer labels, angle display, and discrete color bands.\n *\n * This component renders an interactive polar area chart powered by Chart.js, displaying data segments as radial sectors with optional outer labels, angle display, and discrete color bands. It supports customizable colors, monochrome mode, and adapts its layout based on available space. Labels are hidden when the chart is too small (< 192px height), ensuring clarity at all sizes.\n *\n * ## Features\n * - **Fixed Height ⇒ Fixed Circumference:** The chart's circumference is determined by the `fixedHeight` property (default: 320px). This ensures the chart's circumference remains consistent and matches other radial instruments, regardless of the available browser or container width. The chart does not scale to fill the width; instead, it always uses the specified fixed height to define its size and circumference.\n * - **Layout:**\n * - Full 360° polar area chart layout.\n * - **Outer Labels:**\n * - Optional labels positioned outside the chart showing sector names or angles.\n * - Supports percentage or custom units (e.g., \"kW\", \"kg\", \"MB\").\n * - Configurable decimal places and maximum label length (with trimming).\n * - Option to display angles (0°, 30°, etc.) instead of sector names.\n * - **Discrete Color Bands:**\n * - Draw sectors as radial color bands from center outward using the colors array as threshold steps.\n * - Option to trim sectors to the nearest color band boundary or show exact values with partial band fills.\n * - **Customization:**\n * - Custom segment colors (with automatic fallback to theme palette).\n * - Monochrome mode for single-color charts.\n * - Adjustable outer label formatting and units.\n * - **Color Priority:** Set `priority` to `Priority.enhanced` to use the blue/enhanced\n * color palette instead of the default gray/regular palette (default: `Priority.regular`).\n * - **Responsive Behavior:**\n * - Automatically hides labels when height < 192px.\n * - Maintains aspect ratio and adjusts padding for optimal label positioning.\n * - **Theme Integration:**\n * - Colors update automatically when the `data-obc-theme` attribute changes on the `<html>` element.\n * - Example:\n * ```html\n * <html lang=\"en\" data-obc-theme=\"day\"></html>\n * ```\n *\n * ## Example\n *\n * **Basic Usage**\n * ```html\n * <obc-polar-chart></obc-polar-chart>\n * <script>\n * document.querySelector('obc-polar-chart').data = [\n * {label: 'Sector A', value: 33},\n * {label: 'Sector B', value: 22},\n * {label: 'Sector C', value: 45}\n * ];\n * </script>\n * ```\n *\n * **With Discrete Color Bands**\n * ```html\n * <obc-polar-chart></obc-polar-chart>\n * <script>\n * const chart = document.querySelector('obc-polar-chart');\n * chart.discreteColorStops = true;\n * chart.data = [\n * {label: 'A', value: 50},\n * {label: 'B', value: 30},\n * {label: 'C', value: 20}\n * ];\n * </script>\n * ```\n *\n * **Custom Colors and Angle Labels**\n * ```html\n * <obc-polar-chart></obc-polar-chart>\n * <script>\n * const chart = document.querySelector('obc-polar-chart');\n * chart.showSectorLabels = true;\n * chart.outerLabelUnit = '°';\n * chart.outerLabelDecimalPlaces = 0;\n * chart.data = [\n * {label: 'A', value: 20},\n * {label: 'B', value: 35},\n * {label: 'C', value: 45}\n * ];\n * chart.colors = ['#e74c3c', '#f39c12', '#2ecc71'];\n * </script>\n * ```\n *\n * @property data - Chart data segments (set via JavaScript)\n * @property colors - Custom segment colors (set via JavaScript) with fallback to theme palette\n * @property monochrome - Use single color for all sectors (uses first color from array, default: false)\n * @availableWhen monochrome discreteColorStops==false\n * @property discreteColorStops - Draw sectors as radial color bands from center outward using the colors array as threshold steps (default: false)\n * @property showSectorLabels - When true, display sector labels from data (e.g. \"Sector A\"). When false, display angle values (0°, 30°, etc.). Default: false\n * @property showUnit - Whether to show unit in angle or outer labels, default: false\n * @property showOuterLabels - Show outer labels, default: false\n * @property outerLabelUnit - Unit string to append to outer labels, default: \"°\"\n * @property outerLabelMaxLength - Maximum character length for labels before trim (0 = no limit), default: 0\n * @availableWhen outerLabelMaxLength showOuterLabels==true\n * @property outerLabelDecimalPlaces - Number of decimal places in labels, default: 0\n * @property fixedHeight - Fixed height of the chart in pixels (determines chart circumference), default: 320. The chart's circumference is always based on this fixed height to match other radial instruments.\n * @property legend - Whether to display the legend below the chart, default: false\n * @property showDebugOverlay - Show debug overlay for development, default: false\n * @beta\n */\n@customElement('obc-polar-chart')\nexport class ObcPolarChart extends LitElement {\n @property({type: Array, attribute: false})\n data: PolarChartDataItem[] = [];\n\n @property({type: Array, attribute: false}) colors: string[] = [];\n\n /** @internal */\n private centerFirstSector = false; // When false, first sector is centered at 12 o'clock position\n\n @property({type: String})\n priority: Priority = Priority.regular;\n\n @property({type: Boolean}) monochrome = false;\n @property({type: Boolean})\n discreteColorStops = false;\n @property({type: Boolean})\n showSectorLabels = false; // Default: false (angles shown by default)\n @property({type: Boolean})\n showUnit = false;\n @property({type: Boolean})\n showOuterLabels = false;\n @property({type: String})\n outerLabelUnit = '°';\n @property({type: Number})\n outerLabelMaxLength = 0;\n @property({type: Number})\n outerLabelDecimalPlaces = 0;\n\n @property({type: Number, reflect: true})\n fixedHeight = 320;\n\n @property({type: Boolean, reflect: true})\n legend = false;\n\n @property({type: Boolean, reflect: true})\n showDebugOverlay = false;\n\n /** @internal - Pre-formatted labels for outer label rendering */\n @state()\n private formattedLabels: string[] = [];\n\n /** @internal - Calculated chart diameter from layout helper */\n private calculatedChartDiameter: number = CHART_DIMENSIONS.CHART_WIDTH;\n\n /** @internal */\n @query('canvas') private canvasEl!: HTMLCanvasElement;\n\n /** @internal */\n @query('.legend') private legendDiv?: HTMLDivElement;\n\n /** @internal */\n private chart?: Chart;\n\n /** @internal - Latest layout dimensions computed by getChartOptions() */\n private lastDimensions?: FixedHeightChartDimensions;\n\n /** @internal */\n private themeObserver?: MutationObserver;\n\n /** @internal - ResizeObserver for tracking height threshold crossings */\n private resizeObserver?: ResizeObserver;\n\n private hasAnyChanged(\n changed: PropertyValues,\n props: readonly (keyof ObcPolarChart)[]\n ): boolean {\n return props.some((prop) => changed.has(prop));\n }\n\n // Update external library AFTER render\n override updated(changed: PropertyValues) {\n super.updated(changed);\n\n if (this.hasAnyChanged(changed, POLAR_WATCHED_PROP_NAMES)) {\n // Recreate chart when major layout properties change or when plugin configuration changes\n // These properties affect aspect ratio calculation, plugin registration, or outer label rendering\n const needsRecreation = this.hasAnyChanged(\n changed,\n POLAR_RECREATE_PROP_NAMES\n );\n\n if (needsRecreation) {\n this.chart?.destroy();\n this.createChart();\n } else {\n this.updateChart();\n }\n }\n }\n\n override firstUpdated() {\n this.createChart();\n this.themeObserver = observeThemeChanges(() => this.updateChart());\n this.setupResizeObserver();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.chart?.destroy();\n this.themeObserver?.disconnect();\n this.resizeObserver?.disconnect();\n }\n\n /**\n * Crossing MIN_HEIGHT_WITH_LABELS changes the plugin set, so the chart is\n * rebuilt rather than updated.\n */\n private setupResizeObserver() {\n if (!this.canvasEl) return;\n\n this.resizeObserver = observeLabelThreshold(\n this.canvasEl,\n () =>\n (this.canvasEl?.clientHeight ?? 0) >=\n CHART_DIMENSIONS.MIN_HEIGHT_WITH_LABELS,\n {\n rebuild: () => {\n this.chart?.destroy();\n this.createChart();\n },\n update: () => this.updateChart(),\n }\n );\n }\n\n private prepareChartData() {\n const values = this.data.map((d) => d.value);\n const labels = this.data.map((d) => d.label);\n const chartColors = getChartColorsOrDefault(\n this,\n this.colors,\n this.priority === Priority.enhanced\n ? CHART_SECTOR_ENHANCED_COLORS\n : CHART_SECTOR_DEFAULT_COLORS\n );\n\n // When using discrete color stops, sectors will be drawn by the plugin\n // so we can use transparent colors for the main dataset\n const segmentColors = this.discreteColorStops\n ? values.map(() => 'transparent')\n : values.map((_, index) =>\n this.monochrome\n ? chartColors[0]\n : chartColors[index % chartColors.length]\n );\n\n // Generate labels based on showSectorLabels property\n const numSectors = this.data.length;\n const displayLabels = this.showSectorLabels\n ? labels\n : Array.from({length: numSectors}, (_, i) => {\n const angle = (i * 360) / numSectors;\n return `${angle}`;\n });\n\n return {\n values,\n labels,\n colors: segmentColors,\n chartColors, // Pass resolved colors for use in plugin\n displayLabels,\n };\n }\n\n private getLayoutConfig() {\n // For polar, use actual data labels and values when showSectorLabels is true, otherwise use angle values\n return {\n unit: this.outerLabelUnit,\n showUnit: this.showUnit,\n outerLabelMaxLength: this.outerLabelMaxLength,\n decimalPlaces: this.outerLabelDecimalPlaces,\n data: this.showSectorLabels\n ? this.data\n : Array.from({length: this.data.length}, (_, i) => ({\n label: '',\n value: (i * 360) / this.data.length,\n })),\n denominator: this.showSectorLabels ? 1 : 360,\n };\n }\n\n private getChartOptions(): ChartOptions<'polarArea'> {\n // Use centralized layout calculation helper for all dimensions and label measurement\n const dimensions = calculateFixedHeightChartLayout({\n fixedHeight: this.fixedHeight,\n isHalfMode: false,\n showOuterLabels: this.showOuterLabels,\n canvasEl: this.canvasEl,\n layoutConfig: this.getLayoutConfig(),\n host: this,\n });\n\n // Store dimensions for explicit canvas sizing in createChart/updateChart\n this.lastDimensions = dimensions;\n\n // Store chart diameter for plugin use\n this.calculatedChartDiameter = dimensions.chartDiameter;\n this.formattedLabels = dimensions.formattedLabels;\n\n // Set CSS variables for chart dimensions\n this.style.setProperty('--chart-width', `${dimensions.calculatedWidth}px`);\n this.style.setProperty('--chart-height', `${dimensions.actualHeight}px`);\n\n // Calculate dynamic padding for Chart.js layout\n const dynamicPadding = dimensions.isTooSmall\n ? {top: 0, right: 0, bottom: 0, left: 0}\n : {\n top: dimensions.topPadding,\n right: dimensions.rightPadding,\n bottom: dimensions.bottomPadding,\n left: dimensions.leftPadding,\n };\n\n // Set number of ticks to match color bands when discrete stops enabled\n const chartColors = getChartColorsOrDefault(\n this,\n this.colors,\n CHART_SECTOR_DEFAULT_COLORS\n );\n const numTicks = this.discreteColorStops ? chartColors.length + 1 : 6;\n\n // Find max value for scaling\n const maxValue = Math.max(...this.data.map((d) => d.value), 100);\n\n // Calculate rotation to center first label at 12 o'clock if enabled\n const numSectors = this.data.length;\n const anglePerSector = 360 / numSectors;\n const startAngle = this.centerFirstSector ? 0 : -anglePerSector / 2;\n\n return {\n // Chart.js responsive mode stays off — see the note in donut-chart.ts (#1061).\n responsive: false,\n maintainAspectRatio: false,\n devicePixelRatio: window.devicePixelRatio,\n layout: {\n padding: dynamicPadding ?? POLAR_BAR_DIMENSIONS.CANVAS_PADDING,\n },\n scales: {\n r: {\n startAngle: startAngle,\n angleLines: {\n display: true,\n color: getCssVariableValue(\n this,\n POLAR_BAR_DIMENSIONS.GAP_AND_BORDER_COLOR\n ),\n lineWidth: 1,\n },\n grid: {\n display: true,\n color: getCssVariableValue(\n this,\n POLAR_BAR_DIMENSIONS.GAP_AND_BORDER_COLOR\n ),\n lineWidth: 1,\n },\n pointLabels: {\n // Always disable Chart.js built-in labels - we use our own outer label plugin\n display: false,\n },\n ticks: {\n display: false,\n stepSize: maxValue / (numTicks - 1),\n count: numTicks,\n },\n max: maxValue,\n },\n },\n plugins: {\n legend: {\n display: false,\n labels: {\n generateLabels: () => [], // Prevent Chart.js from generating labels internally\n },\n onClick: () => {}, // Disable legend click handler\n },\n tooltip: {\n ...getChartTooltipOptions(this),\n enabled: !dimensions.isTooSmall,\n callbacks: {\n title: () => '', // No title line\n label: (context) => {\n // Always show the data label and value, no unit\n const dataIndex = context.dataIndex;\n const data = this.data?.[dataIndex];\n const label = data?.label ?? '';\n const value =\n typeof data?.value === 'number'\n ? data.value\n : Number(data?.value);\n return `${label} ${value}`;\n },\n },\n },\n },\n animation: false,\n };\n }\n\n private createDiscreteColorPlugin(): Plugin<'polarArea'> {\n return {\n id: 'discreteColors',\n beforeDatasetsDraw: (chart: ChartInstance<'polarArea'>) => {\n if (!this.discreteColorStops) return;\n\n const {ctx, scales} = chart;\n const scale = scales.r as PolarScale | undefined;\n if (!scale) return;\n\n const centerX = scale.xCenter;\n const centerY = scale.yCenter;\n // Use calculated chart diameter to ensure consistency with layout\n const maxRadius = this.calculatedChartDiameter / 2;\n const numSectors = this.data.length;\n const anglePerSector = (Math.PI * 2) / numSectors;\n const rotationOffset = this.centerFirstSector ? 0 : -anglePerSector / 2;\n\n // Get resolved colors for creating discrete bands\n const chartColors = getChartColorsOrDefault(\n this,\n this.colors,\n this.priority === Priority.enhanced\n ? CHART_SECTOR_ENHANCED_COLORS\n : CHART_SECTOR_DEFAULT_COLORS\n );\n const numBands = chartColors.length;\n\n // Find max value for scaling\n const maxValue = Math.max(...this.data.map((d) => d.value), 100);\n\n // Generate threshold stops from the colors array (reversed)\n // Divide maxValue into equal bands based on number of colors\n const colorStops = chartColors.reverse().map((color, index) => ({\n threshold: ((index + 1) / numBands) * maxValue,\n color,\n }));\n\n ctx.save();\n\n // Draw each sector with discrete color bands\n this.data.forEach((dataPoint, sectorIndex) => {\n const sectorValue = dataPoint.value;\n const startAngle =\n sectorIndex * anglePerSector + rotationOffset - Math.PI / 2;\n const endAngle = startAngle + anglePerSector;\n\n // Draw color bands from center outward\n let previousRadius = 0;\n\n colorStops.forEach((stop) => {\n // Calculate radius for this threshold\n const thresholdRadius = (stop.threshold / maxValue) * maxRadius;\n const sectorRadiusLimit = (sectorValue / maxValue) * maxRadius;\n\n // Determine the outer radius for this band\n let drawRadius;\n if (sectorRadiusLimit <= thresholdRadius) {\n // Sector value is within or below this band - draw up to sector value\n drawRadius = sectorRadiusLimit;\n } else {\n // Sector value exceeds this band - fill band completely to threshold\n drawRadius = thresholdRadius;\n }\n\n // Draw the arc segment for this color band\n if (drawRadius > previousRadius) {\n ctx.fillStyle = stop.color;\n ctx.beginPath();\n ctx.arc(centerX, centerY, drawRadius, startAngle, endAngle);\n if (previousRadius > 0) {\n ctx.arc(\n centerX,\n centerY,\n previousRadius,\n endAngle,\n startAngle,\n true\n );\n } else {\n ctx.lineTo(centerX, centerY);\n }\n ctx.closePath();\n ctx.fill();\n }\n\n previousRadius = drawRadius;\n\n // Stop if we've reached the sector's value limit\n if (sectorRadiusLimit <= thresholdRadius) {\n return;\n }\n });\n });\n\n ctx.restore();\n },\n };\n }\n\n private createChart() {\n // Guard: Verify canvas exists and is connected to DOM\n if (!this.canvasEl || !this.canvasEl.isConnected) return;\n\n const ctx = this.canvasEl.getContext('2d');\n if (!ctx) return;\n\n const {values, colors, displayLabels} = this.prepareChartData();\n\n const plugins: Plugin<'polarArea'>[] = [];\n\n // Add discrete color plugin if enabled\n if (this.discreteColorStops) {\n plugins.push(this.createDiscreteColorPlugin());\n }\n\n // Get chart options (this will populate formattedLabels and check dimensions)\n const chartOptions = this.getChartOptions();\n\n // Non-responsive mode: set the canvas render size explicitly from the\n // computed layout; Chart.js applies devicePixelRatio scaling on top\n if (this.lastDimensions) {\n this.canvasEl.width = this.lastDimensions.calculatedWidth;\n this.canvasEl.height = this.lastDimensions.actualHeight;\n }\n\n // Only add outer labels plugin if enabled AND canvas is large enough\n // formattedLabels will be empty if too small or outer labels disabled\n if (this.showOuterLabels && this.formattedLabels.length > 0) {\n const numSectors = values.length;\n const anglePerSector = (Math.PI * 2) / (numSectors || 1);\n const rotationOffset = this.centerFirstSector ? 0 : -anglePerSector / 2;\n plugins.push(\n createArcOuterLabelPlugin(this, {\n formattedLabels: this.formattedLabels.slice(0, numSectors),\n rotationOffset,\n chartDiameter: this.calculatedChartDiameter,\n type: 'polar',\n })\n );\n }\n\n this.chart = new Chart(ctx, {\n type: 'polarArea',\n data: {\n labels: displayLabels, // Use angle labels or sector labels based on showSectorLabels\n datasets: [\n {\n data: values,\n backgroundColor: colors,\n borderWidth: 1,\n borderColor: getCssVariableValue(\n this,\n POLAR_BAR_DIMENSIONS.GAP_AND_BORDER_COLOR\n ),\n },\n ],\n },\n options: chartOptions,\n plugins,\n });\n\n // Defer legend update to next tick to ensure Chart.js metadata is initialized\n requestAnimationFrame(() => this.updateLegend());\n }\n\n private updateChart() {\n // Guard: Verify chart and canvas still exist and are connected\n if (!this.chart || !this.canvasEl || !this.canvasEl.isConnected) return;\n\n const {values, colors, displayLabels} = this.prepareChartData();\n\n this.chart.data.labels = displayLabels;\n if (this.chart.data.datasets[0]) {\n this.chart.data.datasets[0].data = values;\n this.chart.data.datasets[0].backgroundColor = colors;\n }\n\n const latestOptions = this.getChartOptions();\n if (this.chart.options) {\n Object.assign(this.chart.options, latestOptions);\n }\n\n // Non-responsive mode: apply the computed layout size explicitly\n // (no-op when the size is unchanged)\n if (this.lastDimensions) {\n this.chart.resize(\n this.lastDimensions.calculatedWidth,\n this.lastDimensions.actualHeight\n );\n }\n\n this.chart.update();\n\n // Update legend after chart update completes to ensure metadata is ready\n requestAnimationFrame(() => this.updateLegend());\n }\n\n /**\n * Update the legend HTML content\n */\n private updateLegend() {\n // Guard: Check if legend should be shown and chart is ready\n if (!this.legend || !this.legendDiv || !this.chart) return;\n\n // Guard: Check if chart metadata is available\n const meta = this.chart.getDatasetMeta(0);\n if (!meta || !meta.controller) {\n return;\n }\n\n // Guard: Check if dataset has data\n if (!this.data || this.data.length === 0) {\n this.legendDiv.innerHTML = '';\n return;\n }\n\n // Denominator: use max if set, otherwise total, with minimum of 1\n const denominator = this.showSectorLabels ? 1 : 360;\n const isPercentage = this.outerLabelUnit === '%';\n\n try {\n const legendItems = this.data.map((item, i) => {\n const style = meta.controller.getStyle(i, false);\n\n let label: string;\n let valueToFormat: number;\n\n if (this.showSectorLabels) {\n label = item.label;\n valueToFormat = item.value;\n } else {\n const angle = (i * 360) / this.data.length;\n label = `${angle}${this.outerLabelUnit}`;\n valueToFormat = item.value;\n }\n\n const numericValue = formatChartNumber(\n valueToFormat,\n denominator,\n isPercentage,\n this.outerLabelDecimalPlaces\n );\n const showUnit = this.showUnit && this.outerLabelUnit;\n const value = `${numericValue}`;\n const unit =\n showUnit && this.showSectorLabels ? `${this.outerLabelUnit}` : '';\n\n return {\n fillStyle: style.backgroundColor as string,\n label,\n value,\n unit,\n };\n });\n\n const legendHTML = generateLegendHTML(legendItems);\n this.legendDiv.innerHTML = legendHTML;\n } catch (error) {\n console.debug(\n '[obc-polar-chart] updateLegend: error generating legend HTML',\n error\n );\n // Silent failure - don't throw, just skip legend update this time\n }\n }\n\n override render() {\n return html`\n <div class=\"wrapper\">\n <canvas></canvas>\n ${this.legend ? html`<div class=\"legend\"></div>` : ''}\n </div>\n `;\n }\n\n static override styles = [\n unsafeCSS(componentStyle),\n unsafeCSS(chartCommonStyle),\n unsafeCSS(chartLegendStyle),\n unsafeCSS(chartDebugStyle),\n ];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-polar-chart': ObcPolarChart;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,SAAS,qBAAqB,mBAAmB,YAAY,OAAO;AAG1E,IAAM,uBAAuB;CAC3B,GAAG;CACH,sBAAsB;AACxB;AAGA,IAAM,4BAA4B;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,IAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAuGO,IAAM,gBAAN,MAAM,sBAAsB,WAAW;;;EAEf,KAAA,OAAA,CAAC;EAEgC,KAAA,SAAA,CAAC;EAGnC,KAAA,oBAAA;EAGP,KAAA,WAAA,SAAS;EAEU,KAAA,aAAA;EAEnB,KAAA,qBAAA;EAEF,KAAA,mBAAA;EAER,KAAA,WAAA;EAEO,KAAA,kBAAA;EAED,KAAA,iBAAA;EAEK,KAAA,sBAAA;EAEI,KAAA,0BAAA;EAGZ,KAAA,cAAA;EAGL,KAAA,SAAA;EAGU,KAAA,mBAAA;EAIiB,KAAA,kBAAA,CAAC;EAGK,KAAA,0BAAA,iBAAiB;;CAoB3D,cACE,SACA,OACS;EACT,OAAO,MAAM,MAAM,SAAS,QAAQ,IAAI,IAAI,CAAC;CAC/C;CAGA,QAAiB,SAAyB;EACxC,MAAM,QAAQ,OAAO;EAErB,IAAI,KAAK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,MAAM,SAAS,CAAA,GAAA,cAAA,WAAA,aAAA,KAAA,CAAA;AAjDjB,gBAAA,WAAA,CAAA,cAAc,iBAAiB,CAAA,GAAA,aAAA"}
1
+ {"version":3,"file":"polar-chart.js","names":[],"sources":["../../../src/bars-graphs/polar-chart/polar-chart.ts"],"sourcesContent":["import {LitElement, PropertyValues, html, unsafeCSS} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport componentStyle from './polar-chart.css?inline';\nimport chartCommonStyle from '../../charthelpers/chart-common.css?inline';\nimport chartDebugStyle from '../../charthelpers/chart-debug.css?inline';\nimport chartLegendStyle from '../../charthelpers/chart-legend.css?inline';\nimport {customElement} from '../../decorator.js';\nimport {Priority} from '../../navigation-instruments/types.js';\nimport {\n Chart,\n PolarAreaController,\n RadialLinearScale,\n ArcElement,\n Tooltip,\n} from 'chart.js';\nimport type {Plugin, ChartOptions, Chart as ChartInstance} from 'chart.js';\nimport type {RadialLinearScale as RadialLinearScaleType} from 'chart.js';\nimport {\n CHART_SECTOR_DEFAULT_COLORS,\n CHART_SECTOR_ENHANCED_COLORS,\n CHART_DIMENSIONS,\n getCssVariableValue,\n getChartColorsOrDefault,\n observeThemeChanges,\n createArcOuterLabelPlugin,\n calculateFixedHeightChartLayout,\n getChartTooltipOptions,\n formatChartNumber,\n renderLegend,\n observeLabelThreshold,\n} from '../../charthelpers/index.js';\nimport type {FixedHeightChartDimensions} from '../../charthelpers/canvas-layout.js';\n\ntype PolarScale = RadialLinearScaleType & {\n xCenter: number;\n yCenter: number;\n drawingArea: number;\n};\n\n// Register Chart.js components\nChart.register(PolarAreaController, RadialLinearScale, ArcElement, Tooltip);\n\n// Polar-specific dimension constants\nconst POLAR_BAR_DIMENSIONS = {\n ...CHART_DIMENSIONS,\n GAP_AND_BORDER_COLOR: '--instrument-frame-tertiary-color',\n} as const;\n\n// Properties that require chart recreation (destroy and create)\nconst POLAR_RECREATE_PROP_NAMES = [\n 'showOuterLabels',\n 'outerLabelUnit',\n 'outerLabelMaxLength',\n 'outerLabelDecimalPlaces',\n 'showSectorLabels',\n 'discreteColorStops',\n 'showDebugOverlay',\n 'fixedHeight',\n 'showUnit',\n] as const;\n\n// All properties that trigger chart updates\nconst POLAR_WATCHED_PROP_NAMES = [\n 'legend',\n 'data',\n 'colors',\n 'priority',\n 'monochrome',\n 'discreteColorStops',\n 'showSectorLabels',\n 'showOuterLabels',\n 'outerLabelUnit',\n 'outerLabelMaxLength',\n 'outerLabelDecimalPlaces',\n 'showDebugOverlay',\n 'fixedHeight',\n 'showUnit',\n] as const;\n\nexport type PolarChartDataItem = {\n label: string;\n value: number;\n};\n\n/**\n * `<obc-polar-chart>` – A customizable polar area chart component for visualizing proportional data as sectors, with optional outer labels, angle display, and discrete color bands.\n *\n * This component renders an interactive polar area chart powered by Chart.js, displaying data segments as radial sectors with optional outer labels, angle display, and discrete color bands. It supports customizable colors, monochrome mode, and adapts its layout based on available space. Labels are hidden when the chart is too small (< 192px height), ensuring clarity at all sizes.\n *\n * ## Features\n * - **Fixed Height ⇒ Fixed Circumference:** The chart's circumference is determined by the `fixedHeight` property (default: 320px). This ensures the chart's circumference remains consistent and matches other radial instruments, regardless of the available browser or container width. The chart does not scale to fill the width; instead, it always uses the specified fixed height to define its size and circumference.\n * - **Layout:**\n * - Full 360° polar area chart layout.\n * - **Outer Labels:**\n * - Optional labels positioned outside the chart showing sector names or angles.\n * - Supports percentage or custom units (e.g., \"kW\", \"kg\", \"MB\").\n * - Configurable decimal places and maximum label length (with trimming).\n * - Option to display angles (0°, 30°, etc.) instead of sector names.\n * - **Discrete Color Bands:**\n * - Draw sectors as radial color bands from center outward using the colors array as threshold steps.\n * - Option to trim sectors to the nearest color band boundary or show exact values with partial band fills.\n * - **Customization:**\n * - Custom segment colors (with automatic fallback to theme palette).\n * - Monochrome mode for single-color charts.\n * - Adjustable outer label formatting and units.\n * - **Color Priority:** Set `priority` to `Priority.enhanced` to use the blue/enhanced\n * color palette instead of the default gray/regular palette (default: `Priority.regular`).\n * - **Responsive Behavior:**\n * - Automatically hides labels when height < 192px.\n * - Maintains aspect ratio and adjusts padding for optimal label positioning.\n * - **Theme Integration:**\n * - Colors update automatically when the `data-obc-theme` attribute changes on the `<html>` element.\n * - Example:\n * ```html\n * <html lang=\"en\" data-obc-theme=\"day\"></html>\n * ```\n *\n * ## Example\n *\n * **Basic Usage**\n * ```html\n * <obc-polar-chart></obc-polar-chart>\n * <script>\n * document.querySelector('obc-polar-chart').data = [\n * {label: 'Sector A', value: 33},\n * {label: 'Sector B', value: 22},\n * {label: 'Sector C', value: 45}\n * ];\n * </script>\n * ```\n *\n * **With Discrete Color Bands**\n * ```html\n * <obc-polar-chart></obc-polar-chart>\n * <script>\n * const chart = document.querySelector('obc-polar-chart');\n * chart.discreteColorStops = true;\n * chart.data = [\n * {label: 'A', value: 50},\n * {label: 'B', value: 30},\n * {label: 'C', value: 20}\n * ];\n * </script>\n * ```\n *\n * **Custom Colors and Angle Labels**\n * ```html\n * <obc-polar-chart></obc-polar-chart>\n * <script>\n * const chart = document.querySelector('obc-polar-chart');\n * chart.showSectorLabels = true;\n * chart.outerLabelUnit = '°';\n * chart.outerLabelDecimalPlaces = 0;\n * chart.data = [\n * {label: 'A', value: 20},\n * {label: 'B', value: 35},\n * {label: 'C', value: 45}\n * ];\n * chart.colors = ['#e74c3c', '#f39c12', '#2ecc71'];\n * </script>\n * ```\n *\n * @property data - Chart data segments (set via JavaScript)\n * @property colors - Custom segment colors (set via JavaScript) with fallback to theme palette\n * @property monochrome - Use single color for all sectors (uses first color from array, default: false)\n * @availableWhen monochrome discreteColorStops==false\n * @property discreteColorStops - Draw sectors as radial color bands from center outward using the colors array as threshold steps (default: false)\n * @property showSectorLabels - When true, display sector labels from data (e.g. \"Sector A\"). When false, display angle values (0°, 30°, etc.). Default: false\n * @property showUnit - Whether to show unit in angle or outer labels, default: false\n * @property showOuterLabels - Show outer labels, default: false\n * @property outerLabelUnit - Unit string to append to outer labels, default: \"°\"\n * @property outerLabelMaxLength - Maximum character length for labels before trim (0 = no limit), default: 0\n * @availableWhen outerLabelMaxLength showOuterLabels==true\n * @property outerLabelDecimalPlaces - Number of decimal places in labels, default: 0\n * @property fixedHeight - Fixed height of the chart in pixels (determines chart circumference), default: 320. The chart's circumference is always based on this fixed height to match other radial instruments.\n * @property legend - Whether to display the legend below the chart, default: false\n * @property showDebugOverlay - Show debug overlay for development, default: false\n * @beta\n */\n@customElement('obc-polar-chart')\nexport class ObcPolarChart extends LitElement {\n @property({type: Array, attribute: false})\n data: PolarChartDataItem[] = [];\n\n @property({type: Array, attribute: false}) colors: string[] = [];\n\n /** @internal */\n private centerFirstSector = false; // When false, first sector is centered at 12 o'clock position\n\n @property({type: String})\n priority: Priority = Priority.regular;\n\n @property({type: Boolean}) monochrome = false;\n @property({type: Boolean})\n discreteColorStops = false;\n @property({type: Boolean})\n showSectorLabels = false; // Default: false (angles shown by default)\n @property({type: Boolean})\n showUnit = false;\n @property({type: Boolean})\n showOuterLabels = false;\n @property({type: String})\n outerLabelUnit = '°';\n @property({type: Number})\n outerLabelMaxLength = 0;\n @property({type: Number})\n outerLabelDecimalPlaces = 0;\n\n @property({type: Number, reflect: true})\n fixedHeight = 320;\n\n @property({type: Boolean, reflect: true})\n legend = false;\n\n @property({type: Boolean, reflect: true})\n showDebugOverlay = false;\n\n /** @internal - Pre-formatted labels for outer label rendering */\n @state()\n private formattedLabels: string[] = [];\n\n /** @internal - Calculated chart diameter from layout helper */\n private calculatedChartDiameter: number = CHART_DIMENSIONS.CHART_WIDTH;\n\n /** @internal */\n @query('canvas') private canvasEl!: HTMLCanvasElement;\n\n /** @internal */\n @query('.legend') private legendDiv?: HTMLDivElement;\n\n /** @internal */\n private chart?: Chart;\n\n /** @internal - Latest layout dimensions computed by getChartOptions() */\n private lastDimensions?: FixedHeightChartDimensions;\n\n /** @internal */\n private themeObserver?: MutationObserver;\n\n /** @internal - ResizeObserver for tracking height threshold crossings */\n private resizeObserver?: ResizeObserver;\n\n private hasAnyChanged(\n changed: PropertyValues,\n props: readonly (keyof ObcPolarChart)[]\n ): boolean {\n return props.some((prop) => changed.has(prop));\n }\n\n // Update external library AFTER render\n override updated(changed: PropertyValues) {\n super.updated(changed);\n\n if (this.hasAnyChanged(changed, POLAR_WATCHED_PROP_NAMES)) {\n // Recreate chart when major layout properties change or when plugin configuration changes\n // These properties affect aspect ratio calculation, plugin registration, or outer label rendering\n const needsRecreation = this.hasAnyChanged(\n changed,\n POLAR_RECREATE_PROP_NAMES\n );\n\n if (needsRecreation) {\n this.chart?.destroy();\n this.createChart();\n } else {\n this.updateChart();\n }\n }\n }\n\n override firstUpdated() {\n this.createChart();\n this.themeObserver = observeThemeChanges(() => this.updateChart());\n this.setupResizeObserver();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.chart?.destroy();\n this.themeObserver?.disconnect();\n this.resizeObserver?.disconnect();\n }\n\n /**\n * Crossing MIN_HEIGHT_WITH_LABELS changes the plugin set, so the chart is\n * rebuilt rather than updated.\n */\n private setupResizeObserver() {\n if (!this.canvasEl) return;\n\n this.resizeObserver = observeLabelThreshold(\n this.canvasEl,\n () =>\n (this.canvasEl?.clientHeight ?? 0) >=\n CHART_DIMENSIONS.MIN_HEIGHT_WITH_LABELS,\n {\n rebuild: () => {\n this.chart?.destroy();\n this.createChart();\n },\n update: () => this.updateChart(),\n }\n );\n }\n\n private prepareChartData() {\n const values = this.data.map((d) => d.value);\n const labels = this.data.map((d) => d.label);\n const chartColors = getChartColorsOrDefault(\n this,\n this.colors,\n this.priority === Priority.enhanced\n ? CHART_SECTOR_ENHANCED_COLORS\n : CHART_SECTOR_DEFAULT_COLORS\n );\n\n // When using discrete color stops, sectors will be drawn by the plugin\n // so we can use transparent colors for the main dataset\n const segmentColors = this.discreteColorStops\n ? values.map(() => 'transparent')\n : values.map((_, index) =>\n this.monochrome\n ? chartColors[0]\n : chartColors[index % chartColors.length]\n );\n\n // Generate labels based on showSectorLabels property\n const numSectors = this.data.length;\n const displayLabels = this.showSectorLabels\n ? labels\n : Array.from({length: numSectors}, (_, i) => {\n const angle = (i * 360) / numSectors;\n return `${angle}`;\n });\n\n return {\n values,\n labels,\n colors: segmentColors,\n chartColors, // Pass resolved colors for use in plugin\n displayLabels,\n };\n }\n\n private getLayoutConfig() {\n // For polar, use actual data labels and values when showSectorLabels is true, otherwise use angle values\n return {\n unit: this.outerLabelUnit,\n showUnit: this.showUnit,\n outerLabelMaxLength: this.outerLabelMaxLength,\n decimalPlaces: this.outerLabelDecimalPlaces,\n data: this.showSectorLabels\n ? this.data\n : Array.from({length: this.data.length}, (_, i) => ({\n label: '',\n value: (i * 360) / this.data.length,\n })),\n denominator: this.showSectorLabels ? 1 : 360,\n };\n }\n\n private getChartOptions(): ChartOptions<'polarArea'> {\n // Use centralized layout calculation helper for all dimensions and label measurement\n const dimensions = calculateFixedHeightChartLayout({\n fixedHeight: this.fixedHeight,\n isHalfMode: false,\n showOuterLabels: this.showOuterLabels,\n canvasEl: this.canvasEl,\n layoutConfig: this.getLayoutConfig(),\n host: this,\n });\n\n // Store dimensions for explicit canvas sizing in createChart/updateChart\n this.lastDimensions = dimensions;\n\n // Store chart diameter for plugin use\n this.calculatedChartDiameter = dimensions.chartDiameter;\n this.formattedLabels = dimensions.formattedLabels;\n\n // Set CSS variables for chart dimensions\n this.style.setProperty('--chart-width', `${dimensions.calculatedWidth}px`);\n this.style.setProperty('--chart-height', `${dimensions.actualHeight}px`);\n\n // Calculate dynamic padding for Chart.js layout\n const dynamicPadding = dimensions.isTooSmall\n ? {top: 0, right: 0, bottom: 0, left: 0}\n : {\n top: dimensions.topPadding,\n right: dimensions.rightPadding,\n bottom: dimensions.bottomPadding,\n left: dimensions.leftPadding,\n };\n\n // Set number of ticks to match color bands when discrete stops enabled\n const chartColors = getChartColorsOrDefault(\n this,\n this.colors,\n CHART_SECTOR_DEFAULT_COLORS\n );\n const numTicks = this.discreteColorStops ? chartColors.length + 1 : 6;\n\n // Find max value for scaling\n const maxValue = Math.max(...this.data.map((d) => d.value), 100);\n\n // Calculate rotation to center first label at 12 o'clock if enabled\n const numSectors = this.data.length;\n const anglePerSector = 360 / numSectors;\n const startAngle = this.centerFirstSector ? 0 : -anglePerSector / 2;\n\n return {\n // Chart.js responsive mode stays off — see the note in donut-chart.ts (#1061).\n responsive: false,\n maintainAspectRatio: false,\n devicePixelRatio: window.devicePixelRatio,\n layout: {\n padding: dynamicPadding ?? POLAR_BAR_DIMENSIONS.CANVAS_PADDING,\n },\n scales: {\n r: {\n startAngle: startAngle,\n angleLines: {\n display: true,\n color: getCssVariableValue(\n this,\n POLAR_BAR_DIMENSIONS.GAP_AND_BORDER_COLOR\n ),\n lineWidth: 1,\n },\n grid: {\n display: true,\n color: getCssVariableValue(\n this,\n POLAR_BAR_DIMENSIONS.GAP_AND_BORDER_COLOR\n ),\n lineWidth: 1,\n },\n pointLabels: {\n // Always disable Chart.js built-in labels - we use our own outer label plugin\n display: false,\n },\n ticks: {\n display: false,\n stepSize: maxValue / (numTicks - 1),\n count: numTicks,\n },\n max: maxValue,\n },\n },\n plugins: {\n legend: {\n display: false,\n labels: {\n generateLabels: () => [], // Prevent Chart.js from generating labels internally\n },\n onClick: () => {}, // Disable legend click handler\n },\n tooltip: {\n ...getChartTooltipOptions(this),\n enabled: !dimensions.isTooSmall,\n callbacks: {\n title: () => '', // No title line\n label: (context) => {\n // Always show the data label and value, no unit\n const dataIndex = context.dataIndex;\n const data = this.data?.[dataIndex];\n const label = data?.label ?? '';\n const value =\n typeof data?.value === 'number'\n ? data.value\n : Number(data?.value);\n return `${label} ${value}`;\n },\n },\n },\n },\n animation: false,\n };\n }\n\n private createDiscreteColorPlugin(): Plugin<'polarArea'> {\n return {\n id: 'discreteColors',\n beforeDatasetsDraw: (chart: ChartInstance<'polarArea'>) => {\n if (!this.discreteColorStops) return;\n\n const {ctx, scales} = chart;\n const scale = scales.r as PolarScale | undefined;\n if (!scale) return;\n\n const centerX = scale.xCenter;\n const centerY = scale.yCenter;\n // Use calculated chart diameter to ensure consistency with layout\n const maxRadius = this.calculatedChartDiameter / 2;\n const numSectors = this.data.length;\n const anglePerSector = (Math.PI * 2) / numSectors;\n const rotationOffset = this.centerFirstSector ? 0 : -anglePerSector / 2;\n\n // Get resolved colors for creating discrete bands\n const chartColors = getChartColorsOrDefault(\n this,\n this.colors,\n this.priority === Priority.enhanced\n ? CHART_SECTOR_ENHANCED_COLORS\n : CHART_SECTOR_DEFAULT_COLORS\n );\n const numBands = chartColors.length;\n\n // Find max value for scaling\n const maxValue = Math.max(...this.data.map((d) => d.value), 100);\n\n // Generate threshold stops from the colors array (reversed)\n // Divide maxValue into equal bands based on number of colors\n const colorStops = chartColors.reverse().map((color, index) => ({\n threshold: ((index + 1) / numBands) * maxValue,\n color,\n }));\n\n ctx.save();\n\n // Draw each sector with discrete color bands\n this.data.forEach((dataPoint, sectorIndex) => {\n const sectorValue = dataPoint.value;\n const startAngle =\n sectorIndex * anglePerSector + rotationOffset - Math.PI / 2;\n const endAngle = startAngle + anglePerSector;\n\n // Draw color bands from center outward\n let previousRadius = 0;\n\n colorStops.forEach((stop) => {\n // Calculate radius for this threshold\n const thresholdRadius = (stop.threshold / maxValue) * maxRadius;\n const sectorRadiusLimit = (sectorValue / maxValue) * maxRadius;\n\n // Determine the outer radius for this band\n let drawRadius;\n if (sectorRadiusLimit <= thresholdRadius) {\n // Sector value is within or below this band - draw up to sector value\n drawRadius = sectorRadiusLimit;\n } else {\n // Sector value exceeds this band - fill band completely to threshold\n drawRadius = thresholdRadius;\n }\n\n // Draw the arc segment for this color band\n if (drawRadius > previousRadius) {\n ctx.fillStyle = stop.color;\n ctx.beginPath();\n ctx.arc(centerX, centerY, drawRadius, startAngle, endAngle);\n if (previousRadius > 0) {\n ctx.arc(\n centerX,\n centerY,\n previousRadius,\n endAngle,\n startAngle,\n true\n );\n } else {\n ctx.lineTo(centerX, centerY);\n }\n ctx.closePath();\n ctx.fill();\n }\n\n previousRadius = drawRadius;\n\n // Stop if we've reached the sector's value limit\n if (sectorRadiusLimit <= thresholdRadius) {\n return;\n }\n });\n });\n\n ctx.restore();\n },\n };\n }\n\n private createChart() {\n // Guard: Verify canvas exists and is connected to DOM\n if (!this.canvasEl || !this.canvasEl.isConnected) return;\n\n const ctx = this.canvasEl.getContext('2d');\n if (!ctx) return;\n\n const {values, colors, displayLabels} = this.prepareChartData();\n\n const plugins: Plugin<'polarArea'>[] = [];\n\n // Add discrete color plugin if enabled\n if (this.discreteColorStops) {\n plugins.push(this.createDiscreteColorPlugin());\n }\n\n // Get chart options (this will populate formattedLabels and check dimensions)\n const chartOptions = this.getChartOptions();\n\n // Non-responsive mode: set the canvas render size explicitly from the\n // computed layout; Chart.js applies devicePixelRatio scaling on top\n if (this.lastDimensions) {\n this.canvasEl.width = this.lastDimensions.calculatedWidth;\n this.canvasEl.height = this.lastDimensions.actualHeight;\n }\n\n // Only add outer labels plugin if enabled AND canvas is large enough\n // formattedLabels will be empty if too small or outer labels disabled\n if (this.showOuterLabels && this.formattedLabels.length > 0) {\n const numSectors = values.length;\n const anglePerSector = (Math.PI * 2) / (numSectors || 1);\n const rotationOffset = this.centerFirstSector ? 0 : -anglePerSector / 2;\n plugins.push(\n createArcOuterLabelPlugin(this, {\n formattedLabels: this.formattedLabels.slice(0, numSectors),\n rotationOffset,\n chartDiameter: this.calculatedChartDiameter,\n type: 'polar',\n })\n );\n }\n\n this.chart = new Chart(ctx, {\n type: 'polarArea',\n data: {\n labels: displayLabels, // Use angle labels or sector labels based on showSectorLabels\n datasets: [\n {\n data: values,\n backgroundColor: colors,\n borderWidth: 1,\n borderColor: getCssVariableValue(\n this,\n POLAR_BAR_DIMENSIONS.GAP_AND_BORDER_COLOR\n ),\n },\n ],\n },\n options: chartOptions,\n plugins,\n });\n\n // Defer legend update to next tick to ensure Chart.js metadata is initialized\n requestAnimationFrame(() => this.updateLegend());\n }\n\n private updateChart() {\n // Guard: Verify chart and canvas still exist and are connected\n if (!this.chart || !this.canvasEl || !this.canvasEl.isConnected) return;\n\n const {values, colors, displayLabels} = this.prepareChartData();\n\n this.chart.data.labels = displayLabels;\n if (this.chart.data.datasets[0]) {\n this.chart.data.datasets[0].data = values;\n this.chart.data.datasets[0].backgroundColor = colors;\n }\n\n const latestOptions = this.getChartOptions();\n if (this.chart.options) {\n Object.assign(this.chart.options, latestOptions);\n }\n\n // Non-responsive mode: apply the computed layout size explicitly\n // (no-op when the size is unchanged)\n if (this.lastDimensions) {\n this.chart.resize(\n this.lastDimensions.calculatedWidth,\n this.lastDimensions.actualHeight\n );\n }\n\n this.chart.update();\n\n // Update legend after chart update completes to ensure metadata is ready\n requestAnimationFrame(() => this.updateLegend());\n }\n\n /**\n * Update the legend HTML content\n */\n private updateLegend() {\n // Guard: Check if legend should be shown and chart is ready\n if (!this.legend || !this.legendDiv || !this.chart) return;\n\n // Guard: Check if chart metadata is available\n const meta = this.chart.getDatasetMeta(0);\n if (!meta || !meta.controller) {\n return;\n }\n\n // Guard: Check if dataset has data\n if (!this.data || this.data.length === 0) {\n renderLegend(this.legendDiv, []);\n return;\n }\n\n // Denominator: use max if set, otherwise total, with minimum of 1\n const denominator = this.showSectorLabels ? 1 : 360;\n const isPercentage = this.outerLabelUnit === '%';\n\n try {\n const legendItems = this.data.map((item, i) => {\n const style = meta.controller.getStyle(i, false);\n\n let label: string;\n let valueToFormat: number;\n\n if (this.showSectorLabels) {\n label = item.label;\n valueToFormat = item.value;\n } else {\n const angle = (i * 360) / this.data.length;\n label = `${angle}${this.outerLabelUnit}`;\n valueToFormat = item.value;\n }\n\n const numericValue = formatChartNumber(\n valueToFormat,\n denominator,\n isPercentage,\n this.outerLabelDecimalPlaces\n );\n const showUnit = this.showUnit && this.outerLabelUnit;\n const value = `${numericValue}`;\n const unit =\n showUnit && this.showSectorLabels ? `${this.outerLabelUnit}` : '';\n\n return {\n fillStyle: style.backgroundColor as string,\n label,\n value,\n unit,\n };\n });\n\n renderLegend(this.legendDiv, legendItems);\n } catch (error) {\n console.debug(\n '[obc-polar-chart] updateLegend: error generating legend HTML',\n error\n );\n // Silent failure - don't throw, just skip legend update this time\n }\n }\n\n override render() {\n return html`\n <div class=\"wrapper\">\n <canvas></canvas>\n ${this.legend ? html`<div class=\"legend\"></div>` : ''}\n </div>\n `;\n }\n\n static override styles = [\n unsafeCSS(componentStyle),\n unsafeCSS(chartCommonStyle),\n unsafeCSS(chartLegendStyle),\n unsafeCSS(chartDebugStyle),\n ];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-polar-chart': ObcPolarChart;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,SAAS,qBAAqB,mBAAmB,YAAY,OAAO;AAG1E,IAAM,uBAAuB;CAC3B,GAAG;CACH,sBAAsB;AACxB;AAGA,IAAM,4BAA4B;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,IAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAuGO,IAAM,gBAAN,MAAM,sBAAsB,WAAW;;;EAEf,KAAA,OAAA,CAAC;EAEgC,KAAA,SAAA,CAAC;EAGnC,KAAA,oBAAA;EAGP,KAAA,WAAA,SAAS;EAEU,KAAA,aAAA;EAEnB,KAAA,qBAAA;EAEF,KAAA,mBAAA;EAER,KAAA,WAAA;EAEO,KAAA,kBAAA;EAED,KAAA,iBAAA;EAEK,KAAA,sBAAA;EAEI,KAAA,0BAAA;EAGZ,KAAA,cAAA;EAGL,KAAA,SAAA;EAGU,KAAA,mBAAA;EAIiB,KAAA,kBAAA,CAAC;EAGK,KAAA,0BAAA,iBAAiB;;CAoB3D,cACE,SACA,OACS;EACT,OAAO,MAAM,MAAM,SAAS,QAAQ,IAAI,IAAI,CAAC;CAC/C;CAGA,QAAiB,SAAyB;EACxC,MAAM,QAAQ,OAAO;EAErB,IAAI,KAAK,cAAc,SAAS,wBAAwB,GAAG;GAQzD,IALwB,KAAK,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Y;IAMZ,oBAAoB;IAO7B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,gBAAgB;IA6CxB,OAAO,CAAC,eAAe;IAkGvB,OAAO,CAAC,WAAW;IA8BnB,OAAO,CAAC,WAAW;IAgCnB;;OAEG;IACH,OAAO,CAAC,YAAY;IA2CX,MAAM;IAcf,OAAgB,MAAM,4BAKpB;CACH;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,sBAAsB,EAAE,iBAAiB,CAAC;KAC3C;CACF"}
@@ -4,7 +4,7 @@ import { getChartColorsOrDefault, getCssVariableValue } from "../../charthelpers
4
4
  import { calculateFixedHeightChartLayout } from "../../charthelpers/canvas-layout.js";
5
5
  import { observeThemeChanges } from "../../charthelpers/theme.js";
6
6
  import { getChartTooltipOptions } from "../../charthelpers/tooltip.js";
7
- import { generateLegendHTML } from "../../charthelpers/legend.js";
7
+ import { renderLegend } from "../../charthelpers/legend.js";
8
8
  import { observeLabelThreshold } from "../../charthelpers/label-threshold.js";
9
9
  import "../../charthelpers/index.js";
10
10
  import __decorate from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js";
@@ -249,7 +249,7 @@ var ObcRadialBarChart = class ObcRadialBarChart extends LitElement {
249
249
  updateLegend() {
250
250
  if (!this.legend || !this.legendDiv || !this.chart) return;
251
251
  if (!this.data || this.data.length === 0) {
252
- this.legendDiv.innerHTML = "";
252
+ renderLegend(this.legendDiv, []);
253
253
  return;
254
254
  }
255
255
  try {
@@ -262,8 +262,7 @@ var ObcRadialBarChart = class ObcRadialBarChart extends LitElement {
262
262
  unit: ""
263
263
  };
264
264
  });
265
- const legendHTML = generateLegendHTML(legendItems);
266
- this.legendDiv.innerHTML = legendHTML;
265
+ renderLegend(this.legendDiv, legendItems);
267
266
  } catch (error) {
268
267
  console.debug("[obc-radial-bar-chart] updateLegend: error generating legend HTML", error);
269
268
  }
@@ -1 +1 @@
1
- {"version":3,"file":"radial-bar-chart.js","names":[],"sources":["../../../src/bars-graphs/radial-bar-chart/radial-bar-chart.ts"],"sourcesContent":["import {LitElement, PropertyValues, html, unsafeCSS} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './radial-bar-chart.css?inline';\nimport chartCommonStyle from '../../charthelpers/chart-common.css?inline';\nimport chartDebugStyle from '../../charthelpers/chart-debug.css?inline';\nimport chartLegendStyle from '../../charthelpers/chart-legend.css?inline';\nimport {customElement} from '../../decorator.js';\nimport {Priority} from '../../navigation-instruments/types.js';\nimport {Chart, DoughnutController, ArcElement, Tooltip} from 'chart.js';\nimport type {ChartOptions} from 'chart.js';\nimport {\n CHART_SECTOR_DEFAULT_COLORS,\n CHART_SECTOR_ENHANCED_COLORS,\n CHART_DIMENSIONS,\n getCssVariableValue,\n getChartColorsOrDefault,\n observeThemeChanges,\n calculateFixedHeightChartLayout,\n getChartTooltipOptions,\n generateLegendHTML,\n observeLabelThreshold,\n} from '../../charthelpers/index.js';\nimport type {FixedHeightChartDimensions} from '../../charthelpers/canvas-layout.js';\n\n// Register Chart.js components\nChart.register(DoughnutController, ArcElement, Tooltip);\n\n// Radial-bar-specific dimension constants\nconst RADIAL_BAR_DIMENSIONS = {\n ...CHART_DIMENSIONS,\n CHART_WIDTH: 258, // Override: 256 + 2px to compensate for outer border visual appearance\n CANVAS_PADDING: 30, // Recude by the above 2px to keep chart area consistent\n GAP_AND_BORDER_COLOR: '--container-background-color',\n REMAINING_COLOR: '--border-outline-color',\n BORDER_RADIUS: 4,\n SPACING: 4, // Gap between rings in pixels (2px border on each side)\n MIN_RING_THICKNESS: 16, // Minimum visible arc thickness in pixels (excluding borders)\n MIN_CUTOUT_PERCENT: 20, // Minimum cutout percentage to maintain empty center\n DEFAULT_MAX_CUTOUT_PERCENT: 60, // Default/maximum cutout percentage when space allows\n} as const;\n\n// Properties that require chart recreation (destroy and create)\nconst RADIAL_BAR_RECREATE_PROP_NAMES = [\n 'circumference',\n 'showDebugOverlay',\n 'fixedHeight',\n 'minRingThickness',\n] as const;\n\n// All properties that trigger chart updates\nconst RADIAL_BAR_WATCHED_PROP_NAMES = [\n 'legend',\n 'data',\n 'colors',\n 'priority',\n 'max',\n 'circumference',\n 'showDebugOverlay',\n 'fixedHeight',\n 'minRingThickness',\n] as const;\n\n/**\n * `<obc-radial-bar-chart>` – A customizable radial bar chart for visualizing multiple metrics as concentric rings, with dynamic ring thickness and cutout calculation.\n *\n * This component renders multiple data values as concentric arcs (rings), each representing a different metric. It supports full circle (360°) or three-quarter circle (270°) layouts, dynamic ring thickness, and automatic cutout calculation to ensure all rings fit within the available space. The chart adapts its layout based on the number of rings and available space, and hides labels when the chart is too small (< 192px height) for clarity.\n *\n * ## Features\n * - **Fixed Height ⇒ Fixed Circumference:** The chart's circumference is determined by the `fixedHeight` property (default: 320px). This ensures the chart's circumference remains consistent and matches other radial instruments, regardless of the available browser or container width. The chart does not scale to fill the width; instead, it always uses the specified fixed height to define its size and circumference.\n * - **Layout:**\n * - Full 360° or 270° (three-quarter) circle layout, controlled by the `circumference` property.\n * - Multiple concentric rings, each representing a data value.\n * - **Dynamic Ring Thickness:**\n * - All rings maintain equal thickness when possible.\n * - The `cutout` value serves as the maximum/preferred cutout percentage.\n * - When many rings are present, cutout is automatically reduced to fit rings at `minRingThickness`.\n * - Cutout will not go below 20% (minimum to maintain visible center).\n * - If rings still don't fit with 20% cutout, ring thickness is reduced proportionally.\n * - **Customization:**\n * - Custom ring colors (with automatic fallback to theme palette).\n * - Adjustable minimum ring thickness (`minRingThickness`).\n * - Adjustable arc span (`circumference`).\n * - **Color Priority:** Set `priority` to `Priority.enhanced` to use the blue/enhanced\n * color palette instead of the default gray/regular palette (default: `Priority.regular`).\n * - **Capacity Visualization:**\n * - Each ring shows a filled and remaining segment based on the `max` value.\n * - **Responsive Behavior:**\n * - Automatically hides labels and reduces spacing when height < 192px.\n * - Maintains aspect ratio and adjusts padding for optimal ring positioning.\n * - **Theme Integration:**\n * - Colors update automatically when the `data-obc-theme` attribute changes on the `<html>` element.\n * - Example:\n * ```html\n * <html lang=\"en\" data-obc-theme=\"day\"></html>\n * ```\n *\n * ## Example\n *\n * **Basic Usage**\n * ```html\n * <obc-radial-bar-chart></obc-radial-bar-chart>\n * <script>\n * document.querySelector('obc-radial-bar-chart').data = [70, 50, 30];\n * </script>\n * ```\n *\n * **Three-Quarter Circle with Custom Colors**\n * ```html\n * <obc-radial-bar-chart></obc-radial-bar-chart>\n * <script>\n * const chart = document.querySelector('obc-radial-bar-chart');\n * chart.circumference = 270;\n * chart.data = [80, 60, 40, 20];\n * chart.colors = ['#e74c3c', '#f39c12', '#2ecc71', '#3498db'];\n * </script>\n * ```\n *\n * **Custom Minimum Ring Thickness and Max Value**\n * ```html\n * <obc-radial-bar-chart></obc-radial-bar-chart>\n * <script>\n * const chart = document.querySelector('obc-radial-bar-chart');\n * chart.minRingThickness = 20;\n * chart.max = 200;\n * chart.data = [120, 80, 40];\n * </script>\n * ```\n *\n * @property data - Array of values for each ring (set via JavaScript)\n * @property colors - Custom ring colors (set via JavaScript) with fallback to theme palette\n * @property max - Maximum value for calculating remaining empty area, default: 100\n * @property circumference - Arc span in degrees: 360 for full circle, 270 for 3/4 circle, default: 270\n * @property legend - Whether to display the legend below the chart, default: false\n * @property showDebugOverlay - Show debug overlay for development, default: false\n * @property fixedHeight - Fixed height of the chart in pixels (determines chart circumference), default: 320. The chart's circumference is always based on this fixed height to match other radial instruments.\n * @property minRingThickness - Minimum thickness of each ring in pixels, excluding borders, default: 16\n * @beta\n */\n@customElement('obc-radial-bar-chart')\nexport class ObcRadialBarChart extends LitElement {\n @property({type: Array, attribute: false}) data: number[] = [];\n @property({type: Array, attribute: false}) colors: string[] = [];\n @property({type: String})\n priority: Priority = Priority.regular;\n @property({type: Number})\n max = 100;\n @property({type: Number})\n circumference = 270;\n @property({type: Boolean, reflect: true})\n legend = false;\n @property({type: Boolean, reflect: true})\n showDebugOverlay = false;\n @property({type: Number, reflect: true})\n fixedHeight = 320;\n @property({\n type: Number,\n })\n minRingThickness = 16;\n\n /** @internal */\n @query('canvas') private canvasEl?: HTMLCanvasElement;\n\n /** @internal */\n @query('.legend') private legendDiv?: HTMLDivElement;\n\n /** @internal */\n private chart?: Chart;\n\n /** @internal - Latest layout dimensions computed by getChartOptions() */\n private lastDimensions?: FixedHeightChartDimensions;\n\n /** @internal */\n private themeObserver?: MutationObserver;\n\n /** @internal - ResizeObserver for tracking height threshold crossings */\n private resizeObserver?: ResizeObserver;\n\n private hasAnyChanged(\n changed: PropertyValues,\n props: readonly (keyof ObcRadialBarChart)[]\n ): boolean {\n return props.some((prop) => changed.has(prop));\n }\n\n /**\n * Calculate optimal cutout percentage and whether rings should use minimum thickness\n * based on available chart space and number of rings.\n *\n * Algorithm:\n * 1. Calculate total space needed for all rings at minRingThickness\n * 2. If enough space: use equal thickness and adjust cutout\n * 3. If not enough space with minCutout: reduce cutout to minimum\n * 4. If still not enough: rings must be thinner than minimum\n *\n * @param chartDiameter - Available chart diameter in pixels\n * @param isTooSmall - Whether chart is below MIN_HEIGHT_WITH_LABELS (affects border width)\n * @returns Object with calculated cutout percentage and flag for using minimum thickness\n */\n private calculateOptimalLayout(\n chartDiameter: number,\n isTooSmall: boolean\n ): {\n cutout: number;\n useMinThickness: boolean;\n } {\n const numRings = this.data.length;\n if (numRings === 0) {\n return {\n cutout: RADIAL_BAR_DIMENSIONS.DEFAULT_MAX_CUTOUT_PERCENT,\n useMinThickness: false,\n };\n }\n\n // Calculate total space per ring: minRingThickness + borders (spacing applied as borderWidth)\n // Border is applied on both sides, so total border = spacing (or spacing/2 for small charts)\n const effectiveSpacing = isTooSmall\n ? RADIAL_BAR_DIMENSIONS.SPACING / 2\n : RADIAL_BAR_DIMENSIONS.SPACING;\n const totalSpacePerRing = this.minRingThickness + effectiveSpacing;\n\n // Calculate radius (half of diameter)\n const radius = chartDiameter / 2;\n\n // Calculate total space needed for all rings\n const totalRingsSpace = numRings * totalSpacePerRing;\n\n // Calculate remaining space for cutout\n const remainingSpace = radius - totalRingsSpace;\n\n // Convert remaining space to cutout percentage\n const calculatedCutoutPercent = (remainingSpace / radius) * 100;\n\n // Check if we can fit all rings with minimum thickness\n if (calculatedCutoutPercent >= RADIAL_BAR_DIMENSIONS.MIN_CUTOUT_PERCENT) {\n // We have enough space - use minimum thickness and calculated cutout\n return {\n cutout: Math.min(\n calculatedCutoutPercent,\n RADIAL_BAR_DIMENSIONS.DEFAULT_MAX_CUTOUT_PERCENT\n ),\n useMinThickness: true,\n };\n } else {\n // Not enough space - try with minimum cutout\n const minCutoutSpace =\n (radius * RADIAL_BAR_DIMENSIONS.MIN_CUTOUT_PERCENT) / 100;\n const availableRingSpace = radius - minCutoutSpace;\n const spacePerRingWithMinCutout = availableRingSpace / numRings;\n\n if (spacePerRingWithMinCutout >= totalSpacePerRing) {\n // We can fit with minimum cutout\n return {\n cutout: RADIAL_BAR_DIMENSIONS.MIN_CUTOUT_PERCENT,\n useMinThickness: true,\n };\n } else {\n // Can't fit even with minimum cutout - rings must be thinner\n return {\n cutout: RADIAL_BAR_DIMENSIONS.MIN_CUTOUT_PERCENT,\n useMinThickness: false,\n };\n }\n }\n }\n\n // Update external library AFTER render\n override updated(changed: PropertyValues) {\n super.updated(changed);\n\n if (this.hasAnyChanged(changed, RADIAL_BAR_WATCHED_PROP_NAMES)) {\n // Recreate chart when major layout properties change\n // These properties affect aspect ratio calculation or require plugin reconfiguration\n const needsRecreation = this.hasAnyChanged(\n changed,\n RADIAL_BAR_RECREATE_PROP_NAMES\n );\n\n if (needsRecreation) {\n this.chart?.destroy();\n this.createChart();\n } else {\n this.updateChart();\n }\n }\n }\n\n override firstUpdated() {\n this.createChart();\n this.themeObserver = observeThemeChanges(() => this.updateChart());\n this.setupResizeObserver();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.chart?.destroy();\n this.themeObserver?.disconnect();\n this.resizeObserver?.disconnect();\n }\n\n /**\n * Crossing MIN_HEIGHT_WITH_LABELS changes the plugin set, so the chart is\n * rebuilt rather than updated.\n */\n private setupResizeObserver() {\n if (!this.canvasEl) return;\n\n this.resizeObserver = observeLabelThreshold(\n this.canvasEl,\n () =>\n (this.canvasEl?.clientHeight ?? 0) >=\n RADIAL_BAR_DIMENSIONS.MIN_HEIGHT_WITH_LABELS,\n {\n rebuild: () => {\n this.chart?.destroy();\n this.createChart();\n },\n update: () => this.updateChart(),\n }\n );\n }\n\n private prepareChartData() {\n const chartColors = getChartColorsOrDefault(\n this,\n this.colors,\n this.priority === Priority.enhanced\n ? CHART_SECTOR_ENHANCED_COLORS\n : CHART_SECTOR_DEFAULT_COLORS\n );\n const remainingColor = getCssVariableValue(\n this,\n RADIAL_BAR_DIMENSIONS.REMAINING_COLOR\n );\n const borderColor = getCssVariableValue(\n this,\n RADIAL_BAR_DIMENSIONS.GAP_AND_BORDER_COLOR\n );\n\n // Reduce spacing for small charts to save space\n // Border is 2px on each side (top + bottom), so 4px total becomes 2px total\n const height = this.canvasEl?.clientHeight ?? 0;\n const isTooSmall = height < RADIAL_BAR_DIMENSIONS.MIN_HEIGHT_WITH_LABELS;\n const effectiveSpacing = isTooSmall\n ? RADIAL_BAR_DIMENSIONS.SPACING / 2\n : RADIAL_BAR_DIMENSIONS.SPACING;\n\n const datasets = this.data.map((value, index) => {\n const remaining = Math.max(0, this.max - value);\n const color =\n chartColors[index % chartColors.length] ??\n CHART_SECTOR_DEFAULT_COLORS[0];\n\n return {\n data: [value, remaining],\n backgroundColor: [color, remainingColor],\n borderWidth: effectiveSpacing, // Use reduced spacing for small charts (1px + 1px borders)\n borderColor: borderColor, // Use container section color for gaps\n borderRadius: RADIAL_BAR_DIMENSIONS.BORDER_RADIUS,\n spacing: 0, // Spacing between colored and remaining segments\n weight: 1, // Equal weight for all rings\n };\n });\n\n return {datasets};\n }\n\n private getChartOptions(): ChartOptions<'doughnut'> {\n // Always start at 12 o'clock (top) and move clockwise\n const rotation = 0;\n\n // Use centralized layout calculation helper\n // Note: Radial bar charts don't have outer labels\n // Important: Always use full circle mode (isHalfMode = false) regardless of circumference (half is for donut chart only)\n // The circumference property only affects what portion of the circle is shown,\n // not the dimensions/layout calculation\n const dimensions = calculateFixedHeightChartLayout({\n fixedHeight: this.fixedHeight,\n isHalfMode: false, // Always full circle dimensions, circumference only controls what's shown\n showOuterLabels: false, // Radial bar charts don't have outer labels\n canvasEl: this.canvasEl,\n layoutConfig: {\n data: [], // No data labels for radial bars\n denominator: 100,\n },\n host: this,\n });\n\n // Store dimensions for explicit canvas sizing in createChart/updateChart\n this.lastDimensions = dimensions;\n\n // Set CSS variables for wrapper and canvas sizing\n this.style.setProperty('--chart-width', `${dimensions.calculatedWidth}px`);\n this.style.setProperty('--chart-height', `${dimensions.actualHeight}px`);\n\n // Calculate dynamic padding for Chart.js layout\n // Reduce padding by 1px to compensate for 2px wider chart diameter (258px vs 256px)\n const dynamicPadding = dimensions.isTooSmall\n ? 0 // No padding when too small\n : RADIAL_BAR_DIMENSIONS.CANVAS_PADDING;\n\n // Calculate chart diameter from dimensions\n // The chart area is inside the padding, so subtract padding from both sides\n // For larger charts (>= 192px), use RADIAL_BAR_DIMENSIONS.CHART_WIDTH (258px) to compensate for outer border\n // For small charts, calculate based on actual height\n const chartDiameter = dimensions.isTooSmall\n ? dimensions.actualHeight - dynamicPadding * 2\n : RADIAL_BAR_DIMENSIONS.CHART_WIDTH; // 258px: adds 2px to compensate for outer border visual appearance\n\n // Calculate optimal cutout based on number of rings and available space\n const {cutout: optimalCutout} = this.calculateOptimalLayout(\n chartDiameter,\n dimensions.isTooSmall\n );\n\n return {\n // Chart.js responsive mode stays off — see the note in donut-chart.ts (#1061).\n responsive: false,\n maintainAspectRatio: false,\n devicePixelRatio: window.devicePixelRatio,\n rotation,\n circumference: this.circumference,\n cutout: `${optimalCutout}%`,\n layout: {\n padding: {\n top: dynamicPadding,\n right: dynamicPadding,\n bottom: dynamicPadding,\n left: dynamicPadding,\n },\n },\n plugins: {\n legend: {\n display: false,\n labels: {\n generateLabels: () => [], // Prevent Chart.js from generating labels internally\n },\n onClick: () => {}, // Disable legend click handler\n },\n tooltip: {\n ...getChartTooltipOptions(this),\n enabled: !dimensions.isTooSmall,\n filter: (tooltipItem) => tooltipItem.label !== 'Remaining',\n callbacks: {\n title: () => '',\n label: (context) => {\n // Show correct ring label and value for each dataset\n const datasetIndex = context.datasetIndex;\n const valueIndex = context.dataIndex;\n // Only show tooltip for the filled segment (index 0)\n if (valueIndex !== 0) return '';\n const ringLabel = `Ring ${datasetIndex + 1}`;\n const value = context.parsed;\n return `${ringLabel} ${value}`;\n },\n },\n },\n },\n animation: {\n animateRotate: false,\n animateScale: false,\n },\n };\n }\n\n private createChart() {\n // Guard: Verify canvas exists and is connected to DOM\n if (!this.canvasEl || !this.canvasEl.isConnected) return;\n\n const ctx = this.canvasEl.getContext('2d');\n if (!ctx) return;\n\n const {datasets} = this.prepareChartData();\n const options = this.getChartOptions();\n\n // Non-responsive mode: set the canvas render size explicitly from the\n // computed layout; Chart.js applies devicePixelRatio scaling on top\n if (this.lastDimensions) {\n this.canvasEl.width = this.lastDimensions.calculatedWidth;\n this.canvasEl.height = this.lastDimensions.actualHeight;\n }\n\n this.chart = new Chart(ctx, {\n type: 'doughnut',\n data: {\n labels: this.data.map((_, i) => `Ring ${i + 1}`),\n datasets,\n },\n options,\n });\n\n // Defer legend update to next tick to ensure Chart.js metadata is initialized\n requestAnimationFrame(() => this.updateLegend());\n }\n\n private updateChart() {\n // Guard: Verify chart and canvas still exist and are connected\n if (!this.chart || !this.canvasEl || !this.canvasEl.isConnected) return;\n\n const {datasets} = this.prepareChartData();\n\n this.chart.data.labels = this.data.map((_, i) => `Ring ${i + 1}`);\n this.chart.data.datasets = datasets;\n\n // Recalculate options with current dimensions\n const newOptions = this.getChartOptions();\n\n if (this.chart.options) {\n // Update all dynamic options\n Object.assign(this.chart.options, newOptions);\n }\n\n // Non-responsive mode: apply the computed layout size explicitly\n // (no-op when the size is unchanged)\n if (this.lastDimensions) {\n this.chart.resize(\n this.lastDimensions.calculatedWidth,\n this.lastDimensions.actualHeight\n );\n }\n\n this.chart.update();\n\n // Update legend after chart update completes to ensure metadata is ready\n requestAnimationFrame(() => this.updateLegend());\n }\n\n /**\n * Update the legend HTML content\n */\n private updateLegend() {\n // Guard: Check if legend should be shown and chart is ready\n if (!this.legend || !this.legendDiv || !this.chart) return;\n\n // Guard: Check if dataset has data\n if (!this.data || this.data.length === 0) {\n this.legendDiv.innerHTML = '';\n return;\n }\n\n try {\n const chartColors = getChartColorsOrDefault(\n this,\n this.colors,\n this.priority === Priority.enhanced\n ? CHART_SECTOR_ENHANCED_COLORS\n : CHART_SECTOR_DEFAULT_COLORS\n );\n\n const legendItems = this.data.map((value, i) => {\n const color =\n chartColors[i % chartColors.length] ??\n (this.priority === Priority.enhanced\n ? CHART_SECTOR_ENHANCED_COLORS[0]\n : CHART_SECTOR_DEFAULT_COLORS[0]);\n\n return {\n fillStyle: color,\n label: `Ring ${i + 1}`,\n value: value.toString(),\n unit: '',\n };\n });\n\n const legendHTML = generateLegendHTML(legendItems);\n this.legendDiv.innerHTML = legendHTML;\n } catch (error) {\n console.debug(\n '[obc-radial-bar-chart] updateLegend: error generating legend HTML',\n error\n );\n // Silent failure - don't throw, just skip legend update this time\n }\n }\n override render() {\n const wrapperClasses = {\n wrapper: true,\n debug: this.showDebugOverlay,\n };\n\n return html`\n <div class=${classMap(wrapperClasses)}>\n <canvas></canvas>\n ${this.legend ? html`<div class=\"legend\"></div>` : ''}\n </div>\n `;\n }\n\n static override styles = [\n unsafeCSS(componentStyle),\n unsafeCSS(chartCommonStyle),\n unsafeCSS(chartLegendStyle),\n unsafeCSS(chartDebugStyle),\n ];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-radial-bar-chart': ObcRadialBarChart;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,SAAS,oBAAoB,YAAY,OAAO;AAGtD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,CAAC,CAAA,GAAA,kBAAA,WAAA,eAAA,KAAA,CAAA;AAEtC,WAAA,CAAA,SAAS,EACR,MAAM,OACR,CAAC,CAAA,GAAA,kBAAA,WAAA,oBAAA,KAAA,CAAA;AAIA,WAAA,CAAA,MAAM,QAAQ,CAAA,GAAA,kBAAA,WAAA,YAAA,KAAA,CAAA;AAGd,WAAA,CAAA,MAAM,SAAS,CAAA,GAAA,kBAAA,WAAA,aAAA,KAAA,CAAA;AAzBjB,oBAAA,WAAA,CAAA,cAAc,sBAAsB,CAAA,GAAA,iBAAA"}
1
+ {"version":3,"file":"radial-bar-chart.js","names":[],"sources":["../../../src/bars-graphs/radial-bar-chart/radial-bar-chart.ts"],"sourcesContent":["import {LitElement, PropertyValues, html, unsafeCSS} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport componentStyle from './radial-bar-chart.css?inline';\nimport chartCommonStyle from '../../charthelpers/chart-common.css?inline';\nimport chartDebugStyle from '../../charthelpers/chart-debug.css?inline';\nimport chartLegendStyle from '../../charthelpers/chart-legend.css?inline';\nimport {customElement} from '../../decorator.js';\nimport {Priority} from '../../navigation-instruments/types.js';\nimport {Chart, DoughnutController, ArcElement, Tooltip} from 'chart.js';\nimport type {ChartOptions} from 'chart.js';\nimport {\n CHART_SECTOR_DEFAULT_COLORS,\n CHART_SECTOR_ENHANCED_COLORS,\n CHART_DIMENSIONS,\n getCssVariableValue,\n getChartColorsOrDefault,\n observeThemeChanges,\n calculateFixedHeightChartLayout,\n getChartTooltipOptions,\n renderLegend,\n observeLabelThreshold,\n} from '../../charthelpers/index.js';\nimport type {FixedHeightChartDimensions} from '../../charthelpers/canvas-layout.js';\n\n// Register Chart.js components\nChart.register(DoughnutController, ArcElement, Tooltip);\n\n// Radial-bar-specific dimension constants\nconst RADIAL_BAR_DIMENSIONS = {\n ...CHART_DIMENSIONS,\n CHART_WIDTH: 258, // Override: 256 + 2px to compensate for outer border visual appearance\n CANVAS_PADDING: 30, // Recude by the above 2px to keep chart area consistent\n GAP_AND_BORDER_COLOR: '--container-background-color',\n REMAINING_COLOR: '--border-outline-color',\n BORDER_RADIUS: 4,\n SPACING: 4, // Gap between rings in pixels (2px border on each side)\n MIN_RING_THICKNESS: 16, // Minimum visible arc thickness in pixels (excluding borders)\n MIN_CUTOUT_PERCENT: 20, // Minimum cutout percentage to maintain empty center\n DEFAULT_MAX_CUTOUT_PERCENT: 60, // Default/maximum cutout percentage when space allows\n} as const;\n\n// Properties that require chart recreation (destroy and create)\nconst RADIAL_BAR_RECREATE_PROP_NAMES = [\n 'circumference',\n 'showDebugOverlay',\n 'fixedHeight',\n 'minRingThickness',\n] as const;\n\n// All properties that trigger chart updates\nconst RADIAL_BAR_WATCHED_PROP_NAMES = [\n 'legend',\n 'data',\n 'colors',\n 'priority',\n 'max',\n 'circumference',\n 'showDebugOverlay',\n 'fixedHeight',\n 'minRingThickness',\n] as const;\n\n/**\n * `<obc-radial-bar-chart>` – A customizable radial bar chart for visualizing multiple metrics as concentric rings, with dynamic ring thickness and cutout calculation.\n *\n * This component renders multiple data values as concentric arcs (rings), each representing a different metric. It supports full circle (360°) or three-quarter circle (270°) layouts, dynamic ring thickness, and automatic cutout calculation to ensure all rings fit within the available space. The chart adapts its layout based on the number of rings and available space, and hides labels when the chart is too small (< 192px height) for clarity.\n *\n * ## Features\n * - **Fixed Height ⇒ Fixed Circumference:** The chart's circumference is determined by the `fixedHeight` property (default: 320px). This ensures the chart's circumference remains consistent and matches other radial instruments, regardless of the available browser or container width. The chart does not scale to fill the width; instead, it always uses the specified fixed height to define its size and circumference.\n * - **Layout:**\n * - Full 360° or 270° (three-quarter) circle layout, controlled by the `circumference` property.\n * - Multiple concentric rings, each representing a data value.\n * - **Dynamic Ring Thickness:**\n * - All rings maintain equal thickness when possible.\n * - The `cutout` value serves as the maximum/preferred cutout percentage.\n * - When many rings are present, cutout is automatically reduced to fit rings at `minRingThickness`.\n * - Cutout will not go below 20% (minimum to maintain visible center).\n * - If rings still don't fit with 20% cutout, ring thickness is reduced proportionally.\n * - **Customization:**\n * - Custom ring colors (with automatic fallback to theme palette).\n * - Adjustable minimum ring thickness (`minRingThickness`).\n * - Adjustable arc span (`circumference`).\n * - **Color Priority:** Set `priority` to `Priority.enhanced` to use the blue/enhanced\n * color palette instead of the default gray/regular palette (default: `Priority.regular`).\n * - **Capacity Visualization:**\n * - Each ring shows a filled and remaining segment based on the `max` value.\n * - **Responsive Behavior:**\n * - Automatically hides labels and reduces spacing when height < 192px.\n * - Maintains aspect ratio and adjusts padding for optimal ring positioning.\n * - **Theme Integration:**\n * - Colors update automatically when the `data-obc-theme` attribute changes on the `<html>` element.\n * - Example:\n * ```html\n * <html lang=\"en\" data-obc-theme=\"day\"></html>\n * ```\n *\n * ## Example\n *\n * **Basic Usage**\n * ```html\n * <obc-radial-bar-chart></obc-radial-bar-chart>\n * <script>\n * document.querySelector('obc-radial-bar-chart').data = [70, 50, 30];\n * </script>\n * ```\n *\n * **Three-Quarter Circle with Custom Colors**\n * ```html\n * <obc-radial-bar-chart></obc-radial-bar-chart>\n * <script>\n * const chart = document.querySelector('obc-radial-bar-chart');\n * chart.circumference = 270;\n * chart.data = [80, 60, 40, 20];\n * chart.colors = ['#e74c3c', '#f39c12', '#2ecc71', '#3498db'];\n * </script>\n * ```\n *\n * **Custom Minimum Ring Thickness and Max Value**\n * ```html\n * <obc-radial-bar-chart></obc-radial-bar-chart>\n * <script>\n * const chart = document.querySelector('obc-radial-bar-chart');\n * chart.minRingThickness = 20;\n * chart.max = 200;\n * chart.data = [120, 80, 40];\n * </script>\n * ```\n *\n * @property data - Array of values for each ring (set via JavaScript)\n * @property colors - Custom ring colors (set via JavaScript) with fallback to theme palette\n * @property max - Maximum value for calculating remaining empty area, default: 100\n * @property circumference - Arc span in degrees: 360 for full circle, 270 for 3/4 circle, default: 270\n * @property legend - Whether to display the legend below the chart, default: false\n * @property showDebugOverlay - Show debug overlay for development, default: false\n * @property fixedHeight - Fixed height of the chart in pixels (determines chart circumference), default: 320. The chart's circumference is always based on this fixed height to match other radial instruments.\n * @property minRingThickness - Minimum thickness of each ring in pixels, excluding borders, default: 16\n * @beta\n */\n@customElement('obc-radial-bar-chart')\nexport class ObcRadialBarChart extends LitElement {\n @property({type: Array, attribute: false}) data: number[] = [];\n @property({type: Array, attribute: false}) colors: string[] = [];\n @property({type: String})\n priority: Priority = Priority.regular;\n @property({type: Number})\n max = 100;\n @property({type: Number})\n circumference = 270;\n @property({type: Boolean, reflect: true})\n legend = false;\n @property({type: Boolean, reflect: true})\n showDebugOverlay = false;\n @property({type: Number, reflect: true})\n fixedHeight = 320;\n @property({\n type: Number,\n })\n minRingThickness = 16;\n\n /** @internal */\n @query('canvas') private canvasEl?: HTMLCanvasElement;\n\n /** @internal */\n @query('.legend') private legendDiv?: HTMLDivElement;\n\n /** @internal */\n private chart?: Chart;\n\n /** @internal - Latest layout dimensions computed by getChartOptions() */\n private lastDimensions?: FixedHeightChartDimensions;\n\n /** @internal */\n private themeObserver?: MutationObserver;\n\n /** @internal - ResizeObserver for tracking height threshold crossings */\n private resizeObserver?: ResizeObserver;\n\n private hasAnyChanged(\n changed: PropertyValues,\n props: readonly (keyof ObcRadialBarChart)[]\n ): boolean {\n return props.some((prop) => changed.has(prop));\n }\n\n /**\n * Calculate optimal cutout percentage and whether rings should use minimum thickness\n * based on available chart space and number of rings.\n *\n * Algorithm:\n * 1. Calculate total space needed for all rings at minRingThickness\n * 2. If enough space: use equal thickness and adjust cutout\n * 3. If not enough space with minCutout: reduce cutout to minimum\n * 4. If still not enough: rings must be thinner than minimum\n *\n * @param chartDiameter - Available chart diameter in pixels\n * @param isTooSmall - Whether chart is below MIN_HEIGHT_WITH_LABELS (affects border width)\n * @returns Object with calculated cutout percentage and flag for using minimum thickness\n */\n private calculateOptimalLayout(\n chartDiameter: number,\n isTooSmall: boolean\n ): {\n cutout: number;\n useMinThickness: boolean;\n } {\n const numRings = this.data.length;\n if (numRings === 0) {\n return {\n cutout: RADIAL_BAR_DIMENSIONS.DEFAULT_MAX_CUTOUT_PERCENT,\n useMinThickness: false,\n };\n }\n\n // Calculate total space per ring: minRingThickness + borders (spacing applied as borderWidth)\n // Border is applied on both sides, so total border = spacing (or spacing/2 for small charts)\n const effectiveSpacing = isTooSmall\n ? RADIAL_BAR_DIMENSIONS.SPACING / 2\n : RADIAL_BAR_DIMENSIONS.SPACING;\n const totalSpacePerRing = this.minRingThickness + effectiveSpacing;\n\n // Calculate radius (half of diameter)\n const radius = chartDiameter / 2;\n\n // Calculate total space needed for all rings\n const totalRingsSpace = numRings * totalSpacePerRing;\n\n // Calculate remaining space for cutout\n const remainingSpace = radius - totalRingsSpace;\n\n // Convert remaining space to cutout percentage\n const calculatedCutoutPercent = (remainingSpace / radius) * 100;\n\n // Check if we can fit all rings with minimum thickness\n if (calculatedCutoutPercent >= RADIAL_BAR_DIMENSIONS.MIN_CUTOUT_PERCENT) {\n // We have enough space - use minimum thickness and calculated cutout\n return {\n cutout: Math.min(\n calculatedCutoutPercent,\n RADIAL_BAR_DIMENSIONS.DEFAULT_MAX_CUTOUT_PERCENT\n ),\n useMinThickness: true,\n };\n } else {\n // Not enough space - try with minimum cutout\n const minCutoutSpace =\n (radius * RADIAL_BAR_DIMENSIONS.MIN_CUTOUT_PERCENT) / 100;\n const availableRingSpace = radius - minCutoutSpace;\n const spacePerRingWithMinCutout = availableRingSpace / numRings;\n\n if (spacePerRingWithMinCutout >= totalSpacePerRing) {\n // We can fit with minimum cutout\n return {\n cutout: RADIAL_BAR_DIMENSIONS.MIN_CUTOUT_PERCENT,\n useMinThickness: true,\n };\n } else {\n // Can't fit even with minimum cutout - rings must be thinner\n return {\n cutout: RADIAL_BAR_DIMENSIONS.MIN_CUTOUT_PERCENT,\n useMinThickness: false,\n };\n }\n }\n }\n\n // Update external library AFTER render\n override updated(changed: PropertyValues) {\n super.updated(changed);\n\n if (this.hasAnyChanged(changed, RADIAL_BAR_WATCHED_PROP_NAMES)) {\n // Recreate chart when major layout properties change\n // These properties affect aspect ratio calculation or require plugin reconfiguration\n const needsRecreation = this.hasAnyChanged(\n changed,\n RADIAL_BAR_RECREATE_PROP_NAMES\n );\n\n if (needsRecreation) {\n this.chart?.destroy();\n this.createChart();\n } else {\n this.updateChart();\n }\n }\n }\n\n override firstUpdated() {\n this.createChart();\n this.themeObserver = observeThemeChanges(() => this.updateChart());\n this.setupResizeObserver();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.chart?.destroy();\n this.themeObserver?.disconnect();\n this.resizeObserver?.disconnect();\n }\n\n /**\n * Crossing MIN_HEIGHT_WITH_LABELS changes the plugin set, so the chart is\n * rebuilt rather than updated.\n */\n private setupResizeObserver() {\n if (!this.canvasEl) return;\n\n this.resizeObserver = observeLabelThreshold(\n this.canvasEl,\n () =>\n (this.canvasEl?.clientHeight ?? 0) >=\n RADIAL_BAR_DIMENSIONS.MIN_HEIGHT_WITH_LABELS,\n {\n rebuild: () => {\n this.chart?.destroy();\n this.createChart();\n },\n update: () => this.updateChart(),\n }\n );\n }\n\n private prepareChartData() {\n const chartColors = getChartColorsOrDefault(\n this,\n this.colors,\n this.priority === Priority.enhanced\n ? CHART_SECTOR_ENHANCED_COLORS\n : CHART_SECTOR_DEFAULT_COLORS\n );\n const remainingColor = getCssVariableValue(\n this,\n RADIAL_BAR_DIMENSIONS.REMAINING_COLOR\n );\n const borderColor = getCssVariableValue(\n this,\n RADIAL_BAR_DIMENSIONS.GAP_AND_BORDER_COLOR\n );\n\n // Reduce spacing for small charts to save space\n // Border is 2px on each side (top + bottom), so 4px total becomes 2px total\n const height = this.canvasEl?.clientHeight ?? 0;\n const isTooSmall = height < RADIAL_BAR_DIMENSIONS.MIN_HEIGHT_WITH_LABELS;\n const effectiveSpacing = isTooSmall\n ? RADIAL_BAR_DIMENSIONS.SPACING / 2\n : RADIAL_BAR_DIMENSIONS.SPACING;\n\n const datasets = this.data.map((value, index) => {\n const remaining = Math.max(0, this.max - value);\n const color =\n chartColors[index % chartColors.length] ??\n CHART_SECTOR_DEFAULT_COLORS[0];\n\n return {\n data: [value, remaining],\n backgroundColor: [color, remainingColor],\n borderWidth: effectiveSpacing, // Use reduced spacing for small charts (1px + 1px borders)\n borderColor: borderColor, // Use container section color for gaps\n borderRadius: RADIAL_BAR_DIMENSIONS.BORDER_RADIUS,\n spacing: 0, // Spacing between colored and remaining segments\n weight: 1, // Equal weight for all rings\n };\n });\n\n return {datasets};\n }\n\n private getChartOptions(): ChartOptions<'doughnut'> {\n // Always start at 12 o'clock (top) and move clockwise\n const rotation = 0;\n\n // Use centralized layout calculation helper\n // Note: Radial bar charts don't have outer labels\n // Important: Always use full circle mode (isHalfMode = false) regardless of circumference (half is for donut chart only)\n // The circumference property only affects what portion of the circle is shown,\n // not the dimensions/layout calculation\n const dimensions = calculateFixedHeightChartLayout({\n fixedHeight: this.fixedHeight,\n isHalfMode: false, // Always full circle dimensions, circumference only controls what's shown\n showOuterLabels: false, // Radial bar charts don't have outer labels\n canvasEl: this.canvasEl,\n layoutConfig: {\n data: [], // No data labels for radial bars\n denominator: 100,\n },\n host: this,\n });\n\n // Store dimensions for explicit canvas sizing in createChart/updateChart\n this.lastDimensions = dimensions;\n\n // Set CSS variables for wrapper and canvas sizing\n this.style.setProperty('--chart-width', `${dimensions.calculatedWidth}px`);\n this.style.setProperty('--chart-height', `${dimensions.actualHeight}px`);\n\n // Calculate dynamic padding for Chart.js layout\n // Reduce padding by 1px to compensate for 2px wider chart diameter (258px vs 256px)\n const dynamicPadding = dimensions.isTooSmall\n ? 0 // No padding when too small\n : RADIAL_BAR_DIMENSIONS.CANVAS_PADDING;\n\n // Calculate chart diameter from dimensions\n // The chart area is inside the padding, so subtract padding from both sides\n // For larger charts (>= 192px), use RADIAL_BAR_DIMENSIONS.CHART_WIDTH (258px) to compensate for outer border\n // For small charts, calculate based on actual height\n const chartDiameter = dimensions.isTooSmall\n ? dimensions.actualHeight - dynamicPadding * 2\n : RADIAL_BAR_DIMENSIONS.CHART_WIDTH; // 258px: adds 2px to compensate for outer border visual appearance\n\n // Calculate optimal cutout based on number of rings and available space\n const {cutout: optimalCutout} = this.calculateOptimalLayout(\n chartDiameter,\n dimensions.isTooSmall\n );\n\n return {\n // Chart.js responsive mode stays off — see the note in donut-chart.ts (#1061).\n responsive: false,\n maintainAspectRatio: false,\n devicePixelRatio: window.devicePixelRatio,\n rotation,\n circumference: this.circumference,\n cutout: `${optimalCutout}%`,\n layout: {\n padding: {\n top: dynamicPadding,\n right: dynamicPadding,\n bottom: dynamicPadding,\n left: dynamicPadding,\n },\n },\n plugins: {\n legend: {\n display: false,\n labels: {\n generateLabels: () => [], // Prevent Chart.js from generating labels internally\n },\n onClick: () => {}, // Disable legend click handler\n },\n tooltip: {\n ...getChartTooltipOptions(this),\n enabled: !dimensions.isTooSmall,\n filter: (tooltipItem) => tooltipItem.label !== 'Remaining',\n callbacks: {\n title: () => '',\n label: (context) => {\n // Show correct ring label and value for each dataset\n const datasetIndex = context.datasetIndex;\n const valueIndex = context.dataIndex;\n // Only show tooltip for the filled segment (index 0)\n if (valueIndex !== 0) return '';\n const ringLabel = `Ring ${datasetIndex + 1}`;\n const value = context.parsed;\n return `${ringLabel} ${value}`;\n },\n },\n },\n },\n animation: {\n animateRotate: false,\n animateScale: false,\n },\n };\n }\n\n private createChart() {\n // Guard: Verify canvas exists and is connected to DOM\n if (!this.canvasEl || !this.canvasEl.isConnected) return;\n\n const ctx = this.canvasEl.getContext('2d');\n if (!ctx) return;\n\n const {datasets} = this.prepareChartData();\n const options = this.getChartOptions();\n\n // Non-responsive mode: set the canvas render size explicitly from the\n // computed layout; Chart.js applies devicePixelRatio scaling on top\n if (this.lastDimensions) {\n this.canvasEl.width = this.lastDimensions.calculatedWidth;\n this.canvasEl.height = this.lastDimensions.actualHeight;\n }\n\n this.chart = new Chart(ctx, {\n type: 'doughnut',\n data: {\n labels: this.data.map((_, i) => `Ring ${i + 1}`),\n datasets,\n },\n options,\n });\n\n // Defer legend update to next tick to ensure Chart.js metadata is initialized\n requestAnimationFrame(() => this.updateLegend());\n }\n\n private updateChart() {\n // Guard: Verify chart and canvas still exist and are connected\n if (!this.chart || !this.canvasEl || !this.canvasEl.isConnected) return;\n\n const {datasets} = this.prepareChartData();\n\n this.chart.data.labels = this.data.map((_, i) => `Ring ${i + 1}`);\n this.chart.data.datasets = datasets;\n\n // Recalculate options with current dimensions\n const newOptions = this.getChartOptions();\n\n if (this.chart.options) {\n // Update all dynamic options\n Object.assign(this.chart.options, newOptions);\n }\n\n // Non-responsive mode: apply the computed layout size explicitly\n // (no-op when the size is unchanged)\n if (this.lastDimensions) {\n this.chart.resize(\n this.lastDimensions.calculatedWidth,\n this.lastDimensions.actualHeight\n );\n }\n\n this.chart.update();\n\n // Update legend after chart update completes to ensure metadata is ready\n requestAnimationFrame(() => this.updateLegend());\n }\n\n /**\n * Update the legend HTML content\n */\n private updateLegend() {\n // Guard: Check if legend should be shown and chart is ready\n if (!this.legend || !this.legendDiv || !this.chart) return;\n\n // Guard: Check if dataset has data\n if (!this.data || this.data.length === 0) {\n renderLegend(this.legendDiv, []);\n return;\n }\n\n try {\n const chartColors = getChartColorsOrDefault(\n this,\n this.colors,\n this.priority === Priority.enhanced\n ? CHART_SECTOR_ENHANCED_COLORS\n : CHART_SECTOR_DEFAULT_COLORS\n );\n\n const legendItems = this.data.map((value, i) => {\n const color =\n chartColors[i % chartColors.length] ??\n (this.priority === Priority.enhanced\n ? CHART_SECTOR_ENHANCED_COLORS[0]\n : CHART_SECTOR_DEFAULT_COLORS[0]);\n\n return {\n fillStyle: color,\n label: `Ring ${i + 1}`,\n value: value.toString(),\n unit: '',\n };\n });\n\n renderLegend(this.legendDiv, legendItems);\n } catch (error) {\n console.debug(\n '[obc-radial-bar-chart] updateLegend: error generating legend HTML',\n error\n );\n // Silent failure - don't throw, just skip legend update this time\n }\n }\n override render() {\n const wrapperClasses = {\n wrapper: true,\n debug: this.showDebugOverlay,\n };\n\n return html`\n <div class=${classMap(wrapperClasses)}>\n <canvas></canvas>\n ${this.legend ? html`<div class=\"legend\"></div>` : ''}\n </div>\n `;\n }\n\n static override styles = [\n unsafeCSS(componentStyle),\n unsafeCSS(chartCommonStyle),\n unsafeCSS(chartLegendStyle),\n unsafeCSS(chartDebugStyle),\n ];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-radial-bar-chart': ObcRadialBarChart;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,SAAS,oBAAoB,YAAY,OAAO;AAGtD,IAAM,wBAAwB;CAC5B,GAAG;CACH,aAAa;CACb,gBAAgB;CAChB,sBAAsB;CACtB,iBAAiB;CACjB,eAAe;CACf,SAAS;CACT,oBAAoB;CACpB,oBAAoB;CACpB,4BAA4B;AAC9B;AAGA,IAAM,iCAAiC;CACrC;CACA;CACA;CACA;AACF;AAGA,IAAM,gCAAgC;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AA+EO,IAAM,oBAAN,MAAM,0BAA0B,WAAW;;;EACY,KAAA,OAAA,CAAC;EACC,KAAA,SAAA,CAAC;EAE1C,KAAA,WAAA,SAAS;EAExB,KAAA,MAAA;EAEU,KAAA,gBAAA;EAEP,KAAA,SAAA;EAEU,KAAA,mBAAA;EAEL,KAAA,cAAA;EAIK,KAAA,mBAAA;;CAoBnB,cACE,SACA,OACS;EACT,OAAO,MAAM,MAAM,SAAS,QAAQ,IAAI,IAAI,CAAC;CAC/C;;;;;;;;;;;;;;;CAgBA,uBACE,eACA,YAIA;EACA,MAAM,WAAW,KAAK,KAAK;EAC3B,IAAI,aAAa,GACf,OAAO;GACL,QAAQ,sBAAsB;GAC9B,iBAAiB;EACnB;EAKF,MAAM,mBAAmB,aACrB,sBAAsB,UAAU,IAChC,sBAAsB;EAC1B,MAAM,oBAAoB,KAAK,mBAAmB;EAGlD,MAAM,SAAS,gBAAgB;EAS/B,MAAM,2BAHiB,SAHC,WAAW,qBAMe,SAAU;EAG5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B,aAAa,UAAO,GAiIG,YAAY,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;IAGvD;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,WAAW;IAsCnB,OAAO,CAAC,WAAW;IAoBnB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAczB;;OAEG;IACH,OAAO,CAAC,YAAY;IAkDX,MAAM;IAgCf,OAAgB,MAAM,4BAKpB;CACH"}
@@ -4,7 +4,7 @@ import { formatChartNumber } from "../../charthelpers/canvas-layout.js";
4
4
  import { observeThemeChanges } from "../../charthelpers/theme.js";
5
5
  import { clamp } from "../../svghelpers/math.js";
6
6
  import { getChartTooltipOptions } from "../../charthelpers/tooltip.js";
7
- import { generateLegendHTML } from "../../charthelpers/legend.js";
7
+ import { renderLegend } from "../../charthelpers/legend.js";
8
8
  import { XValueMode, formatXValue, normalizeXValue } from "../../charthelpers/x-value.js";
9
9
  import { observeLabelThreshold } from "../../charthelpers/label-threshold.js";
10
10
  import { formatRangeValue, measureRangeLabelGutters, rangeLabelFontString, rangeLabelLineHeight, yRangeLabelValues } from "../../charthelpers/range-labels.js";
@@ -2009,7 +2009,7 @@ var ObcChartLineBase = class extends LitElement {
2009
2009
  updateLegend() {
2010
2010
  if (!this.legend || !this.legendDiv || !this.chart) return;
2011
2011
  if (!this.chart.data.datasets || this.chart.data.datasets.length === 0) {
2012
- this.legendDiv.innerHTML = "";
2012
+ renderLegend(this.legendDiv, []);
2013
2013
  return;
2014
2014
  }
2015
2015
  try {
@@ -2025,10 +2025,7 @@ var ObcChartLineBase = class extends LitElement {
2025
2025
  unit: ""
2026
2026
  };
2027
2027
  }).filter((item) => item !== null);
2028
- if (legendItems.length > 0) {
2029
- const legendHTML = generateLegendHTML(legendItems);
2030
- this.legendDiv.innerHTML = legendHTML;
2031
- }
2028
+ if (legendItems.length > 0) renderLegend(this.legendDiv, legendItems);
2032
2029
  } catch (error) {
2033
2030
  console.debug("[chart-line-base] updateLegend: error generating legend HTML", error);
2034
2031
  }