@acorex/charts 21.1.0-next.2 → 22.0.0-next.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.
@@ -54,7 +54,8 @@ function getChartColor(index, palette) {
54
54
  */
55
55
  class AXChartComponent {
56
56
  #elementRef = inject(ElementRef);
57
- #isRendered = signal(false, ...(ngDevMode ? [{ debugName: "#isRendered" }] : /* istanbul ignore next */ []));
57
+ #isRendered = signal(false, /* @ts-ignore */
58
+ ...(ngDevMode ? [{ debugName: "#isRendered" }] : /* istanbul ignore next */ []));
58
59
  isRendered = this.#isRendered.asReadonly();
59
60
  #afterNextRender = afterNextRender(() => {
60
61
  if (!this.isRendered()) {
@@ -75,10 +76,10 @@ class AXChartComponent {
75
76
  getHostElement() {
76
77
  return this.#elementRef.nativeElement;
77
78
  }
78
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
79
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: AXChartComponent, isStandalone: true, ngImport: i0 });
79
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
80
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: AXChartComponent, isStandalone: true, ngImport: i0 });
80
81
  }
81
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXChartComponent, decorators: [{
82
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXChartComponent, decorators: [{
82
83
  type: Directive
83
84
  }] });
84
85
 
@@ -162,50 +163,42 @@ function resolveCssColorInContext(scopeElement, cssColor) {
162
163
  * considering available space in all directions and preventing overflow.
163
164
  */
164
165
  function computeTooltipPosition(containerRect, tooltipRect, clientX, clientY, gap) {
165
- const cursorX = clientX - containerRect.left;
166
- const cursorY = clientY - containerRect.top;
166
+ const containerLeft = containerRect.left;
167
+ const containerTop = containerRect.top;
168
+ const containerRight = containerRect.right;
169
+ const containerBottom = containerRect.bottom;
167
170
  if (!tooltipRect) {
168
171
  return {
169
- x: Math.min(cursorX + gap, containerRect.width - gap),
170
- y: Math.max(gap, Math.min(cursorY, containerRect.height - gap)),
172
+ x: Math.min(clientX + gap, containerRight - gap),
173
+ y: Math.max(containerTop + gap, Math.min(clientY + gap, containerBottom - gap)),
171
174
  };
172
175
  }
173
- // Calculate available space in each direction
174
- const spaceRight = containerRect.width - cursorX;
175
- const spaceLeft = cursorX;
176
- const spaceBelow = containerRect.height - cursorY;
177
- const spaceAbove = cursorY;
178
- // Determine best horizontal position
176
+ const spaceRight = containerRight - clientX;
177
+ const spaceLeft = clientX - containerLeft;
178
+ const spaceBelow = containerBottom - clientY;
179
+ const spaceAbove = clientY - containerTop;
179
180
  let x;
180
181
  if (spaceRight >= tooltipRect.width + gap) {
181
- // Position to the right of cursor
182
- x = cursorX + gap;
182
+ x = clientX + gap;
183
183
  }
184
184
  else if (spaceLeft >= tooltipRect.width + gap) {
185
- // Position to the left of cursor
186
- x = cursorX - tooltipRect.width - gap;
185
+ x = clientX - tooltipRect.width - gap;
187
186
  }
188
187
  else {
189
- // Center horizontally if neither side has enough space
190
- x = Math.max(gap, Math.min((containerRect.width - tooltipRect.width) / 2, containerRect.width - tooltipRect.width - gap));
188
+ x = Math.max(containerLeft + gap, Math.min(containerLeft + (containerRect.width - tooltipRect.width) / 2, containerRight - tooltipRect.width - gap));
191
189
  }
192
- // Determine best vertical position
193
190
  let y;
194
191
  if (spaceBelow >= tooltipRect.height + gap) {
195
- // Position below cursor
196
- y = cursorY + gap;
192
+ y = clientY + gap;
197
193
  }
198
194
  else if (spaceAbove >= tooltipRect.height + gap) {
199
- // Position above cursor
200
- y = cursorY - tooltipRect.height - gap;
195
+ y = clientY - tooltipRect.height - gap;
201
196
  }
202
197
  else {
203
- // Center vertically if neither direction has enough space
204
- y = Math.max(gap, Math.min((containerRect.height - tooltipRect.height) / 2, containerRect.height - tooltipRect.height - gap));
198
+ y = Math.max(containerTop + gap, Math.min(containerTop + (containerRect.height - tooltipRect.height) / 2, containerBottom - tooltipRect.height - gap));
205
199
  }
206
- // Ensure tooltip stays within container bounds
207
- x = Math.max(gap, Math.min(x, containerRect.width - tooltipRect.width - gap));
208
- y = Math.max(gap, Math.min(y, containerRect.height - tooltipRect.height - gap));
200
+ x = Math.max(containerLeft + gap, Math.min(x, containerRight - tooltipRect.width - gap));
201
+ y = Math.max(containerTop + gap, Math.min(y, containerBottom - tooltipRect.height - gap));
209
202
  return { x, y };
210
203
  }
211
204
  function mapEasingName(option) {
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-charts.mjs","sources":["../../../../packages/charts/src/lib/chart-colors.ts","../../../../packages/charts/src/lib/chart-component-base.ts","../../../../packages/charts/src/lib/chart-empty-state.ts","../../../../packages/charts/src/lib/chart-messages.ts","../../../../packages/charts/src/lib/chart-utils.ts","../../../../packages/charts/src/index.ts","../../../../packages/charts/src/acorex-charts.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n// Default color palette for charts\nexport const AX_CHART_COLOR_PALETTE = new InjectionToken<string[]>(\n 'AX_CHART_COLOR_PALETTE',\n {\n providedIn: 'root',\n factory: () => [\n '#FF6B6B', // Vibrant Red\n '#4ECDC4', // Electric Teal\n '#45B7D1', // Bright Blue\n '#96CEB4', // Fresh Green\n '#FFEEAD', // Bright Yellow\n '#D4A5A5', // Rose Pink\n '#9B59B6', // Rich Purple\n '#3498DB', // Deep Blue\n '#E67E22', // Bright Orange\n '#2ECC71', // Emerald Green\n '#E74C3C', // Cherry Red\n '#1ABC9C', // Turquoise\n '#F1C40F', // Golden Yellow\n '#8E44AD', // Deep Purple\n '#16A085', // Dark Teal\n\n // --- Extended Colors (new) ---\n '#27AE60', // Forest Green\n '#2980B9', // Strong Blue\n '#F39C12', // Vivid Orange\n '#C0392B', // Dark Red\n '#7D3C98', // Plum Purple\n '#2C3E50', // Midnight Blue\n '#D35400', // Burnt Orange\n '#BDC3C7', // Soft Silver\n '#34495E', // Slate Gray\n '#1F618D', // Royal Blue\n '#58D68D', // Mint Green\n '#5DADE2', // Sky Blue\n '#F1948A', // Soft Coral\n '#A569BD', // Lavender Purple\n '#F8C471', // Warm Gold\n ],\n }\n);\n\n\n/**\n * Helper function to get a color from the palette by index\n * @param index The index of the color to get\n * @param palette The color palette to use\n * @returns The color at the specified index\n */\nexport function getChartColor(index: number, palette: string[]): string {\n return palette[index % palette.length];\n}\n","import { afterNextRender, Directive, ElementRef, inject, signal } from '@angular/core';\n\n/**\n * Base component class for all chart components\n * Copied from @acorex/cdk/common NXComponent to remove external dependency\n */\n@Directive()\nexport abstract class AXChartComponent {\n #elementRef: ElementRef<HTMLElement> = inject(ElementRef);\n #isRendered = signal(false);\n\n protected isRendered = this.#isRendered.asReadonly();\n\n #afterNextRender = afterNextRender(() => {\n if (!this.isRendered()) {\n this.nativeElement['__axContext__'] = this;\n this.#isRendered.set(true);\n }\n });\n\n /**\n * Gets the native HTML element of the component\n */\n public get nativeElement(): HTMLElement {\n return this.#elementRef.nativeElement;\n }\n\n /**\n * Gets the host HTML element of the component (alias for nativeElement)\n * @returns T - The native DOM element associated with this component\n */\n public getHostElement<T = HTMLElement>(): T {\n return this.#elementRef.nativeElement as T;\n }\n}\n","export interface AXChartEmptyMessageContent {\n icon: string;\n title: string;\n help?: string;\n}\n\n/**\n * Renders a centered empty-state message inside a chart container.\n * Clears prior SVG / empty-state nodes; leaves Angular tooltip hosts alone.\n */\nexport function renderChartEmptyMessage(\n d3: { select: (node: HTMLElement) => D3EmptySelection },\n container: HTMLElement,\n message: AXChartEmptyMessageContent,\n): void {\n const root = d3.select(container);\n root.selectAll('svg, .ax-chart-empty').remove();\n\n const card = root.append('div').attr('class', 'ax-chart-empty').append('div').attr('class', 'ax-chart-empty__card');\n\n card\n .append('div')\n .attr('class', 'ax-chart-empty__icon')\n .html(`<i class=\"${message.icon} fa-2x\" aria-hidden=\"true\"></i>`);\n\n card.append('div').attr('class', 'ax-chart-empty__title').text(message.title);\n\n if (message.help) {\n card.append('div').attr('class', 'ax-chart-empty__help').text(message.help);\n }\n}\n\n/** Minimal D3 selection surface used by empty-state rendering. */\ninterface D3EmptySelection {\n selectAll: (selector: string) => { remove: () => unknown };\n append: (tag: string) => D3EmptyAppend;\n}\n\ninterface D3EmptyAppend {\n attr: (name: string, value: string) => D3EmptyAppend;\n append: (tag: string) => D3EmptyAppend;\n html: (value: string) => D3EmptyAppend;\n text: (value: string) => D3EmptyAppend;\n}\n","/**\n * Shared empty-state copy for all charts.\n * Per-chart configs may override icons; default title/help stay consistent.\n */\nexport interface AXChartMessages {\n noData?: string;\n noDataHelp?: string;\n allHidden?: string;\n allHiddenHelp?: string;\n noDataIcon?: string;\n allHiddenIcon?: string;\n}\n\nexport const AX_CHART_DEFAULT_MESSAGES: Required<AXChartMessages> = {\n noData: 'No data available',\n noDataHelp: 'Please provide data to display the chart',\n allHidden: 'All series are hidden',\n allHiddenHelp: 'Click on legend items to show them',\n noDataIcon: 'fa-light fa-chart-simple',\n allHiddenIcon: 'fa-light fa-eye-slash',\n};\n\nexport function mergeChartMessages(\n defaults: AXChartMessages = {},\n overrides?: AXChartMessages,\n): Required<AXChartMessages> {\n return {\n ...AX_CHART_DEFAULT_MESSAGES,\n ...defaults,\n ...overrides,\n };\n}\n\n/** Shallow merge options while preserving nested margin/messages defaults. */\nexport function mergeChartOptions<T extends object>(defaults: T, options?: Partial<T> | null): T {\n const opts = (options ?? {}) as Partial<T>;\n const result = { ...defaults, ...opts } as T & {\n messages?: AXChartMessages;\n margins?: object;\n margin?: object;\n };\n\n const defaultRecord = defaults as {\n messages?: AXChartMessages;\n margins?: object;\n margin?: object;\n };\n const optionRecord = opts as {\n messages?: AXChartMessages;\n margins?: object;\n margin?: object;\n };\n\n if (defaultRecord.messages || optionRecord.messages) {\n result.messages = mergeChartMessages(defaultRecord.messages, optionRecord.messages);\n }\n if (defaultRecord.margins || optionRecord.margins) {\n result.margins = { ...defaultRecord.margins, ...optionRecord.margins };\n }\n if (defaultRecord.margin || optionRecord.margin) {\n result.margin = { ...defaultRecord.margin, ...optionRecord.margin };\n }\n\n return result;\n}\n","export type TooltipPosition = { x: number; y: number };\n\n/**\n * Resolves any CSS `<color>` the browser understands — including\n * `rgb(var(--token))`, `hsl(var(--token))`, `color-mix()`, etc. — to a computed\n * `rgb()` / `rgba()` string, using the cascade from `scopeElement` (e.g. the chart\n * container) so design tokens on ancestors apply.\n */\nexport function resolveCssColorInContext(scopeElement: HTMLElement, cssColor: string): string {\n if (typeof window === 'undefined' || typeof document === 'undefined' || !getComputedStyle) {\n return cssColor;\n }\n const input = cssColor?.trim();\n if (!input) {\n return cssColor;\n }\n\n const probe = document.createElement('span');\n probe.style.cssText =\n 'position:absolute;left:-9999px;top:-9999px;visibility:hidden;pointer-events:none;';\n probe.style.color = input;\n scopeElement.appendChild(probe);\n void probe.offsetHeight;\n const resolved = getComputedStyle(probe).color;\n probe.remove();\n\n return resolved || cssColor;\n}\n\n/**\n * Compute edge-aware tooltip position with intelligent placement,\n * considering available space in all directions and preventing overflow.\n */\nexport function computeTooltipPosition(\n containerRect: DOMRect,\n tooltipRect: DOMRect | null,\n clientX: number,\n clientY: number,\n gap: number,\n): TooltipPosition {\n const cursorX = clientX - containerRect.left;\n const cursorY = clientY - containerRect.top;\n\n if (!tooltipRect) {\n return {\n x: Math.min(cursorX + gap, containerRect.width - gap),\n y: Math.max(gap, Math.min(cursorY, containerRect.height - gap)),\n };\n }\n\n // Calculate available space in each direction\n const spaceRight = containerRect.width - cursorX;\n const spaceLeft = cursorX;\n const spaceBelow = containerRect.height - cursorY;\n const spaceAbove = cursorY;\n\n // Determine best horizontal position\n let x: number;\n if (spaceRight >= tooltipRect.width + gap) {\n // Position to the right of cursor\n x = cursorX + gap;\n } else if (spaceLeft >= tooltipRect.width + gap) {\n // Position to the left of cursor\n x = cursorX - tooltipRect.width - gap;\n } else {\n // Center horizontally if neither side has enough space\n x = Math.max(\n gap,\n Math.min((containerRect.width - tooltipRect.width) / 2, containerRect.width - tooltipRect.width - gap),\n );\n }\n\n // Determine best vertical position\n let y: number;\n if (spaceBelow >= tooltipRect.height + gap) {\n // Position below cursor\n y = cursorY + gap;\n } else if (spaceAbove >= tooltipRect.height + gap) {\n // Position above cursor\n y = cursorY - tooltipRect.height - gap;\n } else {\n // Center vertically if neither direction has enough space\n y = Math.max(\n gap,\n Math.min((containerRect.height - tooltipRect.height) / 2, containerRect.height - tooltipRect.height - gap),\n );\n }\n\n // Ensure tooltip stays within container bounds\n x = Math.max(gap, Math.min(x, containerRect.width - tooltipRect.width - gap));\n y = Math.max(gap, Math.min(y, containerRect.height - tooltipRect.height - gap));\n\n return { x, y };\n}\n\n/**\n * Map easing option to d3 easing function name that callers can lookup on d3.\n * Keeps mapping consistent across charts.\n */\nexport type D3EasingName =\n | 'easeLinear'\n | 'easePolyInOut'\n | 'easePolyIn'\n | 'easePolyOut'\n | 'easeCubic'\n | 'easeCubicIn'\n | 'easeCubicOut'\n | 'easeCubicInOut';\n\nexport function mapEasingName(option?: string): D3EasingName {\n switch (option) {\n case 'linear':\n return 'easeLinear';\n case 'ease':\n return 'easePolyInOut';\n case 'ease-in':\n return 'easePolyIn';\n case 'ease-out':\n return 'easePolyOut';\n case 'ease-in-out':\n return 'easePolyInOut';\n case 'cubic':\n return 'easeCubic';\n case 'cubic-in':\n return 'easeCubicIn';\n case 'cubic-out':\n return 'easeCubicOut';\n case 'cubic-in-out':\n return 'easeCubicInOut';\n default:\n return 'easeCubicOut';\n }\n}\n\n/**\n * Formats large numbers with abbreviations (K, M, B, T)\n */\nexport function formatLargeNumber(value: number): string {\n if (value === 0) return '0';\n\n const absValue = Math.abs(value);\n const sign = value < 0 ? '-' : '';\n\n if (absValue >= 1e12) {\n return `${sign}${(absValue / 1e12).toFixed(1)}T`;\n }\n if (absValue >= 1e9) {\n return `${sign}${(absValue / 1e9).toFixed(1)}B`;\n }\n if (absValue >= 1e6) {\n return `${sign}${(absValue / 1e6).toFixed(1)}M`;\n }\n if (absValue >= 1e3) {\n return `${sign}${(absValue / 1e3).toFixed(1)}K`;\n }\n\n return value.toLocaleString();\n}\n\n/**\n * Returns a D3 easing function for the provided option.\n */\nexport function getEasingFunction(d3: typeof import('d3'), option?: string): (t: number) => number {\n const name = mapEasingName(option);\n const easing = (d3 as any)[name];\n return typeof easing === 'function' ? easing : (d3 as any).easeCubicOut;\n}\n\n/** Unique DOM id prefix per chart instance (SVG filters/gradients). */\nexport function createChartInstanceId(prefix = 'ax-chart'): string {\n return `${prefix}-${Math.random().toString(36).slice(2, 9)}`;\n}\n\n/**\n * Normalizes barWidth: values > 1 are treated as 0–100 percentages (config default 80),\n * values ≤ 1 as fractions.\n */\nexport function resolveBarWidthFraction(barWidth: number | undefined, fallbackPercent = 80): number {\n const raw = barWidth ?? fallbackPercent;\n const fraction = raw > 1 ? raw / 100 : raw;\n return Math.min(1, Math.max(0.05, fraction));\n}\n","export const AX_CHARTS = 'ACOREX_CHARTS';\nexport * from './lib/chart-base.interface';\nexport * from './lib/chart-colors';\nexport * from './lib/chart-component-base';\nexport * from './lib/chart-empty-state';\nexport * from './lib/chart-messages';\nexport * from './lib/chart-types';\nexport * from './lib/chart-utils';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;MACa,sBAAsB,GAAG,IAAI,cAAc,CACtD,wBAAwB,EACxB;AACE,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;AACb,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,S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CAAC,CAAC,GAAG;IACjD;AACA,IAAA,IAAI,QAAQ,IAAI,GAAG,EAAE;AACnB,QAAA,OAAO,CAAA,EAAG,IAAI,CAAA,EAAG,CAAC,QAAQ,GAAG,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG;IACjD;AAEA,IAAA,OAAO,KAAK,CAAC,cAAc,EAAE;AAC/B;AAEA;;AAEG;AACG,SAAU,iBAAiB,CAAC,EAAuB,EAAE,MAAe,EAAA;AACxE,IAAA,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC;AAClC,IAAA,MAAM,MAAM,GAAI,EAAU,CAAC,IAAI,CAAC;AAChC,IAAA,OAAO,OAAO,MAAM,KAAK,UAAU,GAAG,MAAM,GAAI,EAAU,CAAC,YAAY;AACzE;AAEA;AACM,SAAU,qBAAqB,CAAC,MAAM,GAAG,UAAU,EAAA;IACvD,OAAO,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;AAC9D;AAEA;;;AAGG;SACa,uBAAuB,CAAC,QAA4B,EAAE,eAAe,GAAG,EAAE,EAAA;AACxF,IAAA,MAAM,GAAG,GAAG,QAAQ,IAAI,eAAe;AACvC,IAAA,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;AAC1C,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC9C;;ACrLO,MAAM,SAAS,GAAG;;ACAzB;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-charts.mjs","sources":["../../../../packages/charts/src/lib/chart-colors.ts","../../../../packages/charts/src/lib/chart-component-base.ts","../../../../packages/charts/src/lib/chart-empty-state.ts","../../../../packages/charts/src/lib/chart-messages.ts","../../../../packages/charts/src/lib/chart-utils.ts","../../../../packages/charts/src/index.ts","../../../../packages/charts/src/acorex-charts.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n// Default color palette for charts\nexport const AX_CHART_COLOR_PALETTE = new InjectionToken<string[]>(\n 'AX_CHART_COLOR_PALETTE',\n {\n providedIn: 'root',\n factory: () => [\n '#FF6B6B', // Vibrant Red\n '#4ECDC4', // Electric Teal\n '#45B7D1', // Bright Blue\n '#96CEB4', // Fresh Green\n '#FFEEAD', // Bright Yellow\n '#D4A5A5', // Rose Pink\n '#9B59B6', // Rich Purple\n '#3498DB', // Deep Blue\n '#E67E22', // Bright Orange\n '#2ECC71', // Emerald Green\n '#E74C3C', // Cherry Red\n '#1ABC9C', // Turquoise\n '#F1C40F', // Golden Yellow\n '#8E44AD', // Deep Purple\n '#16A085', // Dark Teal\n\n // --- Extended Colors (new) ---\n '#27AE60', // Forest Green\n '#2980B9', // Strong Blue\n '#F39C12', // Vivid Orange\n '#C0392B', // Dark Red\n '#7D3C98', // Plum Purple\n '#2C3E50', // Midnight Blue\n '#D35400', // Burnt Orange\n '#BDC3C7', // Soft Silver\n '#34495E', // Slate Gray\n '#1F618D', // Royal Blue\n '#58D68D', // Mint Green\n '#5DADE2', // Sky Blue\n '#F1948A', // Soft Coral\n '#A569BD', // Lavender Purple\n '#F8C471', // Warm Gold\n ],\n }\n);\n\n\n/**\n * Helper function to get a color from the palette by index\n * @param index The index of the color to get\n * @param palette The color palette to use\n * @returns The color at the specified index\n */\nexport function getChartColor(index: number, palette: string[]): string {\n return palette[index % palette.length];\n}\n","import { afterNextRender, Directive, ElementRef, inject, signal } from '@angular/core';\n\n/**\n * Base component class for all chart components\n * Copied from @acorex/cdk/common NXComponent to remove external dependency\n */\n@Directive()\nexport abstract class AXChartComponent {\n #elementRef: ElementRef<HTMLElement> = inject(ElementRef);\n #isRendered = signal(false);\n\n protected isRendered = this.#isRendered.asReadonly();\n\n #afterNextRender = afterNextRender(() => {\n if (!this.isRendered()) {\n this.nativeElement['__axContext__'] = this;\n this.#isRendered.set(true);\n }\n });\n\n /**\n * Gets the native HTML element of the component\n */\n public get nativeElement(): HTMLElement {\n return this.#elementRef.nativeElement;\n }\n\n /**\n * Gets the host HTML element of the component (alias for nativeElement)\n * @returns T - The native DOM element associated with this component\n */\n public getHostElement<T = HTMLElement>(): T {\n return this.#elementRef.nativeElement as T;\n }\n}\n","export interface AXChartEmptyMessageContent {\n icon: string;\n title: string;\n help?: string;\n}\n\n/**\n * Renders a centered empty-state message inside a chart container.\n * Clears prior SVG / empty-state nodes; leaves Angular tooltip hosts alone.\n */\nexport function renderChartEmptyMessage(\n d3: { select: (node: HTMLElement) => D3EmptySelection },\n container: HTMLElement,\n message: AXChartEmptyMessageContent,\n): void {\n const root = d3.select(container);\n root.selectAll('svg, .ax-chart-empty').remove();\n\n const card = root.append('div').attr('class', 'ax-chart-empty').append('div').attr('class', 'ax-chart-empty__card');\n\n card\n .append('div')\n .attr('class', 'ax-chart-empty__icon')\n .html(`<i class=\"${message.icon} fa-2x\" aria-hidden=\"true\"></i>`);\n\n card.append('div').attr('class', 'ax-chart-empty__title').text(message.title);\n\n if (message.help) {\n card.append('div').attr('class', 'ax-chart-empty__help').text(message.help);\n }\n}\n\n/** Minimal D3 selection surface used by empty-state rendering. */\ninterface D3EmptySelection {\n selectAll: (selector: string) => { remove: () => unknown };\n append: (tag: string) => D3EmptyAppend;\n}\n\ninterface D3EmptyAppend {\n attr: (name: string, value: string) => D3EmptyAppend;\n append: (tag: string) => D3EmptyAppend;\n html: (value: string) => D3EmptyAppend;\n text: (value: string) => D3EmptyAppend;\n}\n","/**\n * Shared empty-state copy for all charts.\n * Per-chart configs may override icons; default title/help stay consistent.\n */\nexport interface AXChartMessages {\n noData?: string;\n noDataHelp?: string;\n allHidden?: string;\n allHiddenHelp?: string;\n noDataIcon?: string;\n allHiddenIcon?: string;\n}\n\nexport const AX_CHART_DEFAULT_MESSAGES: Required<AXChartMessages> = {\n noData: 'No data available',\n noDataHelp: 'Please provide data to display the chart',\n allHidden: 'All series are hidden',\n allHiddenHelp: 'Click on legend items to show them',\n noDataIcon: 'fa-light fa-chart-simple',\n allHiddenIcon: 'fa-light fa-eye-slash',\n};\n\nexport function mergeChartMessages(\n defaults: AXChartMessages = {},\n overrides?: AXChartMessages,\n): Required<AXChartMessages> {\n return {\n ...AX_CHART_DEFAULT_MESSAGES,\n ...defaults,\n ...overrides,\n };\n}\n\n/** Shallow merge options while preserving nested margin/messages defaults. */\nexport function mergeChartOptions<T extends object>(defaults: T, options?: Partial<T> | null): T {\n const opts = (options ?? {}) as Partial<T>;\n const result = { ...defaults, ...opts } as T & {\n messages?: AXChartMessages;\n margins?: object;\n margin?: object;\n };\n\n const defaultRecord = defaults as {\n messages?: AXChartMessages;\n margins?: object;\n margin?: object;\n };\n const optionRecord = opts as {\n messages?: AXChartMessages;\n margins?: object;\n margin?: object;\n };\n\n if (defaultRecord.messages || optionRecord.messages) {\n result.messages = mergeChartMessages(defaultRecord.messages, optionRecord.messages);\n }\n if (defaultRecord.margins || optionRecord.margins) {\n result.margins = { ...defaultRecord.margins, ...optionRecord.margins };\n }\n if (defaultRecord.margin || optionRecord.margin) {\n result.margin = { ...defaultRecord.margin, ...optionRecord.margin };\n }\n\n return result;\n}\n","export type TooltipPosition = { x: number; y: number };\n\n/**\n * Resolves any CSS `<color>` the browser understands — including\n * `rgb(var(--token))`, `hsl(var(--token))`, `color-mix()`, etc. — to a computed\n * `rgb()` / `rgba()` string, using the cascade from `scopeElement` (e.g. the chart\n * container) so design tokens on ancestors apply.\n */\nexport function resolveCssColorInContext(scopeElement: HTMLElement, cssColor: string): string {\n if (typeof window === 'undefined' || typeof document === 'undefined' || !getComputedStyle) {\n return cssColor;\n }\n const input = cssColor?.trim();\n if (!input) {\n return cssColor;\n }\n\n const probe = document.createElement('span');\n probe.style.cssText =\n 'position:absolute;left:-9999px;top:-9999px;visibility:hidden;pointer-events:none;';\n probe.style.color = input;\n scopeElement.appendChild(probe);\n void probe.offsetHeight;\n const resolved = getComputedStyle(probe).color;\n probe.remove();\n\n return resolved || cssColor;\n}\n\n/**\n * Compute edge-aware tooltip position with intelligent placement,\n * considering available space in all directions and preventing overflow.\n */\nexport function computeTooltipPosition(\n containerRect: DOMRect,\n tooltipRect: DOMRect | null,\n clientX: number,\n clientY: number,\n gap: number,\n): TooltipPosition {\n const containerLeft = containerRect.left;\n const containerTop = containerRect.top;\n const containerRight = containerRect.right;\n const containerBottom = containerRect.bottom;\n\n if (!tooltipRect) {\n return {\n x: Math.min(clientX + gap, containerRight - gap),\n y: Math.max(containerTop + gap, Math.min(clientY + gap, containerBottom - gap)),\n };\n }\n\n const spaceRight = containerRight - clientX;\n const spaceLeft = clientX - containerLeft;\n const spaceBelow = containerBottom - clientY;\n const spaceAbove = clientY - containerTop;\n\n let x: number;\n if (spaceRight >= tooltipRect.width + gap) {\n x = clientX + gap;\n } else if (spaceLeft >= tooltipRect.width + gap) {\n x = clientX - tooltipRect.width - gap;\n } else {\n x = Math.max(\n containerLeft + gap,\n Math.min(\n containerLeft + (containerRect.width - tooltipRect.width) / 2,\n containerRight - tooltipRect.width - gap,\n ),\n );\n }\n\n let y: number;\n if (spaceBelow >= tooltipRect.height + gap) {\n y = clientY + gap;\n } else if (spaceAbove >= tooltipRect.height + gap) {\n y = clientY - tooltipRect.height - gap;\n } else {\n y = Math.max(\n containerTop + gap,\n Math.min(\n containerTop + (containerRect.height - tooltipRect.height) / 2,\n containerBottom - tooltipRect.height - gap,\n ),\n );\n }\n\n x = Math.max(containerLeft + gap, Math.min(x, containerRight - tooltipRect.width - gap));\n y = Math.max(containerTop + gap, Math.min(y, containerBottom - tooltipRect.height - gap));\n\n return { x, y };\n}\n\n/**\n * Map easing option to d3 easing function name that callers can lookup on d3.\n * Keeps mapping consistent across charts.\n */\nexport type D3EasingName =\n | 'easeLinear'\n | 'easePolyInOut'\n | 'easePolyIn'\n | 'easePolyOut'\n | 'easeCubic'\n | 'easeCubicIn'\n | 'easeCubicOut'\n | 'easeCubicInOut';\n\nexport function mapEasingName(option?: string): D3EasingName {\n switch (option) {\n case 'linear':\n return 'easeLinear';\n case 'ease':\n return 'easePolyInOut';\n case 'ease-in':\n return 'easePolyIn';\n case 'ease-out':\n return 'easePolyOut';\n case 'ease-in-out':\n return 'easePolyInOut';\n case 'cubic':\n return 'easeCubic';\n case 'cubic-in':\n return 'easeCubicIn';\n case 'cubic-out':\n return 'easeCubicOut';\n case 'cubic-in-out':\n return 'easeCubicInOut';\n default:\n return 'easeCubicOut';\n }\n}\n\n/**\n * Formats large numbers with abbreviations (K, M, B, T)\n */\nexport function formatLargeNumber(value: number): string {\n if (value === 0) return '0';\n\n const absValue = Math.abs(value);\n const sign = value < 0 ? '-' : '';\n\n if (absValue >= 1e12) {\n return `${sign}${(absValue / 1e12).toFixed(1)}T`;\n }\n if (absValue >= 1e9) {\n return `${sign}${(absValue / 1e9).toFixed(1)}B`;\n }\n if (absValue >= 1e6) {\n return `${sign}${(absValue / 1e6).toFixed(1)}M`;\n }\n if (absValue >= 1e3) {\n return `${sign}${(absValue / 1e3).toFixed(1)}K`;\n }\n\n return value.toLocaleString();\n}\n\n/**\n * Returns a D3 easing function for the provided option.\n */\nexport function getEasingFunction(d3: typeof import('d3'), option?: string): (t: number) => number {\n const name = mapEasingName(option);\n const easing = (d3 as any)[name];\n return typeof easing === 'function' ? easing : (d3 as any).easeCubicOut;\n}\n\n/** Unique DOM id prefix per chart instance (SVG filters/gradients). */\nexport function createChartInstanceId(prefix = 'ax-chart'): string {\n return `${prefix}-${Math.random().toString(36).slice(2, 9)}`;\n}\n\n/**\n * Normalizes barWidth: values > 1 are treated as 0–100 percentages (config default 80),\n * values ≤ 1 as fractions.\n */\nexport function resolveBarWidthFraction(barWidth: number | undefined, fallbackPercent = 80): number {\n const raw = barWidth ?? fallbackPercent;\n const fraction = raw > 1 ? raw / 100 : raw;\n return Math.min(1, Math.max(0.05, fraction));\n}\n","export const AX_CHARTS = 'ACOREX_CHARTS';\nexport * from './lib/chart-base.interface';\nexport * from './lib/chart-colors';\nexport * from './lib/chart-component-base';\nexport * from './lib/chart-empty-state';\nexport * from './lib/chart-messages';\nexport * from './lib/chart-types';\nexport * from './lib/chart-utils';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;MACa,sBAAsB,GAAG,IAAI,cAAc,CACtD,wBAAwB,EACxB;AACE,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;AACb,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;;AAGT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACT,QAAA,SAAS;AACV,KAAA;AACF,CAAA;AAIH;;;;;AAKG;AACG,SAAU,aAAa,CAAC,KAAa,EAAE,OAAiB,EAAA;IAC5D,OAAO,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;AACxC;;ACnDA;;;AAGG;MAEmB,gBAAgB,CAAA;AACpC,IAAA,WAAW,GAA4B,MAAM,CAAC,UAAU,CAAC;IACzD,WAAW,GAAG,MAAM,CAAC,KAAK;oFAAC;AAEjB,IAAA,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE;AAEpD,IAAA,gBAAgB,GAAG,eAAe,CAAC,MAAK;AACtC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AAC,CAAC,EAAE;AAC9D;AAEA;;;AAGG;SACa,uBAAuB,CAAC,QAA4B,EAAE,eAAe,GAAG,EAAE,EAAA;AACxF,IAAA,MAAM,GAAG,GAAG,QAAQ,IAAI,eAAe;AACvC,IAAA,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;AAC1C,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC9C;;ACnLO,MAAM,SAAS,GAAG;;ACAzB;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acorex/charts",
3
- "version": "21.1.0-next.2",
3
+ "version": "22.0.0-next.1",
4
4
  "peerDependencies": {
5
5
  "d3": ">=7.9.0"
6
6
  },
@@ -240,6 +240,7 @@ declare class AXBarChartComponent extends AXChartComponent implements OnDestroy,
240
240
  */
241
241
  private handleBarHover;
242
242
  private updateTooltipPosition;
243
+ private scheduleTooltipPosition;
243
244
  /**
244
245
  * Enhanced tooltip positioning that considers chart boundaries and prevents overflow
245
246
  */
@@ -270,6 +270,7 @@ declare class AXDonutChartComponent extends AXChartComponent implements OnDestro
270
270
  */
271
271
  private handleSegmentLeave;
272
272
  private updateTooltipPosition;
273
+ private scheduleTooltipPosition;
273
274
  /**
274
275
  * Adds center display with total value
275
276
  */
@@ -107,6 +107,7 @@ declare class AXFunnelChartComponent extends AXChartComponent implements OnDestr
107
107
  updateChart(): void;
108
108
  private showTooltip;
109
109
  private updateTooltipPosition;
110
+ private scheduleTooltipPosition;
110
111
  private hideTooltip;
111
112
  cleanupChart(): void;
112
113
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXFunnelChartComponent, never>;
@@ -29,6 +29,11 @@ interface AXGaugeChartData {
29
29
  * Default: `var(--ax-sys-color-on-lightest-surface)`
30
30
  * Usage: `rgb(var(--ax-comp-gauge-chart-text-color))`
31
31
  *
32
+ * ### `--ax-comp-gauge-chart-data-labels-color`
33
+ * Text color for threshold segment labels.
34
+ * Default: `var(--ax-sys-color-on-lightest-surface)`
35
+ * Usage: `rgb(var(--ax-comp-gauge-chart-data-labels-color))`
36
+ *
32
37
  * ### `--ax-comp-gauge-chart-track-color`
33
38
  * Color for the gauge track (background arc).
34
39
  * Default: `var(--ax-sys-color-gray-200)`
@@ -70,6 +75,12 @@ interface AXGaugeChartOption {
70
75
  cornerRadius?: number;
71
76
  showValue?: boolean;
72
77
  showTooltip?: boolean;
78
+ /**
79
+ * Whether to show labels inside threshold segments
80
+ * Labels use each threshold's `label` and only appear on segments large enough to fit text
81
+ * Default: true
82
+ */
83
+ showDataLabels?: boolean;
73
84
  thresholds?: {
74
85
  value: number;
75
86
  color: string;
@@ -125,6 +136,10 @@ declare class AXGaugeChartComponent extends AXChartComponent implements OnDestro
125
136
  private readonly TICK_LABEL_CHAR_WIDTH_RATIO;
126
137
  private readonly TICK_LABEL_SIDE_PADDING;
127
138
  private readonly LABEL_TICK_CLEARANCE;
139
+ private readonly MIN_SEGMENT_CHORD_FOR_LABEL;
140
+ private readonly MIN_SEGMENT_RING_FOR_LABEL;
141
+ private readonly MIN_SEGMENT_LABEL_FONT;
142
+ private readonly MAX_SEGMENT_LABEL_FONT;
128
143
  private readonly instanceId;
129
144
  private get bgGradientId();
130
145
  private thresholdGradientId;
@@ -154,6 +169,14 @@ declare class AXGaugeChartComponent extends AXChartComponent implements OnDestro
154
169
  * Draw the thresholds arcs
155
170
  */
156
171
  private drawThresholds;
172
+ /**
173
+ * Draws threshold labels centered on each segment arc when space allows.
174
+ */
175
+ private drawSegmentLabels;
176
+ private calculateSegmentLabelFontSize;
177
+ private getFittedSegmentLabel;
178
+ private doesSegmentLabelFit;
179
+ private truncateSegmentLabel;
157
180
  /**
158
181
  * Shows tooltip for a threshold arc
159
182
  */
@@ -163,6 +186,7 @@ declare class AXGaugeChartComponent extends AXChartComponent implements OnDestro
163
186
  */
164
187
  private showSingleRangeTooltip;
165
188
  private updateTooltipPosition;
189
+ private scheduleTooltipPosition;
166
190
  /**
167
191
  * Hides the tooltip
168
192
  */
@@ -117,6 +117,7 @@ declare class AXHeatmapChartComponent extends AXChartComponent implements OnDest
117
117
  private drawAxis;
118
118
  private showTooltip;
119
119
  private updateTooltipPos;
120
+ private scheduleTooltipPosition;
120
121
  private hideTooltip;
121
122
  ngOnDestroy(): void;
122
123
  private drawAxisLabels;