ngx-core-components 0.3.14 → 0.3.16

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,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, signal, computed, viewChild, ChangeDetectionStrategy, Component, Injectable, output, inject, ElementRef, effect } from '@angular/core';
2
+ import { input, viewChild, signal, computed, inject, ElementRef, DestroyRef, HostListener, ChangeDetectionStrategy, Component, Injectable, output, effect } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
- import { NgTemplateOutlet, CommonModule } from '@angular/common';
4
+ import { CommonModule, NgTemplateOutlet } from '@angular/common';
5
5
 
6
6
  // Shared chart utilities and constants
7
7
  const CHART_COLORS = [
@@ -72,20 +72,50 @@ class BarChartComponent {
72
72
  showLabels = input(false);
73
73
  showLegend = input(true);
74
74
  colors = input(CHART_COLORS);
75
+ showExport = input(false);
76
+ svgEl = viewChild('svgEl');
77
+ exportMenuOpen = signal(false);
78
+ animateState = signal(false);
79
+ activeColumnIndex = signal(null);
80
+ containerWidth = signal(600);
75
81
  tooltip = signal(null);
76
82
  chartHeight = computed(() => this.height());
77
- svgEl = viewChild('svgEl');
78
- innerW = computed(() => 600 - this.PAD_LEFT - this.PAD_RIGHT);
83
+ innerW = computed(() => this.containerWidth() - this.PAD_LEFT - this.PAD_RIGHT);
79
84
  innerH = computed(() => this.chartHeight() - this.PAD_TOP - this.PAD_BOTTOM);
80
85
  allValues = computed(() => this.series().flatMap(s => s.data.filter(v => v != null)));
81
86
  yMin = computed(() => Math.min(0, ...this.allValues()));
82
87
  yMax = computed(() => Math.max(1, ...this.allValues()));
83
88
  yTicks = computed(() => niceTicks(this.yMin(), this.yMax(), 5));
89
+ constructor() {
90
+ const hostEl = inject(ElementRef).nativeElement;
91
+ if (typeof ResizeObserver !== 'undefined') {
92
+ const resizeObserver = new ResizeObserver(entries => {
93
+ if (!entries || entries.length === 0)
94
+ return;
95
+ const width = entries[0].contentRect.width;
96
+ if (width > 0) {
97
+ this.containerWidth.set(width);
98
+ }
99
+ });
100
+ resizeObserver.observe(hostEl);
101
+ inject(DestroyRef).onDestroy(() => resizeObserver.disconnect());
102
+ }
103
+ // Start growth load animations
104
+ setTimeout(() => this.animateState.set(true), 50);
105
+ }
84
106
  yPos(v) {
85
107
  return scale(v, this.yMin(), this.yMax(), this.innerH(), 0);
86
108
  }
87
- barY(v) { return Math.min(this.yPos(0), this.yPos(v)); }
88
- barH(v) { return Math.abs(this.yPos(0) - this.yPos(v)); }
109
+ barY(v) {
110
+ if (!this.animateState())
111
+ return this.yPos(0);
112
+ return Math.min(this.yPos(0), this.yPos(v));
113
+ }
114
+ barH(v) {
115
+ if (!this.animateState())
116
+ return 0;
117
+ return Math.abs(this.yPos(0) - this.yPos(v));
118
+ }
89
119
  groupW = computed(() => this.categories().length > 0 ? this.innerW() / this.categories().length : 0);
90
120
  singleBarWidth = computed(() => {
91
121
  const n = this.series().length || 1;
@@ -97,23 +127,143 @@ class BarChartComponent {
97
127
  const gx = ci * this.groupW() + 4;
98
128
  return gx + si * this.singleBarWidth();
99
129
  }
130
+ colStartX(i) {
131
+ return i * this.groupW();
132
+ }
100
133
  seriesColor(i) { return this.colors()[i % this.colors().length]; }
101
134
  barColor(si, s) { return s.color || this.seriesColor(si); }
102
- onBarHover(event, seriesName, cat, value) {
103
- const rect = event.target.closest('.ngx-bar-chart').getBoundingClientRect();
104
- const el = event.target.closest('.ngx-bar-chart');
105
- const elRect = el.getBoundingClientRect();
135
+ onMouseMove(event) {
136
+ const el = event.currentTarget;
137
+ const rect = el.getBoundingClientRect();
138
+ const mx = event.clientX - rect.left - this.PAD_LEFT;
139
+ const cats = this.categories();
140
+ if (cats.length === 0)
141
+ return;
142
+ // Determine hover category column index
143
+ const idx = Math.floor(mx / this.groupW());
144
+ const ci = Math.max(0, Math.min(cats.length - 1, idx));
145
+ this.activeColumnIndex.set(ci);
146
+ const rows = this.series().map((s, si) => ({
147
+ name: s.name,
148
+ value: s.data[ci] ?? 0,
149
+ color: this.barColor(si, s),
150
+ }));
106
151
  this.tooltip.set({
107
- x: event.clientX - elRect.left,
108
- y: event.clientY - elRect.top,
109
- cat, series: seriesName, value,
152
+ x: event.clientX - rect.left,
153
+ y: event.clientY - rect.top,
154
+ cat: cats[ci],
155
+ rows
156
+ });
157
+ }
158
+ onMouseLeave() {
159
+ this.activeColumnIndex.set(null);
160
+ this.tooltip.set(null);
161
+ }
162
+ toggleExportMenu(event) {
163
+ event.stopPropagation();
164
+ this.exportMenuOpen.set(!this.exportMenuOpen());
165
+ }
166
+ closeExportMenu() {
167
+ this.exportMenuOpen.set(false);
168
+ }
169
+ onExport(type) {
170
+ this.exportMenuOpen.set(false);
171
+ if (type === 'json')
172
+ this.exportToJson();
173
+ else if (type === 'csv')
174
+ this.exportToCsv();
175
+ else if (type === 'svg')
176
+ this.exportToSvg();
177
+ }
178
+ exportToCsv() {
179
+ const cats = this.categories();
180
+ const sers = this.series();
181
+ if (!cats.length || !sers.length)
182
+ return;
183
+ let csv = 'Category,' + sers.map(s => `"${s.name}"`).join(',') + '\n';
184
+ cats.forEach((cat, ci) => {
185
+ const row = [cat];
186
+ sers.forEach(s => {
187
+ row.push(s.data[ci] !== undefined ? String(s.data[ci]) : '');
188
+ });
189
+ csv += row.join(',') + '\n';
190
+ });
191
+ const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
192
+ const link = document.createElement('a');
193
+ link.href = URL.createObjectURL(blob);
194
+ link.setAttribute('download', 'bar-chart-data.csv');
195
+ document.body.appendChild(link);
196
+ link.click();
197
+ document.body.removeChild(link);
198
+ }
199
+ exportToJson() {
200
+ const cats = this.categories();
201
+ const sers = this.series();
202
+ if (!cats.length || !sers.length)
203
+ return;
204
+ const data = cats.map((cat, ci) => {
205
+ const entry = { category: cat };
206
+ sers.forEach(s => {
207
+ if (s.data[ci] !== undefined) {
208
+ entry[s.name] = s.data[ci];
209
+ }
210
+ });
211
+ return entry;
110
212
  });
213
+ const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
214
+ const link = document.createElement('a');
215
+ link.href = URL.createObjectURL(blob);
216
+ link.setAttribute('download', 'bar-chart-data.json');
217
+ document.body.appendChild(link);
218
+ link.click();
219
+ document.body.removeChild(link);
220
+ }
221
+ exportToSvg() {
222
+ const svg = this.svgEl()?.nativeElement;
223
+ if (!svg)
224
+ return;
225
+ const serializer = new XMLSerializer();
226
+ let source = serializer.serializeToString(svg);
227
+ if (!source.match(/^<svg[^>]+xmlns="http\:\/\/www\.w3\.org\/2000\/svg"/)) {
228
+ source = source.replace(/^<svg/, '<svg xmlns="http://www.w3.org/2000/svg"');
229
+ }
230
+ if (!source.match(/^<svg[^>]+xmlns\:xlink="http\:\/\/www\.w3\.org\/1999\/xlink"/)) {
231
+ source = source.replace(/^<svg/, '<svg xmlns:xlink="http://www.w3.org/1999/xlink"');
232
+ }
233
+ source = '<?xml version="1.0" encoding="utf-8"?>\n' + source;
234
+ const blob = new Blob([source], { type: 'image/svg+xml;charset=utf-8' });
235
+ const link = document.createElement('a');
236
+ link.href = URL.createObjectURL(blob);
237
+ link.setAttribute('download', 'bar-chart.svg');
238
+ document.body.appendChild(link);
239
+ link.click();
240
+ document.body.removeChild(link);
111
241
  }
112
- onMouseMove(event) { }
113
242
  fmtNum = fmtNum;
114
243
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: BarChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
115
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: BarChartComponent, isStandalone: true, selector: "ngx-bar-chart", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, categories: { classPropertyName: "categories", publicName: "categories", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showGrid: { classPropertyName: "showGrid", publicName: "showGrid", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "svgEl", first: true, predicate: ["svgEl"], descendants: true, isSignal: true }], ngImport: i0, template: `
116
- <div class="ngx-bar-chart">
244
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: BarChartComponent, isStandalone: true, selector: "ngx-bar-chart", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, categories: { classPropertyName: "categories", publicName: "categories", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showGrid: { classPropertyName: "showGrid", publicName: "showGrid", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, showExport: { classPropertyName: "showExport", publicName: "showExport", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:click": "closeExportMenu()" } }, viewQueries: [{ propertyName: "svgEl", first: true, predicate: ["svgEl"], descendants: true, isSignal: true }], ngImport: i0, template: `
245
+ <div
246
+ class="ngx-bar-chart"
247
+ (mousemove)="onMouseMove($event)"
248
+ (mouseleave)="onMouseLeave()"
249
+ >
250
+ <!-- Toolbar with Export option -->
251
+ <div class="chart-header">
252
+ <div class="chart-title-space"></div>
253
+ @if (showExport()) {
254
+ <div class="chart-export-menu">
255
+ <button class="export-trigger" (click)="toggleExportMenu($event)" aria-label="Export Menu">📤 Export</button>
256
+ @if (exportMenuOpen()) {
257
+ <div class="export-dropdown">
258
+ <button (click)="onExport('json')">📊 Export JSON</button>
259
+ <button (click)="onExport('csv')">📄 Export CSV</button>
260
+ <button (click)="onExport('svg')">🖼️ Export SVG</button>
261
+ </div>
262
+ }
263
+ </div>
264
+ }
265
+ </div>
266
+
117
267
  <!-- Legend -->
118
268
  @if (showLegend()) {
119
269
  <div class="chart-legend">
@@ -125,14 +275,22 @@ class BarChartComponent {
125
275
  }
126
276
  </div>
127
277
  }
278
+
128
279
  <!-- SVG Chart -->
129
280
  <svg
281
+ #svgEl
130
282
  [attr.width]="'100%'"
131
283
  [attr.height]="chartHeight()"
132
284
  class="chart-svg"
133
- (mousemove)="onMouseMove($event)"
134
- (mouseleave)="tooltip.set(null)"
135
285
  >
286
+ <defs>
287
+ @for (s of series(); track s.name; let i = $index) {
288
+ <linearGradient [attr.id]="'bar-grad-' + i" x1="0" y1="0" x2="0" y2="1">
289
+ <stop offset="0%" [attr.stop-color]="seriesColor(i)" stop-opacity="1"/>
290
+ <stop offset="100%" [attr.stop-color]="seriesColor(i)" stop-opacity="0.75"/>
291
+ </linearGradient>
292
+ }
293
+ </defs>
136
294
  <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
137
295
 
138
296
  <!-- Y axis grid lines + labels -->
@@ -148,6 +306,17 @@ class BarChartComponent {
148
306
  </g>
149
307
  }
150
308
 
309
+ <!-- Column Highlight Ruler (Enterprise interactive UX) -->
310
+ @if (activeColumnIndex() !== null) {
311
+ <rect
312
+ [attr.x]="colStartX(activeColumnIndex()!)"
313
+ [attr.y]="0"
314
+ [attr.width]="groupW()"
315
+ [attr.height]="innerH()"
316
+ class="column-ruler"
317
+ />
318
+ }
319
+
151
320
  <!-- X axis category labels -->
152
321
  @for (cat of categories(); track cat; let i = $index) {
153
322
  <text
@@ -167,12 +336,11 @@ class BarChartComponent {
167
336
  [attr.y]="barY(v)"
168
337
  [attr.width]="singleBarWidth()"
169
338
  [attr.height]="barH(v)"
170
- [attr.fill]="barColor(si, s)"
171
- [attr.rx]="3"
339
+ [attr.fill]="s.color ? s.color : 'url(#bar-grad-' + si + ')'"
340
+ [attr.rx]="4"
172
341
  class="bar-rect"
173
- (mouseenter)="onBarHover($event, s.name, categories()[ci], v)"
174
342
  />
175
- @if (showLabels()) {
343
+ @if (showLabels() && animateState()) {
176
344
  <text
177
345
  [attr.x]="barX(ci, si) + singleBarWidth() / 2"
178
346
  [attr.y]="barY(v) - 4"
@@ -190,20 +358,47 @@ class BarChartComponent {
190
358
  </g>
191
359
  </svg>
192
360
 
193
- <!-- Tooltip -->
361
+ <!-- Advanced Grouped Tooltip -->
194
362
  @if (tooltip(); as t) {
195
363
  <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
196
- <strong>{{ t.cat }}</strong><br/>
197
- {{ t.series }}: {{ fmtNum(t.value) }}
364
+ <div class="tt-cat">{{ t.cat }}</div>
365
+ @for (row of t.rows; track row.name) {
366
+ <div class="tt-row">
367
+ <span class="tt-dot" [style.background]="row.color"></span>
368
+ <span class="tt-name">{{ row.name }}</span>
369
+ <span class="tt-val">{{ fmtNum(row.value) }}</span>
370
+ </div>
371
+ }
198
372
  </div>
199
373
  }
200
374
  </div>
201
- `, isInline: true, styles: [":host{display:block}.ngx-bar-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit}.chart-legend{display:flex;gap:16px;padding:0 0 8px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text, #6c757d)}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.chart-svg{display:block;overflow:visible}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d)}.bar-rect{cursor:pointer;transition:opacity .15s}.bar-rect:hover{opacity:.8}.bar-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%);background:var(--ngx-chart-tooltip-bg, #343a40);color:#fff;padding:6px 10px;border-radius:4px;font-size:12px;white-space:nowrap;margin-top:-8px;box-shadow:0 2px 8px #0003}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
375
+ `, isInline: true, styles: [":host{display:block;position:relative}.ngx-bar-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit}.chart-header{display:flex;justify-content:space-between;align-items:center;min-height:24px;position:relative}.chart-legend{display:flex;gap:16px;padding:4px 0 12px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text, #6c757d);font-weight:500}.legend-dot{width:10px;height:10px;border-radius:3px;display:inline-block}.chart-svg{display:block;overflow:visible}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d);-webkit-user-select:none;user-select:none;font-weight:500}.column-ruler{fill:#6366f108;stroke:#6366f114;stroke-width:1;rx:6;ry:6;pointer-events:none;transition:x .15s cubic-bezier(.16,1,.3,1),width .15s cubic-bezier(.16,1,.3,1)}.bar-rect{cursor:pointer;transition:y .5s cubic-bezier(.16,1,.3,1),height .5s cubic-bezier(.16,1,.3,1),fill-opacity .15s,stroke-width .15s;stroke:#fff;stroke-width:.5}.bar-rect:hover{fill-opacity:.9;stroke-width:1.5;filter:drop-shadow(0 4px 6px rgba(0,0,0,.08))}.bar-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d);pointer-events:none;font-weight:600}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .12s cubic-bezier(.16,1,.3,1),top .12s cubic-bezier(.16,1,.3,1);font-family:inherit}.tt-cat{font-weight:700;margin-bottom:8px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:6px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:5px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}.chart-export-menu{position:absolute;top:0;right:0;z-index:50}.export-trigger{padding:4px 10px;font-size:11px;font-weight:600;color:var(--ngx-chart-axis-text, #6c757d);background:#ffffffb3;backdrop-filter:blur(8px);border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:6px;cursor:pointer;transition:all .15s}.export-trigger:hover{background:#fff;color:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5)}.export-dropdown{position:absolute;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:8px;box-shadow:0 10px 15px -3px #00000014;padding:4px;display:flex;flex-direction:column;gap:2px;min-width:120px}.export-dropdown button{background:none;border:none;padding:6px 10px;font-size:11px;text-align:left;cursor:pointer;color:#343a40;border-radius:4px;font-family:inherit;width:100%;transition:all .12s}.export-dropdown button:hover{background:#4f46e50f;color:var(--primary-color, #4f46e5)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
202
376
  }
203
377
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: BarChartComponent, decorators: [{
204
378
  type: Component,
205
- args: [{ selector: 'ngx-bar-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
206
- <div class="ngx-bar-chart">
379
+ args: [{ selector: 'ngx-bar-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
380
+ <div
381
+ class="ngx-bar-chart"
382
+ (mousemove)="onMouseMove($event)"
383
+ (mouseleave)="onMouseLeave()"
384
+ >
385
+ <!-- Toolbar with Export option -->
386
+ <div class="chart-header">
387
+ <div class="chart-title-space"></div>
388
+ @if (showExport()) {
389
+ <div class="chart-export-menu">
390
+ <button class="export-trigger" (click)="toggleExportMenu($event)" aria-label="Export Menu">📤 Export</button>
391
+ @if (exportMenuOpen()) {
392
+ <div class="export-dropdown">
393
+ <button (click)="onExport('json')">📊 Export JSON</button>
394
+ <button (click)="onExport('csv')">📄 Export CSV</button>
395
+ <button (click)="onExport('svg')">🖼️ Export SVG</button>
396
+ </div>
397
+ }
398
+ </div>
399
+ }
400
+ </div>
401
+
207
402
  <!-- Legend -->
208
403
  @if (showLegend()) {
209
404
  <div class="chart-legend">
@@ -215,14 +410,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
215
410
  }
216
411
  </div>
217
412
  }
413
+
218
414
  <!-- SVG Chart -->
219
415
  <svg
416
+ #svgEl
220
417
  [attr.width]="'100%'"
221
418
  [attr.height]="chartHeight()"
222
419
  class="chart-svg"
223
- (mousemove)="onMouseMove($event)"
224
- (mouseleave)="tooltip.set(null)"
225
420
  >
421
+ <defs>
422
+ @for (s of series(); track s.name; let i = $index) {
423
+ <linearGradient [attr.id]="'bar-grad-' + i" x1="0" y1="0" x2="0" y2="1">
424
+ <stop offset="0%" [attr.stop-color]="seriesColor(i)" stop-opacity="1"/>
425
+ <stop offset="100%" [attr.stop-color]="seriesColor(i)" stop-opacity="0.75"/>
426
+ </linearGradient>
427
+ }
428
+ </defs>
226
429
  <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
227
430
 
228
431
  <!-- Y axis grid lines + labels -->
@@ -238,6 +441,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
238
441
  </g>
239
442
  }
240
443
 
444
+ <!-- Column Highlight Ruler (Enterprise interactive UX) -->
445
+ @if (activeColumnIndex() !== null) {
446
+ <rect
447
+ [attr.x]="colStartX(activeColumnIndex()!)"
448
+ [attr.y]="0"
449
+ [attr.width]="groupW()"
450
+ [attr.height]="innerH()"
451
+ class="column-ruler"
452
+ />
453
+ }
454
+
241
455
  <!-- X axis category labels -->
242
456
  @for (cat of categories(); track cat; let i = $index) {
243
457
  <text
@@ -257,12 +471,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
257
471
  [attr.y]="barY(v)"
258
472
  [attr.width]="singleBarWidth()"
259
473
  [attr.height]="barH(v)"
260
- [attr.fill]="barColor(si, s)"
261
- [attr.rx]="3"
474
+ [attr.fill]="s.color ? s.color : 'url(#bar-grad-' + si + ')'"
475
+ [attr.rx]="4"
262
476
  class="bar-rect"
263
- (mouseenter)="onBarHover($event, s.name, categories()[ci], v)"
264
477
  />
265
- @if (showLabels()) {
478
+ @if (showLabels() && animateState()) {
266
479
  <text
267
480
  [attr.x]="barX(ci, si) + singleBarWidth() / 2"
268
481
  [attr.y]="barY(v) - 4"
@@ -280,16 +493,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
280
493
  </g>
281
494
  </svg>
282
495
 
283
- <!-- Tooltip -->
496
+ <!-- Advanced Grouped Tooltip -->
284
497
  @if (tooltip(); as t) {
285
498
  <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
286
- <strong>{{ t.cat }}</strong><br/>
287
- {{ t.series }}: {{ fmtNum(t.value) }}
499
+ <div class="tt-cat">{{ t.cat }}</div>
500
+ @for (row of t.rows; track row.name) {
501
+ <div class="tt-row">
502
+ <span class="tt-dot" [style.background]="row.color"></span>
503
+ <span class="tt-name">{{ row.name }}</span>
504
+ <span class="tt-val">{{ fmtNum(row.value) }}</span>
505
+ </div>
506
+ }
288
507
  </div>
289
508
  }
290
509
  </div>
291
- `, styles: [":host{display:block}.ngx-bar-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit}.chart-legend{display:flex;gap:16px;padding:0 0 8px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text, #6c757d)}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.chart-svg{display:block;overflow:visible}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d)}.bar-rect{cursor:pointer;transition:opacity .15s}.bar-rect:hover{opacity:.8}.bar-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%);background:var(--ngx-chart-tooltip-bg, #343a40);color:#fff;padding:6px 10px;border-radius:4px;font-size:12px;white-space:nowrap;margin-top:-8px;box-shadow:0 2px 8px #0003}\n"] }]
292
- }] });
510
+ `, styles: [":host{display:block;position:relative}.ngx-bar-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit}.chart-header{display:flex;justify-content:space-between;align-items:center;min-height:24px;position:relative}.chart-legend{display:flex;gap:16px;padding:4px 0 12px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text, #6c757d);font-weight:500}.legend-dot{width:10px;height:10px;border-radius:3px;display:inline-block}.chart-svg{display:block;overflow:visible}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d);-webkit-user-select:none;user-select:none;font-weight:500}.column-ruler{fill:#6366f108;stroke:#6366f114;stroke-width:1;rx:6;ry:6;pointer-events:none;transition:x .15s cubic-bezier(.16,1,.3,1),width .15s cubic-bezier(.16,1,.3,1)}.bar-rect{cursor:pointer;transition:y .5s cubic-bezier(.16,1,.3,1),height .5s cubic-bezier(.16,1,.3,1),fill-opacity .15s,stroke-width .15s;stroke:#fff;stroke-width:.5}.bar-rect:hover{fill-opacity:.9;stroke-width:1.5;filter:drop-shadow(0 4px 6px rgba(0,0,0,.08))}.bar-label{font-size:11px;fill:var(--ngx-chart-axis-text, #6c757d);pointer-events:none;font-weight:600}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .12s cubic-bezier(.16,1,.3,1),top .12s cubic-bezier(.16,1,.3,1);font-family:inherit}.tt-cat{font-weight:700;margin-bottom:8px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:6px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:5px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}.chart-export-menu{position:absolute;top:0;right:0;z-index:50}.export-trigger{padding:4px 10px;font-size:11px;font-weight:600;color:var(--ngx-chart-axis-text, #6c757d);background:#ffffffb3;backdrop-filter:blur(8px);border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:6px;cursor:pointer;transition:all .15s}.export-trigger:hover{background:#fff;color:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5)}.export-dropdown{position:absolute;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:8px;box-shadow:0 10px 15px -3px #00000014;padding:4px;display:flex;flex-direction:column;gap:2px;min-width:120px}.export-dropdown button{background:none;border:none;padding:6px 10px;font-size:11px;text-align:left;cursor:pointer;color:#343a40;border-radius:4px;font-family:inherit;width:100%;transition:all .12s}.export-dropdown button:hover{background:#4f46e50f;color:var(--primary-color, #4f46e5)}\n"] }]
511
+ }], ctorParameters: () => [], propDecorators: { closeExportMenu: [{
512
+ type: HostListener,
513
+ args: ['document:click']
514
+ }] } });
293
515
 
294
516
  class LineChartComponent {
295
517
  PAD_LEFT = 48;
@@ -304,15 +526,37 @@ class LineChartComponent {
304
526
  showMarkers = input(true);
305
527
  showLegend = input(true);
306
528
  colors = input(CHART_COLORS);
529
+ showExport = input(false);
530
+ svgEl = viewChild('svgEl');
531
+ exportMenuOpen = signal(false);
532
+ animateState = signal(false);
533
+ containerWidth = signal(600);
307
534
  crosshair = signal(null);
535
+ activeCategoryIndex = signal(null);
308
536
  tooltip = signal(null);
309
537
  chartHeight = computed(() => this.height());
310
- innerW = computed(() => 600 - this.PAD_LEFT - this.PAD_RIGHT);
538
+ innerW = computed(() => this.containerWidth() - this.PAD_LEFT - this.PAD_RIGHT);
311
539
  innerH = computed(() => this.chartHeight() - this.PAD_TOP - this.PAD_BOTTOM);
312
540
  allValues = computed(() => this.series().flatMap(s => s.data));
313
541
  yMin = computed(() => Math.min(0, ...this.allValues()));
314
542
  yMax = computed(() => Math.max(1, ...this.allValues()));
315
543
  yTicks = computed(() => niceTicks(this.yMin(), this.yMax(), 5));
544
+ constructor() {
545
+ const hostEl = inject(ElementRef).nativeElement;
546
+ if (typeof ResizeObserver !== 'undefined') {
547
+ const resizeObserver = new ResizeObserver(entries => {
548
+ if (!entries || entries.length === 0)
549
+ return;
550
+ const width = entries[0].contentRect.width;
551
+ if (width > 0) {
552
+ this.containerWidth.set(width);
553
+ }
554
+ });
555
+ resizeObserver.observe(hostEl);
556
+ inject(DestroyRef).onDestroy(() => resizeObserver.disconnect());
557
+ }
558
+ setTimeout(() => this.animateState.set(true), 50);
559
+ }
316
560
  yPos(v) { return scale(v, this.yMin(), this.yMax(), this.innerH(), 0); }
317
561
  xPos(i) {
318
562
  const n = this.categories().length;
@@ -340,6 +584,7 @@ class LineChartComponent {
340
584
  const idx = Math.round(scale(mx, 0, this.innerW(), 0, cats.length - 1));
341
585
  const ci = Math.max(0, Math.min(cats.length - 1, idx));
342
586
  this.crosshair.set({ x: this.xPos(ci) });
587
+ this.activeCategoryIndex.set(ci);
343
588
  const rows = this.series().map((s, si) => ({
344
589
  name: s.name,
345
590
  value: s.data[ci] ?? 0,
@@ -352,10 +597,117 @@ class LineChartComponent {
352
597
  rows,
353
598
  });
354
599
  }
600
+ onMouseLeave() {
601
+ this.crosshair.set(null);
602
+ this.activeCategoryIndex.set(null);
603
+ this.tooltip.set(null);
604
+ }
605
+ toggleExportMenu(event) {
606
+ event.stopPropagation();
607
+ this.exportMenuOpen.set(!this.exportMenuOpen());
608
+ }
609
+ closeExportMenu() {
610
+ this.exportMenuOpen.set(false);
611
+ }
612
+ onExport(type) {
613
+ this.exportMenuOpen.set(false);
614
+ if (type === 'json')
615
+ this.exportToJson();
616
+ else if (type === 'csv')
617
+ this.exportToCsv();
618
+ else if (type === 'svg')
619
+ this.exportToSvg();
620
+ }
621
+ exportToCsv() {
622
+ const cats = this.categories();
623
+ const sers = this.series();
624
+ if (!cats.length || !sers.length)
625
+ return;
626
+ let csv = 'Category,' + sers.map(s => `"${s.name}"`).join(',') + '\n';
627
+ cats.forEach((cat, ci) => {
628
+ const row = [cat];
629
+ sers.forEach(s => {
630
+ row.push(s.data[ci] !== undefined ? String(s.data[ci]) : '');
631
+ });
632
+ csv += row.join(',') + '\n';
633
+ });
634
+ const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
635
+ const link = document.createElement('a');
636
+ link.href = URL.createObjectURL(blob);
637
+ link.setAttribute('download', 'line-chart-data.csv');
638
+ document.body.appendChild(link);
639
+ link.click();
640
+ document.body.removeChild(link);
641
+ }
642
+ exportToJson() {
643
+ const cats = this.categories();
644
+ const sers = this.series();
645
+ if (!cats.length || !sers.length)
646
+ return;
647
+ const data = cats.map((cat, ci) => {
648
+ const entry = { category: cat };
649
+ sers.forEach(s => {
650
+ if (s.data[ci] !== undefined) {
651
+ entry[s.name] = s.data[ci];
652
+ }
653
+ });
654
+ return entry;
655
+ });
656
+ const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
657
+ const link = document.createElement('a');
658
+ link.href = URL.createObjectURL(blob);
659
+ link.setAttribute('download', 'line-chart-data.json');
660
+ document.body.appendChild(link);
661
+ link.click();
662
+ document.body.removeChild(link);
663
+ }
664
+ exportToSvg() {
665
+ const svg = this.svgEl()?.nativeElement;
666
+ if (!svg)
667
+ return;
668
+ const serializer = new XMLSerializer();
669
+ let source = serializer.serializeToString(svg);
670
+ if (!source.match(/^<svg[^>]+xmlns="http\:\/\/www\.w3\.org\/2000\/svg"/)) {
671
+ source = source.replace(/^<svg/, '<svg xmlns="http://www.w3.org/2000/svg"');
672
+ }
673
+ if (!source.match(/^<svg[^>]+xmlns\:xlink="http\:\/\/www\.w3\.org\/1999\/xlink"/)) {
674
+ source = source.replace(/^<svg/, '<svg xmlns:xlink="http://www.w3.org/1999/xlink"');
675
+ }
676
+ source = '<?xml version="1.0" encoding="utf-8"?>\n' + source;
677
+ const blob = new Blob([source], { type: 'image/svg+xml;charset=utf-8' });
678
+ const link = document.createElement('a');
679
+ link.href = URL.createObjectURL(blob);
680
+ link.setAttribute('download', 'line-chart.svg');
681
+ document.body.appendChild(link);
682
+ link.click();
683
+ document.body.removeChild(link);
684
+ }
355
685
  fmtNum = fmtNum;
356
686
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: LineChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
357
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: LineChartComponent, isStandalone: true, selector: "ngx-line-chart", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, categories: { classPropertyName: "categories", publicName: "categories", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showGrid: { classPropertyName: "showGrid", publicName: "showGrid", isSignal: true, isRequired: false, transformFunction: null }, showArea: { classPropertyName: "showArea", publicName: "showArea", isSignal: true, isRequired: false, transformFunction: null }, showMarkers: { classPropertyName: "showMarkers", publicName: "showMarkers", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
358
- <div class="ngx-line-chart" (mousemove)="onMouseMove($event)" (mouseleave)="crosshair.set(null)">
687
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: LineChartComponent, isStandalone: true, selector: "ngx-line-chart", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, categories: { classPropertyName: "categories", publicName: "categories", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showGrid: { classPropertyName: "showGrid", publicName: "showGrid", isSignal: true, isRequired: false, transformFunction: null }, showArea: { classPropertyName: "showArea", publicName: "showArea", isSignal: true, isRequired: false, transformFunction: null }, showMarkers: { classPropertyName: "showMarkers", publicName: "showMarkers", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, showExport: { classPropertyName: "showExport", publicName: "showExport", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:click": "closeExportMenu()" } }, viewQueries: [{ propertyName: "svgEl", first: true, predicate: ["svgEl"], descendants: true, isSignal: true }], ngImport: i0, template: `
688
+ <div
689
+ class="ngx-line-chart"
690
+ (mousemove)="onMouseMove($event)"
691
+ (mouseleave)="onMouseLeave()"
692
+ >
693
+ <!-- Toolbar with Export option -->
694
+ <div class="chart-header">
695
+ <div class="chart-title-space"></div>
696
+ @if (showExport()) {
697
+ <div class="chart-export-menu">
698
+ <button class="export-trigger" (click)="toggleExportMenu($event)" aria-label="Export Menu">📤 Export</button>
699
+ @if (exportMenuOpen()) {
700
+ <div class="export-dropdown">
701
+ <button (click)="onExport('json')">📊 Export JSON</button>
702
+ <button (click)="onExport('csv')">📄 Export CSV</button>
703
+ <button (click)="onExport('svg')">🖼️ Export SVG</button>
704
+ </div>
705
+ }
706
+ </div>
707
+ }
708
+ </div>
709
+
710
+ <!-- Legend -->
359
711
  @if (showLegend()) {
360
712
  <div class="chart-legend">
361
713
  @for (s of series(); track s.name; let i = $index) {
@@ -366,7 +718,14 @@ class LineChartComponent {
366
718
  }
367
719
  </div>
368
720
  }
369
- <svg [attr.width]="'100%'" [attr.height]="chartHeight()" class="chart-svg">
721
+
722
+ <!-- SVG Chart -->
723
+ <svg
724
+ #svgEl
725
+ [attr.width]="'100%'"
726
+ [attr.height]="chartHeight()"
727
+ class="chart-svg"
728
+ >
370
729
  <defs>
371
730
  @for (s of series(); track s.name; let i = $index) {
372
731
  <linearGradient [attr.id]="'area-grad-' + i" x1="0" y1="0" x2="0" y2="1">
@@ -377,6 +736,7 @@ class LineChartComponent {
377
736
  </defs>
378
737
  <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
379
738
 
739
+ <!-- Y axis ticks and gridlines -->
380
740
  @for (tick of yTicks(); track tick) {
381
741
  <g [attr.transform]="'translate(0,' + yPos(tick) + ')'">
382
742
  @if (showGrid()) {
@@ -386,16 +746,19 @@ class LineChartComponent {
386
746
  </g>
387
747
  }
388
748
 
749
+ <!-- X axis category labels -->
389
750
  @for (cat of categories(); track cat; let i = $index) {
390
751
  <text [attr.x]="xPos(i)" [attr.y]="innerH() + 16" class="axis-label" text-anchor="middle">{{ cat }}</text>
391
752
  }
392
753
 
754
+ <!-- Lines and Areas -->
393
755
  @for (s of series(); track s.name; let si = $index) {
394
756
  @if (showArea()) {
395
757
  <path
396
758
  [attr.d]="areaPath(s)"
397
759
  [attr.fill]="'url(#area-grad-' + si + ')'"
398
760
  stroke="none"
761
+ class="area-path"
399
762
  />
400
763
  }
401
764
  <path
@@ -405,16 +768,19 @@ class LineChartComponent {
405
768
  stroke-width="2.5"
406
769
  stroke-linejoin="round"
407
770
  stroke-linecap="round"
771
+ class="line-path"
408
772
  />
409
- @if (showMarkers()) {
773
+ @if (showMarkers() && animateState()) {
410
774
  @for (v of s.data; track $index; let ci = $index) {
411
775
  <circle
412
776
  [attr.cx]="xPos(ci)"
413
777
  [attr.cy]="yPos(v)"
414
- r="4"
778
+ [attr.r]="activeCategoryIndex() === ci ? 6 : 4"
415
779
  [attr.fill]="seriesColor(si, s)"
416
- stroke="#fff"
417
- stroke-width="2"
780
+ [attr.stroke]="activeCategoryIndex() === ci ? '#fff' : '#fff'"
781
+ [attr.stroke-width]="activeCategoryIndex() === ci ? 2.5 : 2"
782
+ [attr.filter]="activeCategoryIndex() === ci ? 'drop-shadow(0 2px 4px rgba(0,0,0,0.25))' : null"
783
+ class="marker-dot"
418
784
  />
419
785
  }
420
786
  }
@@ -423,7 +789,7 @@ class LineChartComponent {
423
789
  <!-- Crosshair -->
424
790
  @if (crosshair(); as ch) {
425
791
  <line [attr.x1]="ch.x" [attr.x2]="ch.x" y1="0" [attr.y2]="innerH()"
426
- stroke="var(--ngx-chart-axis,#ced4da)" stroke-dasharray="4,3"/>
792
+ stroke="var(--ngx-chart-axis,#ced4da)" stroke-dasharray="4,3" class="chart-crosshair"/>
427
793
  }
428
794
 
429
795
  <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis,#ced4da)"/>
@@ -431,24 +797,48 @@ class LineChartComponent {
431
797
  </g>
432
798
  </svg>
433
799
 
800
+ <!-- Premium Glassmorphic Tooltip -->
434
801
  @if (tooltip(); as t) {
435
802
  <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
436
803
  <div class="tt-cat">{{ t.cat }}</div>
437
804
  @for (row of t.rows; track row.name) {
438
805
  <div class="tt-row">
439
806
  <span class="tt-dot" [style.background]="row.color"></span>
440
- {{ row.name }}: <strong>{{ fmtNum(row.value) }}</strong>
807
+ <span class="tt-name">{{ row.name }}</span>
808
+ <span class="tt-val">{{ fmtNum(row.value) }}</span>
441
809
  </div>
442
810
  }
443
811
  </div>
444
812
  }
445
813
  </div>
446
- `, isInline: true, styles: [":host{display:block}.ngx-line-chart{position:relative;background:var(--ngx-chart-bg, #fff)}.chart-legend{display:flex;gap:16px;padding:0 0 8px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text,#6c757d)}.legend-line{width:20px;height:3px;border-radius:2px;display:inline-block}.chart-svg{display:block;overflow:visible;cursor:crosshair}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text,#6c757d)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg,#343a40);color:#fff;padding:8px 12px;border-radius:4px;font-size:12px;white-space:nowrap;box-shadow:0 2px 8px #0003}.tt-cat{font-weight:600;margin-bottom:4px}.tt-row{display:flex;align-items:center;gap:6px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
814
+ `, isInline: true, styles: [":host{display:block;position:relative}.ngx-line-chart{position:relative;background:var(--ngx-chart-bg, #fff)}.chart-header{display:flex;justify-content:space-between;align-items:center;min-height:24px;position:relative}.chart-legend{display:flex;gap:16px;padding:4px 0 12px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text,#6c757d);font-weight:500}.legend-line{width:18px;height:4px;border-radius:2px;display:inline-block}.chart-svg{display:block;overflow:visible;cursor:crosshair}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text,#6c757d);-webkit-user-select:none;user-select:none;font-weight:500}.chart-crosshair{transition:x1 .12s cubic-bezier(.16,1,.3,1),x2 .12s cubic-bezier(.16,1,.3,1)}@keyframes lineDraw{0%{stroke-dashoffset:1200}to{stroke-dashoffset:0}}.line-path{stroke-dasharray:1200;stroke-dashoffset:1200;animation:lineDraw 1.2s cubic-bezier(.16,1,.3,1) forwards}@keyframes areaFadeIn{0%{opacity:0}to{opacity:1}}.area-path{animation:areaFadeIn 1s cubic-bezier(.16,1,.3,1) .3s both}.marker-dot{animation:areaFadeIn .5s ease .8s both;transition:r .15s cubic-bezier(.16,1,.3,1),stroke-width .15s}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .12s cubic-bezier(.16,1,.3,1),top .12s cubic-bezier(.16,1,.3,1);font-family:inherit}.tt-cat{font-weight:700;margin-bottom:8px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:6px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:5px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}.chart-export-menu{position:absolute;top:0;right:0;z-index:50}.export-trigger{padding:4px 10px;font-size:11px;font-weight:600;color:var(--ngx-chart-axis-text, #6c757d);background:#ffffffb3;backdrop-filter:blur(8px);border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:6px;cursor:pointer;transition:all .15s}.export-trigger:hover{background:#fff;color:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5)}.export-dropdown{position:absolute;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:8px;box-shadow:0 10px 15px -3px #00000014;padding:4px;display:flex;flex-direction:column;gap:2px;min-width:120px}.export-dropdown button{background:none;border:none;padding:6px 10px;font-size:11px;text-align:left;cursor:pointer;color:#343a40;border-radius:4px;font-family:inherit;width:100%;transition:all .12s}.export-dropdown button:hover{background:#4f46e50f;color:var(--primary-color, #4f46e5)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
447
815
  }
448
816
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: LineChartComponent, decorators: [{
449
817
  type: Component,
450
- args: [{ selector: 'ngx-line-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
451
- <div class="ngx-line-chart" (mousemove)="onMouseMove($event)" (mouseleave)="crosshair.set(null)">
818
+ args: [{ selector: 'ngx-line-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
819
+ <div
820
+ class="ngx-line-chart"
821
+ (mousemove)="onMouseMove($event)"
822
+ (mouseleave)="onMouseLeave()"
823
+ >
824
+ <!-- Toolbar with Export option -->
825
+ <div class="chart-header">
826
+ <div class="chart-title-space"></div>
827
+ @if (showExport()) {
828
+ <div class="chart-export-menu">
829
+ <button class="export-trigger" (click)="toggleExportMenu($event)" aria-label="Export Menu">📤 Export</button>
830
+ @if (exportMenuOpen()) {
831
+ <div class="export-dropdown">
832
+ <button (click)="onExport('json')">📊 Export JSON</button>
833
+ <button (click)="onExport('csv')">📄 Export CSV</button>
834
+ <button (click)="onExport('svg')">🖼️ Export SVG</button>
835
+ </div>
836
+ }
837
+ </div>
838
+ }
839
+ </div>
840
+
841
+ <!-- Legend -->
452
842
  @if (showLegend()) {
453
843
  <div class="chart-legend">
454
844
  @for (s of series(); track s.name; let i = $index) {
@@ -459,7 +849,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
459
849
  }
460
850
  </div>
461
851
  }
462
- <svg [attr.width]="'100%'" [attr.height]="chartHeight()" class="chart-svg">
852
+
853
+ <!-- SVG Chart -->
854
+ <svg
855
+ #svgEl
856
+ [attr.width]="'100%'"
857
+ [attr.height]="chartHeight()"
858
+ class="chart-svg"
859
+ >
463
860
  <defs>
464
861
  @for (s of series(); track s.name; let i = $index) {
465
862
  <linearGradient [attr.id]="'area-grad-' + i" x1="0" y1="0" x2="0" y2="1">
@@ -470,6 +867,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
470
867
  </defs>
471
868
  <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
472
869
 
870
+ <!-- Y axis ticks and gridlines -->
473
871
  @for (tick of yTicks(); track tick) {
474
872
  <g [attr.transform]="'translate(0,' + yPos(tick) + ')'">
475
873
  @if (showGrid()) {
@@ -479,16 +877,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
479
877
  </g>
480
878
  }
481
879
 
880
+ <!-- X axis category labels -->
482
881
  @for (cat of categories(); track cat; let i = $index) {
483
882
  <text [attr.x]="xPos(i)" [attr.y]="innerH() + 16" class="axis-label" text-anchor="middle">{{ cat }}</text>
484
883
  }
485
884
 
885
+ <!-- Lines and Areas -->
486
886
  @for (s of series(); track s.name; let si = $index) {
487
887
  @if (showArea()) {
488
888
  <path
489
889
  [attr.d]="areaPath(s)"
490
890
  [attr.fill]="'url(#area-grad-' + si + ')'"
491
891
  stroke="none"
892
+ class="area-path"
492
893
  />
493
894
  }
494
895
  <path
@@ -498,16 +899,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
498
899
  stroke-width="2.5"
499
900
  stroke-linejoin="round"
500
901
  stroke-linecap="round"
902
+ class="line-path"
501
903
  />
502
- @if (showMarkers()) {
904
+ @if (showMarkers() && animateState()) {
503
905
  @for (v of s.data; track $index; let ci = $index) {
504
906
  <circle
505
907
  [attr.cx]="xPos(ci)"
506
908
  [attr.cy]="yPos(v)"
507
- r="4"
909
+ [attr.r]="activeCategoryIndex() === ci ? 6 : 4"
508
910
  [attr.fill]="seriesColor(si, s)"
509
- stroke="#fff"
510
- stroke-width="2"
911
+ [attr.stroke]="activeCategoryIndex() === ci ? '#fff' : '#fff'"
912
+ [attr.stroke-width]="activeCategoryIndex() === ci ? 2.5 : 2"
913
+ [attr.filter]="activeCategoryIndex() === ci ? 'drop-shadow(0 2px 4px rgba(0,0,0,0.25))' : null"
914
+ class="marker-dot"
511
915
  />
512
916
  }
513
917
  }
@@ -516,7 +920,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
516
920
  <!-- Crosshair -->
517
921
  @if (crosshair(); as ch) {
518
922
  <line [attr.x1]="ch.x" [attr.x2]="ch.x" y1="0" [attr.y2]="innerH()"
519
- stroke="var(--ngx-chart-axis,#ced4da)" stroke-dasharray="4,3"/>
923
+ stroke="var(--ngx-chart-axis,#ced4da)" stroke-dasharray="4,3" class="chart-crosshair"/>
520
924
  }
521
925
 
522
926
  <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis,#ced4da)"/>
@@ -524,20 +928,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
524
928
  </g>
525
929
  </svg>
526
930
 
931
+ <!-- Premium Glassmorphic Tooltip -->
527
932
  @if (tooltip(); as t) {
528
933
  <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
529
934
  <div class="tt-cat">{{ t.cat }}</div>
530
935
  @for (row of t.rows; track row.name) {
531
936
  <div class="tt-row">
532
937
  <span class="tt-dot" [style.background]="row.color"></span>
533
- {{ row.name }}: <strong>{{ fmtNum(row.value) }}</strong>
938
+ <span class="tt-name">{{ row.name }}</span>
939
+ <span class="tt-val">{{ fmtNum(row.value) }}</span>
534
940
  </div>
535
941
  }
536
942
  </div>
537
943
  }
538
944
  </div>
539
- `, styles: [":host{display:block}.ngx-line-chart{position:relative;background:var(--ngx-chart-bg, #fff)}.chart-legend{display:flex;gap:16px;padding:0 0 8px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text,#6c757d)}.legend-line{width:20px;height:3px;border-radius:2px;display:inline-block}.chart-svg{display:block;overflow:visible;cursor:crosshair}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text,#6c757d)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg,#343a40);color:#fff;padding:8px 12px;border-radius:4px;font-size:12px;white-space:nowrap;box-shadow:0 2px 8px #0003}.tt-cat{font-weight:600;margin-bottom:4px}.tt-row{display:flex;align-items:center;gap:6px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}\n"] }]
540
- }] });
945
+ `, styles: [":host{display:block;position:relative}.ngx-line-chart{position:relative;background:var(--ngx-chart-bg, #fff)}.chart-header{display:flex;justify-content:space-between;align-items:center;min-height:24px;position:relative}.chart-legend{display:flex;gap:16px;padding:4px 0 12px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ngx-chart-axis-text,#6c757d);font-weight:500}.legend-line{width:18px;height:4px;border-radius:2px;display:inline-block}.chart-svg{display:block;overflow:visible;cursor:crosshair}.axis-label{font-size:11px;fill:var(--ngx-chart-axis-text,#6c757d);-webkit-user-select:none;user-select:none;font-weight:500}.chart-crosshair{transition:x1 .12s cubic-bezier(.16,1,.3,1),x2 .12s cubic-bezier(.16,1,.3,1)}@keyframes lineDraw{0%{stroke-dashoffset:1200}to{stroke-dashoffset:0}}.line-path{stroke-dasharray:1200;stroke-dashoffset:1200;animation:lineDraw 1.2s cubic-bezier(.16,1,.3,1) forwards}@keyframes areaFadeIn{0%{opacity:0}to{opacity:1}}.area-path{animation:areaFadeIn 1s cubic-bezier(.16,1,.3,1) .3s both}.marker-dot{animation:areaFadeIn .5s ease .8s both;transition:r .15s cubic-bezier(.16,1,.3,1),stroke-width .15s}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .12s cubic-bezier(.16,1,.3,1),top .12s cubic-bezier(.16,1,.3,1);font-family:inherit}.tt-cat{font-weight:700;margin-bottom:8px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:6px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:5px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}.chart-export-menu{position:absolute;top:0;right:0;z-index:50}.export-trigger{padding:4px 10px;font-size:11px;font-weight:600;color:var(--ngx-chart-axis-text, #6c757d);background:#ffffffb3;backdrop-filter:blur(8px);border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:6px;cursor:pointer;transition:all .15s}.export-trigger:hover{background:#fff;color:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5)}.export-dropdown{position:absolute;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:8px;box-shadow:0 10px 15px -3px #00000014;padding:4px;display:flex;flex-direction:column;gap:2px;min-width:120px}.export-dropdown button{background:none;border:none;padding:6px 10px;font-size:11px;text-align:left;cursor:pointer;color:#343a40;border-radius:4px;font-family:inherit;width:100%;transition:all .12s}.export-dropdown button:hover{background:#4f46e50f;color:var(--primary-color, #4f46e5)}\n"] }]
946
+ }], ctorParameters: () => [], propDecorators: { closeExportMenu: [{
947
+ type: HostListener,
948
+ args: ['document:click']
949
+ }] } });
541
950
 
542
951
  class PieChartComponent {
543
952
  data = input([]);
@@ -548,7 +957,11 @@ class PieChartComponent {
548
957
  showLabels = input(true);
549
958
  colors = input(CHART_COLORS);
550
959
  centerTitle = input('Total');
960
+ centerValueOverride = input(null, { alias: 'centerValue' });
961
+ showExport = input(false);
551
962
  colors$ = this.colors;
963
+ svgEl = viewChild('svgEl');
964
+ exportMenuOpen = signal(false);
552
965
  hovered = signal(-1);
553
966
  tooltip = signal(null);
554
967
  svgSize = computed(() => this.height());
@@ -556,7 +969,11 @@ class PieChartComponent {
556
969
  cy = computed(() => this.svgSize() / 2);
557
970
  radius = computed(() => this.svgSize() / 2 - 10);
558
971
  holeR = computed(() => this.radius() * this.donutHoleSize());
972
+ constructor() { }
559
973
  centerValue = computed(() => {
974
+ const override = this.centerValueOverride();
975
+ if (override !== null)
976
+ return override;
560
977
  const total = this.data().reduce((s, d) => s + d.value, 0);
561
978
  return fmtNum(total);
562
979
  });
@@ -566,11 +983,19 @@ class PieChartComponent {
566
983
  let start = -Math.PI / 2;
567
984
  return d.map((item, i) => {
568
985
  const frac = item.value / total;
569
- const angle = frac * Math.PI * 2;
986
+ let angle = frac * Math.PI * 2;
987
+ // Cap angle slightly if it is a full circle to prevent coinciding SVG endpoints
988
+ if (frac >= 0.999) {
989
+ angle = Math.PI * 2 - 0.0001;
990
+ }
570
991
  const end = start + angle;
571
992
  const mid = start + angle / 2;
572
993
  const r = this.radius();
573
- const path = this.arcPath(start, end, r);
994
+ const path = this.mode() === 'donut'
995
+ ? this.ringPath(start, end, r, this.holeR())
996
+ : this.arcPath(start, end, r);
997
+ const cos = Math.cos(mid);
998
+ const sin = Math.sin(mid);
574
999
  start = end;
575
1000
  return {
576
1001
  index: i,
@@ -580,6 +1005,8 @@ class PieChartComponent {
580
1005
  color: item.color || this.colors()[i % this.colors().length],
581
1006
  path,
582
1007
  midAngle: mid,
1008
+ cos,
1009
+ sin,
583
1010
  };
584
1011
  });
585
1012
  });
@@ -591,8 +1018,26 @@ class PieChartComponent {
591
1018
  const large = endAngle - startAngle > Math.PI ? 1 : 0;
592
1019
  return `M 0 0 L ${x1} ${y1} A ${r} ${r} 0 ${large} 1 ${x2} ${y2} Z`;
593
1020
  }
594
- labelX(s) { return Math.cos(s.midAngle) * this.radius() * 0.7; }
595
- labelY(s) { return Math.sin(s.midAngle) * this.radius() * 0.7; }
1021
+ ringPath(startAngle, endAngle, outerR, innerR) {
1022
+ const ox1 = Math.cos(startAngle) * outerR;
1023
+ const oy1 = Math.sin(startAngle) * outerR;
1024
+ const ox2 = Math.cos(endAngle) * outerR;
1025
+ const oy2 = Math.sin(endAngle) * outerR;
1026
+ const ix1 = Math.cos(startAngle) * innerR;
1027
+ const iy1 = Math.sin(startAngle) * innerR;
1028
+ const ix2 = Math.cos(endAngle) * innerR;
1029
+ const iy2 = Math.sin(endAngle) * innerR;
1030
+ const large = endAngle - startAngle > Math.PI ? 1 : 0;
1031
+ return `M ${ix1} ${iy1} L ${ox1} ${oy1} A ${outerR} ${outerR} 0 ${large} 1 ${ox2} ${oy2} L ${ix2} ${iy2} A ${innerR} ${innerR} 0 ${large} 0 ${ix1} ${iy1} Z`;
1032
+ }
1033
+ labelX(s) {
1034
+ const r = this.mode() === 'donut' ? (this.radius() + this.holeR()) / 2 : this.radius() * 0.7;
1035
+ return Math.cos(s.midAngle) * r;
1036
+ }
1037
+ labelY(s) {
1038
+ const r = this.mode() === 'donut' ? (this.radius() + this.holeR()) / 2 : this.radius() * 0.7;
1039
+ return Math.sin(s.midAngle) * r;
1040
+ }
596
1041
  onSliceHover(event, slice) {
597
1042
  const el = event.currentTarget.closest('.ngx-pie-chart');
598
1043
  const rect = el.getBoundingClientRect();
@@ -602,13 +1047,101 @@ class PieChartComponent {
602
1047
  ...slice,
603
1048
  });
604
1049
  }
1050
+ toggleExportMenu(event) {
1051
+ event.stopPropagation();
1052
+ this.exportMenuOpen.set(!this.exportMenuOpen());
1053
+ }
1054
+ closeExportMenu() {
1055
+ this.exportMenuOpen.set(false);
1056
+ }
1057
+ onExport(type) {
1058
+ this.exportMenuOpen.set(false);
1059
+ if (type === 'json')
1060
+ this.exportToJson();
1061
+ else if (type === 'csv')
1062
+ this.exportToCsv();
1063
+ else if (type === 'svg')
1064
+ this.exportToSvg();
1065
+ }
1066
+ exportToCsv() {
1067
+ const data = this.data();
1068
+ if (!data.length)
1069
+ return;
1070
+ let csv = 'Label,Value\n';
1071
+ data.forEach(d => {
1072
+ csv += `"${d.label}",${d.value}\n`;
1073
+ });
1074
+ const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
1075
+ const link = document.createElement('a');
1076
+ link.href = URL.createObjectURL(blob);
1077
+ link.setAttribute('download', 'pie-chart-data.csv');
1078
+ document.body.appendChild(link);
1079
+ link.click();
1080
+ document.body.removeChild(link);
1081
+ }
1082
+ exportToJson() {
1083
+ const data = this.data();
1084
+ if (!data.length)
1085
+ return;
1086
+ const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
1087
+ const link = document.createElement('a');
1088
+ link.href = URL.createObjectURL(blob);
1089
+ link.setAttribute('download', 'pie-chart-data.json');
1090
+ document.body.appendChild(link);
1091
+ link.click();
1092
+ document.body.removeChild(link);
1093
+ }
1094
+ exportToSvg() {
1095
+ const svg = this.svgEl()?.nativeElement;
1096
+ if (!svg)
1097
+ return;
1098
+ const serializer = new XMLSerializer();
1099
+ let source = serializer.serializeToString(svg);
1100
+ if (!source.match(/^<svg[^>]+xmlns="http\:\/\/www\.w3\.org\/2000\/svg"/)) {
1101
+ source = source.replace(/^<svg/, '<svg xmlns="http://www.w3.org/2000/svg"');
1102
+ }
1103
+ if (!source.match(/^<svg[^>]+xmlns\:xlink="http\:\/\/www\.w3\.org\/1999\/xlink"/)) {
1104
+ source = source.replace(/^<svg/, '<svg xmlns:xlink="http://www.w3.org/1999/xlink"');
1105
+ }
1106
+ source = '<?xml version="1.0" encoding="utf-8"?>\n' + source;
1107
+ const blob = new Blob([source], { type: 'image/svg+xml;charset=utf-8' });
1108
+ const link = document.createElement('a');
1109
+ link.href = URL.createObjectURL(blob);
1110
+ link.setAttribute('download', 'pie-chart.svg');
1111
+ document.body.appendChild(link);
1112
+ link.click();
1113
+ document.body.removeChild(link);
1114
+ }
605
1115
  fmtNum = fmtNum;
606
1116
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: PieChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
607
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: PieChartComponent, isStandalone: true, selector: "ngx-pie-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, donutHoleSize: { classPropertyName: "donutHoleSize", publicName: "donutHoleSize", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, centerTitle: { classPropertyName: "centerTitle", publicName: "centerTitle", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1117
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: PieChartComponent, isStandalone: true, selector: "ngx-pie-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, donutHoleSize: { classPropertyName: "donutHoleSize", publicName: "donutHoleSize", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, centerTitle: { classPropertyName: "centerTitle", publicName: "centerTitle", isSignal: true, isRequired: false, transformFunction: null }, centerValueOverride: { classPropertyName: "centerValueOverride", publicName: "centerValue", isSignal: true, isRequired: false, transformFunction: null }, showExport: { classPropertyName: "showExport", publicName: "showExport", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:click": "closeExportMenu()" } }, viewQueries: [{ propertyName: "svgEl", first: true, predicate: ["svgEl"], descendants: true, isSignal: true }], ngImport: i0, template: `
608
1118
  <div class="ngx-pie-chart">
1119
+ <!-- Toolbar with Export option -->
1120
+ <div class="chart-header">
1121
+ <div class="chart-title-space"></div>
1122
+ @if (showExport()) {
1123
+ <div class="chart-export-menu">
1124
+ <button class="export-trigger" (click)="toggleExportMenu($event)" aria-label="Export Menu">📤 Export</button>
1125
+ @if (exportMenuOpen()) {
1126
+ <div class="export-dropdown">
1127
+ <button (click)="onExport('json')">📊 Export JSON</button>
1128
+ <button (click)="onExport('csv')">📄 Export CSV</button>
1129
+ <button (click)="onExport('svg')">🖼️ Export SVG</button>
1130
+ </div>
1131
+ }
1132
+ </div>
1133
+ }
1134
+ </div>
1135
+
609
1136
  <div class="chart-body">
610
- <svg class="chart-svg" [attr.width]="svgSize()" [attr.height]="svgSize()">
611
- <g [attr.transform]="'translate(' + cx() + ',' + cy() + ')'">
1137
+ <svg
1138
+ #svgEl
1139
+ class="chart-svg"
1140
+ [attr.viewBox]="'0 0 ' + height() + ' ' + height()"
1141
+ [attr.width]="height()"
1142
+ [attr.height]="height()"
1143
+ >
1144
+ <g [attr.transform]="'translate(' + cx() + ',' + cy() + ')'" class="pie-group">
612
1145
  @for (slice of slices(); track slice.index) {
613
1146
  <path
614
1147
  [attr.d]="slice.path"
@@ -617,6 +1150,7 @@ class PieChartComponent {
617
1150
  stroke-width="2"
618
1151
  class="pie-slice"
619
1152
  [class.hovered]="hovered() === slice.index"
1153
+ [style.transform]="hovered() === slice.index ? 'translate(' + (slice.cos * 8) + 'px,' + (slice.sin * 8) + 'px)' : 'translate(0, 0)'"
620
1154
  (mouseenter)="hovered.set(slice.index); onSliceHover($event, slice)"
621
1155
  (mouseleave)="hovered.set(-1); tooltip.set(null)"
622
1156
  />
@@ -632,7 +1166,6 @@ class PieChartComponent {
632
1166
  }
633
1167
  <!-- Donut hole -->
634
1168
  @if (mode() === 'donut') {
635
- <circle [attr.r]="holeR()" fill="var(--ngx-chart-bg,#fff)"/>
636
1169
  <text class="donut-center-text" text-anchor="middle" dy="-8">{{ centerTitle() }}</text>
637
1170
  <text class="donut-center-value" text-anchor="middle" dy="14">{{ centerValue() }}</text>
638
1171
  }
@@ -652,6 +1185,7 @@ class PieChartComponent {
652
1185
  }
653
1186
  </div>
654
1187
 
1188
+ <!-- Premium Glassmorphic Tooltip -->
655
1189
  @if (tooltip(); as t) {
656
1190
  <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
657
1191
  <span class="tt-dot" [style.background]="t.color"></span>
@@ -659,15 +1193,38 @@ class PieChartComponent {
659
1193
  </div>
660
1194
  }
661
1195
  </div>
662
- `, isInline: true, styles: [":host{display:block}.ngx-pie-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit}.chart-body{display:flex;align-items:center;gap:24px;flex-wrap:wrap}.chart-svg{display:block;overflow:visible;flex-shrink:0}.pie-slice{cursor:pointer;transition:transform .15s,opacity .15s;transform-origin:center}.pie-slice.hovered{transform:scale(1.03);opacity:.9}.slice-label{font-size:11px;fill:#fff;font-weight:600;pointer-events:none}.donut-center-text{font-size:12px;fill:var(--ngx-chart-axis-text,#6c757d)}.donut-center-value{font-size:20px;font-weight:700;fill:var(--ngx-chart-text,#212529)}.chart-legend{display:flex;flex-direction:column;gap:6px}.legend-item{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;padding:2px 4px;border-radius:3px}.legend-item:hover{background:var(--ngx-chart-grid,#f1f3f5)}.legend-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0}.legend-label{flex:1;color:var(--ngx-chart-axis-text,#6c757d)}.legend-pct{font-weight:600;color:var(--ngx-chart-text,#212529)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg,#343a40);color:#fff;padding:6px 10px;border-radius:4px;font-size:12px;white-space:nowrap;display:flex;align-items:center;gap:6px}.tt-dot{width:8px;height:8px;border-radius:50%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1196
+ `, isInline: true, styles: [":host{display:block;position:relative}.ngx-pie-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit;overflow:hidden}.chart-header{display:flex;justify-content:space-between;align-items:center;min-height:24px;position:relative}.chart-body{display:flex;align-items:center;justify-content:center;gap:24px;flex-wrap:wrap}.chart-svg{display:block;max-width:100%;height:auto;min-width:0;animation:pieGrow .75s cubic-bezier(.16,1,.3,1) both;transform-origin:center}@keyframes pieGrow{0%{transform:scale(.4) rotate(-90deg);opacity:0}to{transform:scale(1) rotate(0);opacity:1}}.pie-group{transform-origin:center}.pie-slice{cursor:pointer;transition:transform .25s cubic-bezier(.16,1,.3,1),fill-opacity .15s;transform-origin:0px 0px}.pie-slice.hovered{fill-opacity:.95;filter:drop-shadow(0 6px 10px rgba(0,0,0,.16))}.slice-label{font-size:11px;fill:#fff;font-weight:600;pointer-events:none;-webkit-user-select:none;user-select:none}.donut-center-text{font-size:11px;fill:var(--ngx-chart-axis-text,#6c757d);font-weight:600;text-transform:uppercase;letter-spacing:.5px}.donut-center-value{font-size:24px;font-weight:900;fill:var(--ngx-chart-text,#0f172a)}.chart-legend{display:flex;flex-direction:column;gap:6px;flex-shrink:0}.legend-item{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;padding:5px 10px;border-radius:8px;transition:all .15s}.legend-item:hover{background:var(--ngx-chart-grid,#f1f3f5)}.legend-dot{width:10px;height:10px;border-radius:3px;flex-shrink:0}.legend-label{flex:1;color:var(--ngx-chart-axis-text,#6c757d);font-weight:500}.legend-pct{font-weight:600;color:var(--ngx-chart-text,#212529)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:140px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;display:flex;align-items:center;gap:6px;transition:left .12s cubic-bezier(.16,1,.3,1),top .12s cubic-bezier(.16,1,.3,1);font-family:inherit}.tt-dot{width:8px;height:8px;border-radius:50%}.chart-export-menu{position:absolute;top:0;right:0;z-index:50}.export-trigger{padding:4px 10px;font-size:11px;font-weight:600;color:var(--ngx-chart-axis-text, #6c757d);background:#ffffffb3;backdrop-filter:blur(8px);border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:6px;cursor:pointer;transition:all .15s}.export-trigger:hover{background:#fff;color:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5)}.export-dropdown{position:absolute;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:8px;box-shadow:0 10px 15px -3px #00000014;padding:4px;display:flex;flex-direction:column;gap:2px;min-width:120px}.export-dropdown button{background:none;border:none;padding:6px 10px;font-size:11px;text-align:left;cursor:pointer;color:#343a40;border-radius:4px;font-family:inherit;width:100%;transition:all .12s}.export-dropdown button:hover{background:#4f46e50f;color:var(--primary-color, #4f46e5)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
663
1197
  }
664
1198
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: PieChartComponent, decorators: [{
665
1199
  type: Component,
666
- args: [{ selector: 'ngx-pie-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
1200
+ args: [{ selector: 'ngx-pie-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
667
1201
  <div class="ngx-pie-chart">
1202
+ <!-- Toolbar with Export option -->
1203
+ <div class="chart-header">
1204
+ <div class="chart-title-space"></div>
1205
+ @if (showExport()) {
1206
+ <div class="chart-export-menu">
1207
+ <button class="export-trigger" (click)="toggleExportMenu($event)" aria-label="Export Menu">📤 Export</button>
1208
+ @if (exportMenuOpen()) {
1209
+ <div class="export-dropdown">
1210
+ <button (click)="onExport('json')">📊 Export JSON</button>
1211
+ <button (click)="onExport('csv')">📄 Export CSV</button>
1212
+ <button (click)="onExport('svg')">🖼️ Export SVG</button>
1213
+ </div>
1214
+ }
1215
+ </div>
1216
+ }
1217
+ </div>
1218
+
668
1219
  <div class="chart-body">
669
- <svg class="chart-svg" [attr.width]="svgSize()" [attr.height]="svgSize()">
670
- <g [attr.transform]="'translate(' + cx() + ',' + cy() + ')'">
1220
+ <svg
1221
+ #svgEl
1222
+ class="chart-svg"
1223
+ [attr.viewBox]="'0 0 ' + height() + ' ' + height()"
1224
+ [attr.width]="height()"
1225
+ [attr.height]="height()"
1226
+ >
1227
+ <g [attr.transform]="'translate(' + cx() + ',' + cy() + ')'" class="pie-group">
671
1228
  @for (slice of slices(); track slice.index) {
672
1229
  <path
673
1230
  [attr.d]="slice.path"
@@ -676,6 +1233,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
676
1233
  stroke-width="2"
677
1234
  class="pie-slice"
678
1235
  [class.hovered]="hovered() === slice.index"
1236
+ [style.transform]="hovered() === slice.index ? 'translate(' + (slice.cos * 8) + 'px,' + (slice.sin * 8) + 'px)' : 'translate(0, 0)'"
679
1237
  (mouseenter)="hovered.set(slice.index); onSliceHover($event, slice)"
680
1238
  (mouseleave)="hovered.set(-1); tooltip.set(null)"
681
1239
  />
@@ -691,7 +1249,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
691
1249
  }
692
1250
  <!-- Donut hole -->
693
1251
  @if (mode() === 'donut') {
694
- <circle [attr.r]="holeR()" fill="var(--ngx-chart-bg,#fff)"/>
695
1252
  <text class="donut-center-text" text-anchor="middle" dy="-8">{{ centerTitle() }}</text>
696
1253
  <text class="donut-center-value" text-anchor="middle" dy="14">{{ centerValue() }}</text>
697
1254
  }
@@ -711,6 +1268,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
711
1268
  }
712
1269
  </div>
713
1270
 
1271
+ <!-- Premium Glassmorphic Tooltip -->
714
1272
  @if (tooltip(); as t) {
715
1273
  <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
716
1274
  <span class="tt-dot" [style.background]="t.color"></span>
@@ -718,8 +1276,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
718
1276
  </div>
719
1277
  }
720
1278
  </div>
721
- `, styles: [":host{display:block}.ngx-pie-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit}.chart-body{display:flex;align-items:center;gap:24px;flex-wrap:wrap}.chart-svg{display:block;overflow:visible;flex-shrink:0}.pie-slice{cursor:pointer;transition:transform .15s,opacity .15s;transform-origin:center}.pie-slice.hovered{transform:scale(1.03);opacity:.9}.slice-label{font-size:11px;fill:#fff;font-weight:600;pointer-events:none}.donut-center-text{font-size:12px;fill:var(--ngx-chart-axis-text,#6c757d)}.donut-center-value{font-size:20px;font-weight:700;fill:var(--ngx-chart-text,#212529)}.chart-legend{display:flex;flex-direction:column;gap:6px}.legend-item{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;padding:2px 4px;border-radius:3px}.legend-item:hover{background:var(--ngx-chart-grid,#f1f3f5)}.legend-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0}.legend-label{flex:1;color:var(--ngx-chart-axis-text,#6c757d)}.legend-pct{font-weight:600;color:var(--ngx-chart-text,#212529)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg,#343a40);color:#fff;padding:6px 10px;border-radius:4px;font-size:12px;white-space:nowrap;display:flex;align-items:center;gap:6px}.tt-dot{width:8px;height:8px;border-radius:50%}\n"] }]
722
- }] });
1279
+ `, styles: [":host{display:block;position:relative}.ngx-pie-chart{position:relative;background:var(--ngx-chart-bg, #fff);font-family:inherit;overflow:hidden}.chart-header{display:flex;justify-content:space-between;align-items:center;min-height:24px;position:relative}.chart-body{display:flex;align-items:center;justify-content:center;gap:24px;flex-wrap:wrap}.chart-svg{display:block;max-width:100%;height:auto;min-width:0;animation:pieGrow .75s cubic-bezier(.16,1,.3,1) both;transform-origin:center}@keyframes pieGrow{0%{transform:scale(.4) rotate(-90deg);opacity:0}to{transform:scale(1) rotate(0);opacity:1}}.pie-group{transform-origin:center}.pie-slice{cursor:pointer;transition:transform .25s cubic-bezier(.16,1,.3,1),fill-opacity .15s;transform-origin:0px 0px}.pie-slice.hovered{fill-opacity:.95;filter:drop-shadow(0 6px 10px rgba(0,0,0,.16))}.slice-label{font-size:11px;fill:#fff;font-weight:600;pointer-events:none;-webkit-user-select:none;user-select:none}.donut-center-text{font-size:11px;fill:var(--ngx-chart-axis-text,#6c757d);font-weight:600;text-transform:uppercase;letter-spacing:.5px}.donut-center-value{font-size:24px;font-weight:900;fill:var(--ngx-chart-text,#0f172a)}.chart-legend{display:flex;flex-direction:column;gap:6px;flex-shrink:0}.legend-item{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;padding:5px 10px;border-radius:8px;transition:all .15s}.legend-item:hover{background:var(--ngx-chart-grid,#f1f3f5)}.legend-dot{width:10px;height:10px;border-radius:3px;flex-shrink:0}.legend-label{flex:1;color:var(--ngx-chart-axis-text,#6c757d);font-weight:500}.legend-pct{font-weight:600;color:var(--ngx-chart-text,#212529)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:140px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;display:flex;align-items:center;gap:6px;transition:left .12s cubic-bezier(.16,1,.3,1),top .12s cubic-bezier(.16,1,.3,1);font-family:inherit}.tt-dot{width:8px;height:8px;border-radius:50%}.chart-export-menu{position:absolute;top:0;right:0;z-index:50}.export-trigger{padding:4px 10px;font-size:11px;font-weight:600;color:var(--ngx-chart-axis-text, #6c757d);background:#ffffffb3;backdrop-filter:blur(8px);border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:6px;cursor:pointer;transition:all .15s}.export-trigger:hover{background:#fff;color:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5)}.export-dropdown{position:absolute;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:8px;box-shadow:0 10px 15px -3px #00000014;padding:4px;display:flex;flex-direction:column;gap:2px;min-width:120px}.export-dropdown button{background:none;border:none;padding:6px 10px;font-size:11px;text-align:left;cursor:pointer;color:#343a40;border-radius:4px;font-family:inherit;width:100%;transition:all .12s}.export-dropdown button:hover{background:#4f46e50f;color:var(--primary-color, #4f46e5)}\n"] }]
1280
+ }], ctorParameters: () => [], propDecorators: { closeExportMenu: [{
1281
+ type: HostListener,
1282
+ args: ['document:click']
1283
+ }] } });
723
1284
 
724
1285
  class SparklineComponent {
725
1286
  data = input([]);
@@ -730,6 +1291,7 @@ class SparklineComponent {
730
1291
  PAD = 2;
731
1292
  w = computed(() => this.width() - this.PAD * 2);
732
1293
  h = computed(() => this.height() - this.PAD * 2);
1294
+ hoveredIndex = signal(null);
733
1295
  yMin = computed(() => Math.min(...this.data(), 0));
734
1296
  yMax = computed(() => Math.max(...this.data(), 1));
735
1297
  pts = computed(() => {
@@ -753,11 +1315,16 @@ class SparklineComponent {
753
1315
  const bottom = this.PAD + this.h();
754
1316
  return line + ` L ${last[0]} ${bottom} L ${first[0]} ${bottom} Z`;
755
1317
  });
756
- areaFill = computed(() => this.color() + '22');
757
1318
  endPoint = computed(() => {
758
1319
  const pts = this.pts();
759
1320
  return pts.length > 0 ? pts[pts.length - 1] : null;
760
1321
  });
1322
+ activePoint = computed(() => {
1323
+ const idx = this.hoveredIndex();
1324
+ if (this.type() === 'bar')
1325
+ return null; // Dot tracking only for lines/areas
1326
+ return idx !== null && this.pts()[idx] ? this.pts()[idx] : null;
1327
+ });
761
1328
  barItems = computed(() => {
762
1329
  const d = this.data();
763
1330
  const n = d.length;
@@ -771,6 +1338,16 @@ class SparklineComponent {
771
1338
  return { x, y, w: bw, h: Math.abs(zero - y) };
772
1339
  });
773
1340
  });
1341
+ onMouseMove(event) {
1342
+ const el = event.currentTarget;
1343
+ const rect = el.getBoundingClientRect();
1344
+ const x = event.clientX - rect.left - this.PAD;
1345
+ const n = this.data().length;
1346
+ if (n === 0)
1347
+ return;
1348
+ const idx = Math.max(0, Math.min(n - 1, Math.round(scale(x, 0, this.w(), 0, n - 1))));
1349
+ this.hoveredIndex.set(idx);
1350
+ }
774
1351
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SparklineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
775
1352
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: SparklineComponent, isStandalone: true, selector: "ngx-sparkline", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
776
1353
  <svg
@@ -778,10 +1355,19 @@ class SparklineComponent {
778
1355
  [attr.height]="height()"
779
1356
  class="ngx-sparkline"
780
1357
  [attr.aria-label]="'Sparkline'"
1358
+ (mousemove)="onMouseMove($event)"
1359
+ (mouseleave)="hoveredIndex.set(null)"
781
1360
  >
1361
+ <defs>
1362
+ <linearGradient id="sparkline-grad" x1="0%" y1="0%" x2="0%" y2="100%">
1363
+ <stop offset="0%" [attr.stop-color]="color()" stop-opacity="0.32" />
1364
+ <stop offset="100%" [attr.stop-color]="color()" stop-opacity="0" />
1365
+ </linearGradient>
1366
+ </defs>
1367
+
782
1368
  @if (type() === 'line' || type() === 'area') {
783
1369
  @if (type() === 'area') {
784
- <path [attr.d]="areaPath()" [attr.fill]="areaFill()" stroke="none"/>
1370
+ <path [attr.d]="areaPath()" fill="url(#sparkline-grad)" stroke="none" class="sparkline-area"/>
785
1371
  }
786
1372
  <path
787
1373
  [attr.d]="linePath()"
@@ -790,14 +1376,17 @@ class SparklineComponent {
790
1376
  stroke-width="2"
791
1377
  stroke-linejoin="round"
792
1378
  stroke-linecap="round"
1379
+ class="sparkline-path"
793
1380
  />
794
- <!-- End dot -->
1381
+ <!-- End dot (if not hovered) -->
795
1382
  @if (endPoint(); as ep) {
796
- <circle [attr.cx]="ep[0]" [attr.cy]="ep[1]" r="3" [attr.fill]="color()"/>
1383
+ @if (hoveredIndex() === null) {
1384
+ <circle [attr.cx]="ep[0]" [attr.cy]="ep[1]" r="3" [attr.fill]="color()" class="end-dot"/>
1385
+ }
797
1386
  }
798
1387
  }
799
1388
  @if (type() === 'bar') {
800
- @for (item of barItems(); track $index) {
1389
+ @for (item of barItems(); track $index; let idx = $index) {
801
1390
  <rect
802
1391
  [attr.x]="item.x"
803
1392
  [attr.y]="item.y"
@@ -805,25 +1394,70 @@ class SparklineComponent {
805
1394
  [attr.height]="item.h"
806
1395
  [attr.fill]="color()"
807
1396
  [attr.rx]="1"
808
- opacity="0.85"
1397
+ [class.hovered]="hoveredIndex() === idx"
1398
+ [style.animation-delay]="(idx * 0.02) + 's'"
1399
+ class="sparkline-bar"
809
1400
  />
810
1401
  }
811
1402
  }
1403
+
1404
+ <!-- Interactive Tracker overlay -->
1405
+ @if (activePoint(); as ap) {
1406
+ <!-- Vertical guide line -->
1407
+ <line
1408
+ [attr.x1]="ap[0]"
1409
+ [attr.x2]="ap[0]"
1410
+ [attr.y1]="PAD"
1411
+ [attr.y2]="PAD + h()"
1412
+ stroke="rgba(100, 116, 139, 0.25)"
1413
+ stroke-width="1.2"
1414
+ stroke-dasharray="2,2"
1415
+ class="tracker-line"
1416
+ />
1417
+ <!-- Outer glowing ring -->
1418
+ <circle
1419
+ [attr.cx]="ap[0]"
1420
+ [attr.cy]="ap[1]"
1421
+ r="5"
1422
+ [attr.fill]="color()"
1423
+ fill-opacity="0.25"
1424
+ class="tracker-ring"
1425
+ />
1426
+ <!-- Inner solid dot -->
1427
+ <circle
1428
+ [attr.cx]="ap[0]"
1429
+ [attr.cy]="ap[1]"
1430
+ r="2.5"
1431
+ [attr.fill]="color()"
1432
+ stroke="#ffffff"
1433
+ stroke-width="1"
1434
+ class="tracker-dot"
1435
+ />
1436
+ }
812
1437
  </svg>
813
- `, isInline: true, styles: [":host{display:inline-block}.ngx-sparkline{display:block}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1438
+ `, isInline: true, styles: [":host{display:inline-block}.ngx-sparkline{display:block;overflow:visible;cursor:crosshair}@keyframes lineDraw{0%{stroke-dashoffset:400}to{stroke-dashoffset:0}}.sparkline-path{stroke-dasharray:400;stroke-dashoffset:400;animation:lineDraw .8s cubic-bezier(.16,1,.3,1) forwards}@keyframes areaFade{0%{opacity:0}to{opacity:1}}.sparkline-area{animation:areaFade .6s cubic-bezier(.16,1,.3,1) .2s both}.end-dot{animation:areaFade .4s ease-out .8s both}.sparkline-bar{opacity:.85;transition:opacity .2s,fill .2s;animation:areaFade .4s ease-out both}.sparkline-bar:hover,.sparkline-bar.hovered{opacity:1;filter:brightness(1.1)}.tracker-line{pointer-events:none}.tracker-ring{pointer-events:none;animation:trackerPulse 1.5s infinite alternate}.tracker-dot{pointer-events:none}@keyframes trackerPulse{0%{r:4.5px;fill-opacity:.2}to{r:6.5px;fill-opacity:.4}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
814
1439
  }
815
1440
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SparklineComponent, decorators: [{
816
1441
  type: Component,
817
- args: [{ selector: 'ngx-sparkline', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
1442
+ args: [{ selector: 'ngx-sparkline', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
818
1443
  <svg
819
1444
  [attr.width]="width()"
820
1445
  [attr.height]="height()"
821
1446
  class="ngx-sparkline"
822
1447
  [attr.aria-label]="'Sparkline'"
1448
+ (mousemove)="onMouseMove($event)"
1449
+ (mouseleave)="hoveredIndex.set(null)"
823
1450
  >
1451
+ <defs>
1452
+ <linearGradient id="sparkline-grad" x1="0%" y1="0%" x2="0%" y2="100%">
1453
+ <stop offset="0%" [attr.stop-color]="color()" stop-opacity="0.32" />
1454
+ <stop offset="100%" [attr.stop-color]="color()" stop-opacity="0" />
1455
+ </linearGradient>
1456
+ </defs>
1457
+
824
1458
  @if (type() === 'line' || type() === 'area') {
825
1459
  @if (type() === 'area') {
826
- <path [attr.d]="areaPath()" [attr.fill]="areaFill()" stroke="none"/>
1460
+ <path [attr.d]="areaPath()" fill="url(#sparkline-grad)" stroke="none" class="sparkline-area"/>
827
1461
  }
828
1462
  <path
829
1463
  [attr.d]="linePath()"
@@ -832,14 +1466,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
832
1466
  stroke-width="2"
833
1467
  stroke-linejoin="round"
834
1468
  stroke-linecap="round"
1469
+ class="sparkline-path"
835
1470
  />
836
- <!-- End dot -->
1471
+ <!-- End dot (if not hovered) -->
837
1472
  @if (endPoint(); as ep) {
838
- <circle [attr.cx]="ep[0]" [attr.cy]="ep[1]" r="3" [attr.fill]="color()"/>
1473
+ @if (hoveredIndex() === null) {
1474
+ <circle [attr.cx]="ep[0]" [attr.cy]="ep[1]" r="3" [attr.fill]="color()" class="end-dot"/>
1475
+ }
839
1476
  }
840
1477
  }
841
1478
  @if (type() === 'bar') {
842
- @for (item of barItems(); track $index) {
1479
+ @for (item of barItems(); track $index; let idx = $index) {
843
1480
  <rect
844
1481
  [attr.x]="item.x"
845
1482
  [attr.y]="item.y"
@@ -847,12 +1484,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
847
1484
  [attr.height]="item.h"
848
1485
  [attr.fill]="color()"
849
1486
  [attr.rx]="1"
850
- opacity="0.85"
1487
+ [class.hovered]="hoveredIndex() === idx"
1488
+ [style.animation-delay]="(idx * 0.02) + 's'"
1489
+ class="sparkline-bar"
851
1490
  />
852
1491
  }
853
1492
  }
1493
+
1494
+ <!-- Interactive Tracker overlay -->
1495
+ @if (activePoint(); as ap) {
1496
+ <!-- Vertical guide line -->
1497
+ <line
1498
+ [attr.x1]="ap[0]"
1499
+ [attr.x2]="ap[0]"
1500
+ [attr.y1]="PAD"
1501
+ [attr.y2]="PAD + h()"
1502
+ stroke="rgba(100, 116, 139, 0.25)"
1503
+ stroke-width="1.2"
1504
+ stroke-dasharray="2,2"
1505
+ class="tracker-line"
1506
+ />
1507
+ <!-- Outer glowing ring -->
1508
+ <circle
1509
+ [attr.cx]="ap[0]"
1510
+ [attr.cy]="ap[1]"
1511
+ r="5"
1512
+ [attr.fill]="color()"
1513
+ fill-opacity="0.25"
1514
+ class="tracker-ring"
1515
+ />
1516
+ <!-- Inner solid dot -->
1517
+ <circle
1518
+ [attr.cx]="ap[0]"
1519
+ [attr.cy]="ap[1]"
1520
+ r="2.5"
1521
+ [attr.fill]="color()"
1522
+ stroke="#ffffff"
1523
+ stroke-width="1"
1524
+ class="tracker-dot"
1525
+ />
1526
+ }
854
1527
  </svg>
855
- `, styles: [":host{display:inline-block}.ngx-sparkline{display:block}\n"] }]
1528
+ `, styles: [":host{display:inline-block}.ngx-sparkline{display:block;overflow:visible;cursor:crosshair}@keyframes lineDraw{0%{stroke-dashoffset:400}to{stroke-dashoffset:0}}.sparkline-path{stroke-dasharray:400;stroke-dashoffset:400;animation:lineDraw .8s cubic-bezier(.16,1,.3,1) forwards}@keyframes areaFade{0%{opacity:0}to{opacity:1}}.sparkline-area{animation:areaFade .6s cubic-bezier(.16,1,.3,1) .2s both}.end-dot{animation:areaFade .4s ease-out .8s both}.sparkline-bar{opacity:.85;transition:opacity .2s,fill .2s;animation:areaFade .4s ease-out both}.sparkline-bar:hover,.sparkline-bar.hovered{opacity:1;filter:brightness(1.1)}.tracker-line{pointer-events:none}.tracker-ring{pointer-events:none;animation:trackerPulse 1.5s infinite alternate}.tracker-dot{pointer-events:none}@keyframes trackerPulse{0%{r:4.5px;fill-opacity:.2}to{r:6.5px;fill-opacity:.4}}\n"] }]
856
1529
  }] });
857
1530
 
858
1531
  var GanttItemType;
@@ -3366,30 +4039,41 @@ class GaugeChartComponent {
3366
4039
  showNeedle = input(true);
3367
4040
  color = input('var(--primary-color, #4f46e5)');
3368
4041
  thresholds = input([]);
4042
+ // State Signals
4043
+ hovered = signal(false);
4044
+ tooltipX = signal(0);
4045
+ tooltipY = signal(0);
4046
+ animateState = signal(false);
4047
+ constructor() {
4048
+ setTimeout(() => this.animateState.set(true), 50);
4049
+ }
3369
4050
  // Gauge angles definitions
3370
4051
  // 0 deg in polar is to the right (3 o'clock). 90 deg is straight down (6 o'clock).
3371
- // A standard semi-circle speedometer goes from 180deg (left, 9 o'clock) to 360deg (right, 3 o'clock).
3372
- // A full dial goes from 135deg (bottom-left) to 405deg (bottom-right).
3373
4052
  startAngle = computed(() => {
3374
4053
  return this.type() === 'semi' ? 180 : 135;
3375
4054
  });
3376
4055
  endAngle = computed(() => {
3377
4056
  return this.type() === 'semi' ? 360 : 405;
3378
4057
  });
3379
- // Calculate coordinates and build path for background track
3380
- backgroundArcPath = computed(() => {
3381
- return this.describeArc(100, 100, 72, this.startAngle(), this.endAngle());
4058
+ // Arc length calculations
4059
+ arcLength = computed(() => {
4060
+ const radius = 72;
4061
+ const angleRange = this.endAngle() - this.startAngle();
4062
+ return (2 * Math.PI * radius * angleRange) / 360;
3382
4063
  });
3383
- // Calculate current value angle and build path for progress fill
3384
- progressArcPath = computed(() => {
4064
+ progressDashOffset = computed(() => {
4065
+ const L = this.arcLength();
3385
4066
  const minVal = this.min();
3386
4067
  const maxVal = this.max();
3387
4068
  const currentVal = Math.max(minVal, Math.min(maxVal, this.value()));
3388
4069
  const range = maxVal - minVal;
3389
4070
  const fraction = range === 0 ? 0 : (currentVal - minVal) / range;
3390
- const angleRange = this.endAngle() - this.startAngle();
3391
- const targetAngle = this.startAngle() + angleRange * fraction;
3392
- return this.describeArc(100, 100, 72, this.startAngle(), targetAngle);
4071
+ const targetOffset = L - (fraction * L);
4072
+ return this.animateState() ? targetOffset : L;
4073
+ });
4074
+ // Calculate coordinates and build path for background track
4075
+ backgroundArcPath = computed(() => {
4076
+ return this.describeArc(100, 100, 72, this.startAngle(), this.endAngle());
3393
4077
  });
3394
4078
  // Needle rotation calculation
3395
4079
  needleTransformString = computed(() => {
@@ -3399,7 +4083,8 @@ class GaugeChartComponent {
3399
4083
  const range = maxVal - minVal;
3400
4084
  const fraction = range === 0 ? 0 : (currentVal - minVal) / range;
3401
4085
  const angleRange = this.endAngle() - this.startAngle();
3402
- const angle = this.startAngle() + angleRange * fraction;
4086
+ const targetAngle = this.startAngle() + angleRange * fraction;
4087
+ const angle = this.animateState() ? targetAngle : this.startAngle();
3403
4088
  // Needle points straight up at -90 deg rotation, so we offset by -90
3404
4089
  const rotateAngle = angle - 270;
3405
4090
  return `rotate(${rotateAngle})`;
@@ -3422,6 +4107,12 @@ class GaugeChartComponent {
3422
4107
  // Default to the last threshold color if value exceeds all thresholds
3423
4108
  return sorted[sorted.length - 1].color;
3424
4109
  });
4110
+ onMouseMove(event) {
4111
+ const el = event.currentTarget;
4112
+ const rect = el.getBoundingClientRect();
4113
+ this.tooltipX.set(event.clientX - rect.left);
4114
+ this.tooltipY.set(event.clientY - rect.top);
4115
+ }
3425
4116
  // Polar to Cartesian Math helpers
3426
4117
  polarToCartesian(centerX, centerY, radius, angleInDegrees) {
3427
4118
  const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
@@ -3442,13 +4133,34 @@ class GaugeChartComponent {
3442
4133
  }
3443
4134
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GaugeChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3444
4135
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: GaugeChartComponent, isStandalone: true, selector: "ngx-gauge-chart", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, showNeedle: { classPropertyName: "showNeedle", publicName: "showNeedle", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, thresholds: { classPropertyName: "thresholds", publicName: "thresholds", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
3445
- <div class="ngx-gauge-wrapper">
4136
+ <div
4137
+ class="ngx-gauge-wrapper"
4138
+ (mousemove)="onMouseMove($event)"
4139
+ (mouseenter)="hovered.set(true)"
4140
+ (mouseleave)="hovered.set(false)"
4141
+ >
3446
4142
  <div class="ngx-gauge-container">
3447
4143
  <!-- SVG Gauge dial -->
3448
4144
  <svg
3449
4145
  class="ngx-gauge-svg"
3450
4146
  viewBox="0 0 200 200"
3451
4147
  >
4148
+ <defs>
4149
+ <linearGradient id="gauge-progress-grad" x1="0%" y1="100%" x2="100%" y2="0%">
4150
+ <stop offset="0%" [attr.stop-color]="gaugeColor()" stop-opacity="0.8" />
4151
+ <stop offset="100%" [attr.stop-color]="gaugeColor()" />
4152
+ </linearGradient>
4153
+ <radialGradient id="needle-pivot-grad" cx="40%" cy="40%" r="60%">
4154
+ <stop offset="0%" stop-color="#ffffff" stop-opacity="0.6" />
4155
+ <stop offset="40%" [attr.stop-color]="gaugeColor()" />
4156
+ <stop offset="100%" stop-color="#0f172a" />
4157
+ </radialGradient>
4158
+ <linearGradient id="needle-grad" x1="0%" y1="100%" x2="0%" y2="0%">
4159
+ <stop offset="0%" [attr.stop-color]="gaugeColor()" stop-opacity="0.6" />
4160
+ <stop offset="100%" [attr.stop-color]="gaugeColor()" />
4161
+ </linearGradient>
4162
+ </defs>
4163
+
3452
4164
  <!-- Background track arc -->
3453
4165
  <path
3454
4166
  [attr.d]="backgroundArcPath()"
@@ -3460,11 +4172,13 @@ class GaugeChartComponent {
3460
4172
 
3461
4173
  <!-- Colored progress arc -->
3462
4174
  <path
3463
- [attr.d]="progressArcPath()"
4175
+ [attr.d]="backgroundArcPath()"
3464
4176
  fill="none"
3465
- [attr.stroke]="gaugeColor()"
4177
+ stroke="url(#gauge-progress-grad)"
3466
4178
  stroke-width="14"
3467
4179
  stroke-linecap="round"
4180
+ [attr.stroke-dasharray]="arcLength() + ',' + arcLength()"
4181
+ [attr.stroke-dashoffset]="progressDashOffset()"
3468
4182
  class="progress-arc"
3469
4183
  />
3470
4184
 
@@ -3474,16 +4188,16 @@ class GaugeChartComponent {
3474
4188
  <!-- Needle path pointing straight up (0 deg is relative to -90 deg rotation) -->
3475
4189
  <path
3476
4190
  d="M 100 100 L 96 35 L 100 25 L 104 35 Z"
3477
- [attr.fill]="gaugeColor()"
4191
+ fill="url(#needle-grad)"
3478
4192
  class="gauge-needle"
3479
4193
  />
3480
4194
  <circle
3481
4195
  cx="100"
3482
4196
  cy="100"
3483
- r="8"
3484
- [attr.fill]="gaugeColor()"
3485
- stroke="var(--bg-secondary, #ffffff)"
3486
- stroke-width="2.5"
4197
+ r="9"
4198
+ fill="url(#needle-pivot-grad)"
4199
+ stroke="rgba(255, 255, 255, 0.2)"
4200
+ stroke-width="1"
3487
4201
  />
3488
4202
  </g>
3489
4203
  }
@@ -3497,20 +4211,66 @@ class GaugeChartComponent {
3497
4211
  }
3498
4212
  </div>
3499
4213
  </div>
4214
+
4215
+ <!-- Glassmorphic Tooltip -->
4216
+ @if (hovered()) {
4217
+ <div
4218
+ class="chart-tooltip"
4219
+ [style.left.px]="tooltipX()"
4220
+ [style.top.px]="tooltipY()"
4221
+ >
4222
+ @if (label()) {
4223
+ <div class="tt-cat">{{ label() }}</div>
4224
+ } @else {
4225
+ <div class="tt-cat">Gauge Metric</div>
4226
+ }
4227
+ <div class="tt-row">
4228
+ <span class="tt-dot" [style.background]="gaugeColor()"></span>
4229
+ <span class="tt-name">Value</span>
4230
+ <span class="tt-val">{{ value().toLocaleString() }}</span>
4231
+ </div>
4232
+ <div class="tt-row">
4233
+ <span class="tt-dot" style="background: transparent;"></span>
4234
+ <span class="tt-name">Range</span>
4235
+ <span class="tt-val">{{ min() }} - {{ max() }}</span>
4236
+ </div>
4237
+ </div>
4238
+ }
3500
4239
  </div>
3501
- `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-gauge-wrapper{width:100%;height:100%;display:flex;align-items:center;justify-content:center;padding:16px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05))}.ngx-gauge-container{position:relative;width:100%;max-width:240px;aspect-ratio:1;display:flex;align-items:center;justify-content:center}.ngx-gauge-svg{width:100%;height:100%}.progress-arc{transition:stroke-dashoffset .6s cubic-bezier(.4,0,.2,1),stroke .3s ease}.gauge-needle-group{transition:transform .6s cubic-bezier(.34,1.56,.64,1);transform-origin:100px 100px}.gauge-needle{filter:drop-shadow(0 2px 4px rgba(0,0,0,.15))}.gauge-center-badge{position:absolute;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;pointer-events:none;z-index:2}.gauge-center-badge.semi-mode{transform:translateY(18px)}.gauge-value{font-size:28px;font-weight:800;letter-spacing:-.8px;line-height:1;transition:color .3s ease;font-family:var(--ngx-heading-font-family, inherit)}.gauge-label{font-size:11px;text-transform:uppercase;font-weight:700;color:var(--text-secondary, #64748b);letter-spacing:.5px;margin-top:4px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
4240
+ `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-gauge-wrapper{width:100%;height:100%;display:flex;align-items:center;justify-content:center;padding:16px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-gauge-container{position:relative;width:100%;max-width:240px;aspect-ratio:1;display:flex;align-items:center;justify-content:center}.ngx-gauge-svg{width:100%;height:100%}.progress-arc{transition:stroke-dashoffset 1s cubic-bezier(.16,1,.3,1),stroke .3s ease}.gauge-needle-group{transition:transform 1.2s cubic-bezier(.34,1.56,.64,1);transform-origin:100px 100px}.gauge-needle{filter:drop-shadow(0 3px 6px rgba(0,0,0,.18))}.gauge-center-badge{position:absolute;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;pointer-events:none;z-index:2}.gauge-center-badge.semi-mode{transform:translateY(18px)}.gauge-value{font-size:28px;font-weight:800;letter-spacing:-.8px;line-height:1;transition:color .3s ease;font-family:var(--ngx-heading-font-family, inherit)}.gauge-label{font-size:11px;text-transform:uppercase;font-weight:700;color:var(--text-secondary, #64748b);letter-spacing:.5px;margin-top:4px}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:140px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3502
4241
  }
3503
4242
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: GaugeChartComponent, decorators: [{
3504
4243
  type: Component,
3505
- args: [{ selector: 'ngx-gauge-chart', standalone: true, imports: [CommonModule], template: `
3506
- <div class="ngx-gauge-wrapper">
4244
+ args: [{ selector: 'ngx-gauge-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
4245
+ <div
4246
+ class="ngx-gauge-wrapper"
4247
+ (mousemove)="onMouseMove($event)"
4248
+ (mouseenter)="hovered.set(true)"
4249
+ (mouseleave)="hovered.set(false)"
4250
+ >
3507
4251
  <div class="ngx-gauge-container">
3508
4252
  <!-- SVG Gauge dial -->
3509
4253
  <svg
3510
4254
  class="ngx-gauge-svg"
3511
4255
  viewBox="0 0 200 200"
3512
4256
  >
3513
- <!-- Background track arc -->
4257
+ <defs>
4258
+ <linearGradient id="gauge-progress-grad" x1="0%" y1="100%" x2="100%" y2="0%">
4259
+ <stop offset="0%" [attr.stop-color]="gaugeColor()" stop-opacity="0.8" />
4260
+ <stop offset="100%" [attr.stop-color]="gaugeColor()" />
4261
+ </linearGradient>
4262
+ <radialGradient id="needle-pivot-grad" cx="40%" cy="40%" r="60%">
4263
+ <stop offset="0%" stop-color="#ffffff" stop-opacity="0.6" />
4264
+ <stop offset="40%" [attr.stop-color]="gaugeColor()" />
4265
+ <stop offset="100%" stop-color="#0f172a" />
4266
+ </radialGradient>
4267
+ <linearGradient id="needle-grad" x1="0%" y1="100%" x2="0%" y2="0%">
4268
+ <stop offset="0%" [attr.stop-color]="gaugeColor()" stop-opacity="0.6" />
4269
+ <stop offset="100%" [attr.stop-color]="gaugeColor()" />
4270
+ </linearGradient>
4271
+ </defs>
4272
+
4273
+ <!-- Background track arc -->
3514
4274
  <path
3515
4275
  [attr.d]="backgroundArcPath()"
3516
4276
  fill="none"
@@ -3521,11 +4281,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
3521
4281
 
3522
4282
  <!-- Colored progress arc -->
3523
4283
  <path
3524
- [attr.d]="progressArcPath()"
4284
+ [attr.d]="backgroundArcPath()"
3525
4285
  fill="none"
3526
- [attr.stroke]="gaugeColor()"
4286
+ stroke="url(#gauge-progress-grad)"
3527
4287
  stroke-width="14"
3528
4288
  stroke-linecap="round"
4289
+ [attr.stroke-dasharray]="arcLength() + ',' + arcLength()"
4290
+ [attr.stroke-dashoffset]="progressDashOffset()"
3529
4291
  class="progress-arc"
3530
4292
  />
3531
4293
 
@@ -3535,16 +4297,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
3535
4297
  <!-- Needle path pointing straight up (0 deg is relative to -90 deg rotation) -->
3536
4298
  <path
3537
4299
  d="M 100 100 L 96 35 L 100 25 L 104 35 Z"
3538
- [attr.fill]="gaugeColor()"
4300
+ fill="url(#needle-grad)"
3539
4301
  class="gauge-needle"
3540
4302
  />
3541
4303
  <circle
3542
4304
  cx="100"
3543
4305
  cy="100"
3544
- r="8"
3545
- [attr.fill]="gaugeColor()"
3546
- stroke="var(--bg-secondary, #ffffff)"
3547
- stroke-width="2.5"
4306
+ r="9"
4307
+ fill="url(#needle-pivot-grad)"
4308
+ stroke="rgba(255, 255, 255, 0.2)"
4309
+ stroke-width="1"
3548
4310
  />
3549
4311
  </g>
3550
4312
  }
@@ -3558,9 +4320,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
3558
4320
  }
3559
4321
  </div>
3560
4322
  </div>
4323
+
4324
+ <!-- Glassmorphic Tooltip -->
4325
+ @if (hovered()) {
4326
+ <div
4327
+ class="chart-tooltip"
4328
+ [style.left.px]="tooltipX()"
4329
+ [style.top.px]="tooltipY()"
4330
+ >
4331
+ @if (label()) {
4332
+ <div class="tt-cat">{{ label() }}</div>
4333
+ } @else {
4334
+ <div class="tt-cat">Gauge Metric</div>
4335
+ }
4336
+ <div class="tt-row">
4337
+ <span class="tt-dot" [style.background]="gaugeColor()"></span>
4338
+ <span class="tt-name">Value</span>
4339
+ <span class="tt-val">{{ value().toLocaleString() }}</span>
4340
+ </div>
4341
+ <div class="tt-row">
4342
+ <span class="tt-dot" style="background: transparent;"></span>
4343
+ <span class="tt-name">Range</span>
4344
+ <span class="tt-val">{{ min() }} - {{ max() }}</span>
4345
+ </div>
4346
+ </div>
4347
+ }
3561
4348
  </div>
3562
- `, styles: [":host{display:block;width:100%;height:100%}.ngx-gauge-wrapper{width:100%;height:100%;display:flex;align-items:center;justify-content:center;padding:16px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05))}.ngx-gauge-container{position:relative;width:100%;max-width:240px;aspect-ratio:1;display:flex;align-items:center;justify-content:center}.ngx-gauge-svg{width:100%;height:100%}.progress-arc{transition:stroke-dashoffset .6s cubic-bezier(.4,0,.2,1),stroke .3s ease}.gauge-needle-group{transition:transform .6s cubic-bezier(.34,1.56,.64,1);transform-origin:100px 100px}.gauge-needle{filter:drop-shadow(0 2px 4px rgba(0,0,0,.15))}.gauge-center-badge{position:absolute;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;pointer-events:none;z-index:2}.gauge-center-badge.semi-mode{transform:translateY(18px)}.gauge-value{font-size:28px;font-weight:800;letter-spacing:-.8px;line-height:1;transition:color .3s ease;font-family:var(--ngx-heading-font-family, inherit)}.gauge-label{font-size:11px;text-transform:uppercase;font-weight:700;color:var(--text-secondary, #64748b);letter-spacing:.5px;margin-top:4px}\n"] }]
3563
- }] });
4349
+ `, styles: [":host{display:block;width:100%;height:100%}.ngx-gauge-wrapper{width:100%;height:100%;display:flex;align-items:center;justify-content:center;padding:16px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-gauge-container{position:relative;width:100%;max-width:240px;aspect-ratio:1;display:flex;align-items:center;justify-content:center}.ngx-gauge-svg{width:100%;height:100%}.progress-arc{transition:stroke-dashoffset 1s cubic-bezier(.16,1,.3,1),stroke .3s ease}.gauge-needle-group{transition:transform 1.2s cubic-bezier(.34,1.56,.64,1);transform-origin:100px 100px}.gauge-needle{filter:drop-shadow(0 3px 6px rgba(0,0,0,.18))}.gauge-center-badge{position:absolute;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;pointer-events:none;z-index:2}.gauge-center-badge.semi-mode{transform:translateY(18px)}.gauge-value{font-size:28px;font-weight:800;letter-spacing:-.8px;line-height:1;transition:color .3s ease;font-family:var(--ngx-heading-font-family, inherit)}.gauge-label{font-size:11px;text-transform:uppercase;font-weight:700;color:var(--text-secondary, #64748b);letter-spacing:.5px;margin-top:4px}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:140px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"] }]
4350
+ }], ctorParameters: () => [] });
3564
4351
 
3565
4352
  class RadarChartComponent {
3566
4353
  // Input binds
@@ -3577,7 +4364,8 @@ class RadarChartComponent {
3577
4364
  category: '',
3578
4365
  value: '',
3579
4366
  x: 0,
3580
- y: 0
4367
+ y: 0,
4368
+ color: ''
3581
4369
  });
3582
4370
  // Concentric circle rings count
3583
4371
  gridRings = signal([0.2, 0.4, 0.6, 0.8, 1]);
@@ -3671,13 +4459,16 @@ class RadarChartComponent {
3671
4459
  // Map coordinates relative to parent container
3672
4460
  const x = (pt.x / 220) * svgRect.width + (svgRect.left - containerRect.left);
3673
4461
  const y = (pt.y / 220) * svgRect.height + (svgRect.top - containerRect.top);
4462
+ const seriesIndex = this.seriesData().indexOf(series);
4463
+ const color = this.getSeriesColor(seriesIndex, 1);
3674
4464
  this.tooltip.set({
3675
4465
  show: true,
3676
4466
  series: series.label,
3677
4467
  category: this.categories()[index] ?? '',
3678
4468
  value: pt.value.toLocaleString(),
3679
4469
  x,
3680
- y
4470
+ y,
4471
+ color
3681
4472
  });
3682
4473
  }
3683
4474
  onPointLeave() {
@@ -3694,13 +4485,23 @@ class RadarChartComponent {
3694
4485
  class="ngx-radar-svg"
3695
4486
  viewBox="0 0 220 220"
3696
4487
  >
4488
+ <defs>
4489
+ @for (series of seriesData(); track series.label; let sIdx = $index) {
4490
+ <linearGradient [id]="'radar-grad-' + sIdx" x1="0%" y1="0%" x2="100%" y2="100%">
4491
+ <stop offset="0%" [attr.stop-color]="getSeriesColor(sIdx, 1)" stop-opacity="0.35" />
4492
+ <stop offset="100%" [attr.stop-color]="getSeriesColor(sIdx, 1)" stop-opacity="0.05" />
4493
+ </linearGradient>
4494
+ }
4495
+ </defs>
4496
+
3697
4497
  <!-- Concentric polygon grids (web rings) -->
3698
4498
  @for (ring of gridRings(); track ring) {
3699
4499
  <polygon
3700
4500
  [attr.points]="getRingPoints(ring)"
3701
4501
  fill="none"
3702
- stroke="var(--border-light, #f1f5f9)"
3703
- stroke-width="1"
4502
+ stroke="var(--border-light, rgba(226, 232, 240, 0.6))"
4503
+ stroke-width="0.8"
4504
+ stroke-dasharray="2,2"
3704
4505
  />
3705
4506
  }
3706
4507
 
@@ -3711,9 +4512,9 @@ class RadarChartComponent {
3711
4512
  [attr.y1]="110"
3712
4513
  [attr.x2]="axis.x"
3713
4514
  [attr.y2]="axis.y"
3714
- stroke="var(--border-color, #e2e8f0)"
3715
- stroke-width="1.2"
3716
- stroke-dasharray="2,2"
4515
+ stroke="var(--border-color, rgba(226, 232, 240, 0.8))"
4516
+ stroke-width="0.8"
4517
+ stroke-dasharray="3,3"
3717
4518
  />
3718
4519
  <!-- Category Label text positions -->
3719
4520
  <text
@@ -3730,7 +4531,7 @@ class RadarChartComponent {
3730
4531
  @for (series of seriesData(); track series.label; let sIdx = $index) {
3731
4532
  <polygon
3732
4533
  [attr.points]="getSeriesPoints(series)"
3733
- [attr.fill]="getSeriesColor(sIdx, 0.15)"
4534
+ [attr.fill]="'url(#radar-grad-' + sIdx + ')'"
3734
4535
  [attr.stroke]="getSeriesColor(sIdx, 1)"
3735
4536
  stroke-width="2.5"
3736
4537
  class="radar-polygon"
@@ -3744,11 +4545,12 @@ class RadarChartComponent {
3744
4545
  <circle
3745
4546
  [attr.cx]="pt.x"
3746
4547
  [attr.cy]="pt.y"
3747
- [attr.r]="hoveredPoint()?.seriesLabel === series.label && hoveredPoint()?.index === $index ? 5 : 3.5"
4548
+ [attr.r]="hoveredPoint()?.seriesLabel === series.label && hoveredPoint()?.index === $index ? 5.5 : 3.5"
3748
4549
  [attr.fill]="getSeriesColor(sIdx, 1)"
3749
4550
  stroke="#ffffff"
3750
4551
  stroke-width="1.5"
3751
4552
  class="radar-dot"
4553
+ [class.hovered]="hoveredPoint()?.seriesLabel === series.label && hoveredPoint()?.index === $index"
3752
4554
  (mouseenter)="onPointEnter(series, $index, pt, $event)"
3753
4555
  (mouseleave)="onPointLeave()"
3754
4556
  />
@@ -3763,10 +4565,11 @@ class RadarChartComponent {
3763
4565
  [style.left.px]="tooltip().x"
3764
4566
  [style.top.px]="tooltip().y"
3765
4567
  >
3766
- <div class="tooltip-series">{{ tooltip().series }}</div>
3767
- <div class="tooltip-row">
3768
- <span>{{ tooltip().category }}:</span>
3769
- <span>{{ tooltip().value }}</span>
4568
+ <div class="tt-cat">{{ tooltip().series }}</div>
4569
+ <div class="tt-row">
4570
+ <span class="tt-dot" [style.background]="tooltip().color"></span>
4571
+ <span class="tt-name">{{ tooltip().category }}</span>
4572
+ <span class="tt-val">{{ tooltip().value }}</span>
3770
4573
  </div>
3771
4574
  </div>
3772
4575
  }
@@ -3787,11 +4590,11 @@ class RadarChartComponent {
3787
4590
  }
3788
4591
  </div>
3789
4592
  </div>
3790
- `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-radar-wrapper{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:24px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05))}.ngx-radar-container{position:relative;width:100%;max-width:280px;aspect-ratio:1;display:flex;align-items:center;justify-content:center}.ngx-radar-svg{width:100%;height:100%;overflow:visible}.radar-polygon{transition:all .25s cubic-bezier(.4,0,.2,1);cursor:pointer}.radar-polygon:hover,.radar-polygon.active{fill-opacity:.3;stroke-width:3.5px}.radar-dot{cursor:pointer;transition:r .15s ease,stroke-width .15s ease}.axis-label{font-size:8px;font-weight:700;fill:var(--text-secondary, #64748b);letter-spacing:-.1px}.radar-tooltip{position:absolute;z-index:100;pointer-events:none;background:#0f172aeb;border:1px solid rgba(255,255,255,.12);border-radius:6px;padding:8px 12px;color:#fff;font-family:inherit;font-size:11px;box-shadow:0 4px 12px #0003;backdrop-filter:blur(8px);transform:translate(-50%,-115%);min-width:120px}.tooltip-series{font-weight:700;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;margin-bottom:4px;font-size:12px}.tooltip-row{display:flex;justify-content:space-between;gap:12px}.tooltip-row span:last-child{font-weight:700;color:#fbbf24}.radar-legend{display:flex;flex-wrap:wrap;justify-content:center;gap:12px}.legend-item{display:inline-flex;align-items:center;gap:6px;cursor:pointer;transition:opacity .2s}.legend-item.dimmed{opacity:.35}.legend-indicator{width:10px;height:10px;border-radius:3px}.legend-text{font-size:12px;font-weight:600;color:var(--text-primary, #0f172a)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
4593
+ `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-radar-wrapper{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:24px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-radar-container{position:relative;width:100%;max-width:280px;aspect-ratio:1;display:flex;align-items:center;justify-content:center}.ngx-radar-svg{width:100%;height:100%;overflow:visible}@keyframes radarScaleIn{0%{transform:scale(.1);opacity:0}to{transform:scale(1);opacity:1}}.radar-polygon{transition:stroke-width .25s cubic-bezier(.16,1,.3,1),fill-opacity .25s;cursor:pointer;transform-origin:110px 110px;animation:radarScaleIn .8s cubic-bezier(.16,1,.3,1) both}.radar-polygon:hover,.radar-polygon.active{stroke-width:3.5px}.radar-dot{cursor:pointer;transition:r .2s cubic-bezier(.16,1,.3,1),stroke-width .2s;transform-origin:110px 110px;animation:radarScaleIn .8s cubic-bezier(.16,1,.3,1) both}.radar-dot.hovered{filter:drop-shadow(0 0 4px rgba(0,0,0,.25));stroke-width:2px}.axis-label{font-size:8px;font-weight:700;fill:var(--text-secondary, #64748b);letter-spacing:-.1px}.radar-tooltip{position:absolute;z-index:100;pointer-events:none;background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transform:translate(-50%,-115%);min-width:140px;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}.radar-legend{display:flex;flex-wrap:wrap;justify-content:center;gap:12px}.legend-item{display:inline-flex;align-items:center;gap:6px;cursor:pointer;transition:opacity .2s}.legend-item.dimmed{opacity:.35}.legend-indicator{width:10px;height:10px;border-radius:3px}.legend-text{font-size:12px;font-weight:600;color:var(--text-primary, #0f172a)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3791
4594
  }
3792
4595
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: RadarChartComponent, decorators: [{
3793
4596
  type: Component,
3794
- args: [{ selector: 'ngx-radar-chart', standalone: true, imports: [CommonModule], template: `
4597
+ args: [{ selector: 'ngx-radar-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
3795
4598
  <div class="ngx-radar-wrapper">
3796
4599
  <!-- Radar Chart Visual Panel -->
3797
4600
  <div class="ngx-radar-container">
@@ -3799,13 +4602,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
3799
4602
  class="ngx-radar-svg"
3800
4603
  viewBox="0 0 220 220"
3801
4604
  >
4605
+ <defs>
4606
+ @for (series of seriesData(); track series.label; let sIdx = $index) {
4607
+ <linearGradient [id]="'radar-grad-' + sIdx" x1="0%" y1="0%" x2="100%" y2="100%">
4608
+ <stop offset="0%" [attr.stop-color]="getSeriesColor(sIdx, 1)" stop-opacity="0.35" />
4609
+ <stop offset="100%" [attr.stop-color]="getSeriesColor(sIdx, 1)" stop-opacity="0.05" />
4610
+ </linearGradient>
4611
+ }
4612
+ </defs>
4613
+
3802
4614
  <!-- Concentric polygon grids (web rings) -->
3803
4615
  @for (ring of gridRings(); track ring) {
3804
4616
  <polygon
3805
4617
  [attr.points]="getRingPoints(ring)"
3806
4618
  fill="none"
3807
- stroke="var(--border-light, #f1f5f9)"
3808
- stroke-width="1"
4619
+ stroke="var(--border-light, rgba(226, 232, 240, 0.6))"
4620
+ stroke-width="0.8"
4621
+ stroke-dasharray="2,2"
3809
4622
  />
3810
4623
  }
3811
4624
 
@@ -3816,9 +4629,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
3816
4629
  [attr.y1]="110"
3817
4630
  [attr.x2]="axis.x"
3818
4631
  [attr.y2]="axis.y"
3819
- stroke="var(--border-color, #e2e8f0)"
3820
- stroke-width="1.2"
3821
- stroke-dasharray="2,2"
4632
+ stroke="var(--border-color, rgba(226, 232, 240, 0.8))"
4633
+ stroke-width="0.8"
4634
+ stroke-dasharray="3,3"
3822
4635
  />
3823
4636
  <!-- Category Label text positions -->
3824
4637
  <text
@@ -3835,7 +4648,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
3835
4648
  @for (series of seriesData(); track series.label; let sIdx = $index) {
3836
4649
  <polygon
3837
4650
  [attr.points]="getSeriesPoints(series)"
3838
- [attr.fill]="getSeriesColor(sIdx, 0.15)"
4651
+ [attr.fill]="'url(#radar-grad-' + sIdx + ')'"
3839
4652
  [attr.stroke]="getSeriesColor(sIdx, 1)"
3840
4653
  stroke-width="2.5"
3841
4654
  class="radar-polygon"
@@ -3849,11 +4662,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
3849
4662
  <circle
3850
4663
  [attr.cx]="pt.x"
3851
4664
  [attr.cy]="pt.y"
3852
- [attr.r]="hoveredPoint()?.seriesLabel === series.label && hoveredPoint()?.index === $index ? 5 : 3.5"
4665
+ [attr.r]="hoveredPoint()?.seriesLabel === series.label && hoveredPoint()?.index === $index ? 5.5 : 3.5"
3853
4666
  [attr.fill]="getSeriesColor(sIdx, 1)"
3854
4667
  stroke="#ffffff"
3855
4668
  stroke-width="1.5"
3856
4669
  class="radar-dot"
4670
+ [class.hovered]="hoveredPoint()?.seriesLabel === series.label && hoveredPoint()?.index === $index"
3857
4671
  (mouseenter)="onPointEnter(series, $index, pt, $event)"
3858
4672
  (mouseleave)="onPointLeave()"
3859
4673
  />
@@ -3868,10 +4682,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
3868
4682
  [style.left.px]="tooltip().x"
3869
4683
  [style.top.px]="tooltip().y"
3870
4684
  >
3871
- <div class="tooltip-series">{{ tooltip().series }}</div>
3872
- <div class="tooltip-row">
3873
- <span>{{ tooltip().category }}:</span>
3874
- <span>{{ tooltip().value }}</span>
4685
+ <div class="tt-cat">{{ tooltip().series }}</div>
4686
+ <div class="tt-row">
4687
+ <span class="tt-dot" [style.background]="tooltip().color"></span>
4688
+ <span class="tt-name">{{ tooltip().category }}</span>
4689
+ <span class="tt-val">{{ tooltip().value }}</span>
3875
4690
  </div>
3876
4691
  </div>
3877
4692
  }
@@ -3892,7 +4707,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
3892
4707
  }
3893
4708
  </div>
3894
4709
  </div>
3895
- `, styles: [":host{display:block;width:100%;height:100%}.ngx-radar-wrapper{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:24px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05))}.ngx-radar-container{position:relative;width:100%;max-width:280px;aspect-ratio:1;display:flex;align-items:center;justify-content:center}.ngx-radar-svg{width:100%;height:100%;overflow:visible}.radar-polygon{transition:all .25s cubic-bezier(.4,0,.2,1);cursor:pointer}.radar-polygon:hover,.radar-polygon.active{fill-opacity:.3;stroke-width:3.5px}.radar-dot{cursor:pointer;transition:r .15s ease,stroke-width .15s ease}.axis-label{font-size:8px;font-weight:700;fill:var(--text-secondary, #64748b);letter-spacing:-.1px}.radar-tooltip{position:absolute;z-index:100;pointer-events:none;background:#0f172aeb;border:1px solid rgba(255,255,255,.12);border-radius:6px;padding:8px 12px;color:#fff;font-family:inherit;font-size:11px;box-shadow:0 4px 12px #0003;backdrop-filter:blur(8px);transform:translate(-50%,-115%);min-width:120px}.tooltip-series{font-weight:700;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;margin-bottom:4px;font-size:12px}.tooltip-row{display:flex;justify-content:space-between;gap:12px}.tooltip-row span:last-child{font-weight:700;color:#fbbf24}.radar-legend{display:flex;flex-wrap:wrap;justify-content:center;gap:12px}.legend-item{display:inline-flex;align-items:center;gap:6px;cursor:pointer;transition:opacity .2s}.legend-item.dimmed{opacity:.35}.legend-indicator{width:10px;height:10px;border-radius:3px}.legend-text{font-size:12px;font-weight:600;color:var(--text-primary, #0f172a)}\n"] }]
4710
+ `, styles: [":host{display:block;width:100%;height:100%}.ngx-radar-wrapper{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:24px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-radar-container{position:relative;width:100%;max-width:280px;aspect-ratio:1;display:flex;align-items:center;justify-content:center}.ngx-radar-svg{width:100%;height:100%;overflow:visible}@keyframes radarScaleIn{0%{transform:scale(.1);opacity:0}to{transform:scale(1);opacity:1}}.radar-polygon{transition:stroke-width .25s cubic-bezier(.16,1,.3,1),fill-opacity .25s;cursor:pointer;transform-origin:110px 110px;animation:radarScaleIn .8s cubic-bezier(.16,1,.3,1) both}.radar-polygon:hover,.radar-polygon.active{stroke-width:3.5px}.radar-dot{cursor:pointer;transition:r .2s cubic-bezier(.16,1,.3,1),stroke-width .2s;transform-origin:110px 110px;animation:radarScaleIn .8s cubic-bezier(.16,1,.3,1) both}.radar-dot.hovered{filter:drop-shadow(0 0 4px rgba(0,0,0,.25));stroke-width:2px}.axis-label{font-size:8px;font-weight:700;fill:var(--text-secondary, #64748b);letter-spacing:-.1px}.radar-tooltip{position:absolute;z-index:100;pointer-events:none;background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transform:translate(-50%,-115%);min-width:140px;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}.radar-legend{display:flex;flex-wrap:wrap;justify-content:center;gap:12px}.legend-item{display:inline-flex;align-items:center;gap:6px;cursor:pointer;transition:opacity .2s}.legend-item.dimmed{opacity:.35}.legend-indicator{width:10px;height:10px;border-radius:3px}.legend-text{font-size:12px;font-weight:600;color:var(--text-primary, #0f172a)}\n"] }]
3896
4711
  }] });
3897
4712
 
3898
4713
  class HeatmapChartComponent {
@@ -3910,7 +4725,8 @@ class HeatmapChartComponent {
3910
4725
  title: '',
3911
4726
  value: '',
3912
4727
  x: 0,
3913
- y: 0
4728
+ y: 0,
4729
+ rawVal: 0
3914
4730
  });
3915
4731
  cellWidth = computed(() => {
3916
4732
  const cols = this.data()[0]?.length || 1;
@@ -3972,7 +4788,8 @@ class HeatmapChartComponent {
3972
4788
  title,
3973
4789
  value: val.toLocaleString(),
3974
4790
  x,
3975
- y
4791
+ y,
4792
+ rawVal: val
3976
4793
  });
3977
4794
  }
3978
4795
  onCellLeave() {
@@ -4026,6 +4843,7 @@ class HeatmapChartComponent {
4026
4843
  [attr.height]="cellHeight() - cellSpacing"
4027
4844
  [attr.fill]="getCellColor(val)"
4028
4845
  class="heatmap-cell"
4846
+ [style.animation-delay]="(rIdx * 0.03 + cIdx * 0.03) + 's'"
4029
4847
  (mouseenter)="onCellEnter(rIdx, cIdx, val, $event)"
4030
4848
  (mouseleave)="onCellLeave()"
4031
4849
  (click)="onCellClick(rIdx, cIdx, val)"
@@ -4043,20 +4861,21 @@ class HeatmapChartComponent {
4043
4861
  [style.left.px]="tooltip().x"
4044
4862
  [style.top.px]="tooltip().y"
4045
4863
  >
4046
- <div class="tooltip-title">{{ tooltip().title }}</div>
4047
- <div class="tooltip-row">
4048
- <span>Value:</span>
4049
- <strong>{{ tooltip().value }}</strong>
4864
+ <div class="tt-cat">{{ tooltip().title }}</div>
4865
+ <div class="tt-row">
4866
+ <span class="tt-dot" [style.background]="getCellColor(tooltip().rawVal)"></span>
4867
+ <span class="tt-name">Value</span>
4868
+ <span class="tt-val">{{ tooltip().value }}</span>
4050
4869
  </div>
4051
4870
  </div>
4052
4871
  }
4053
4872
  </div>
4054
4873
  </div>
4055
- `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-heatmap-wrapper{width:100%;height:100%;padding:20px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05))}.ngx-heatmap-container{position:relative;width:100%;height:100%}.ngx-heatmap-svg{width:100%;height:100%;overflow:visible}.axis-label{font-size:10px;font-weight:700;fill:var(--text-secondary, #64748b);font-family:inherit}.heatmap-cell{cursor:pointer;transition:fill .2s ease,stroke .15s ease,filter .15s ease;stroke:transparent;stroke-width:1px}.heatmap-cell:hover{filter:brightness(1.08) drop-shadow(0 2px 4px rgba(0,0,0,.15));stroke:var(--primary-color, #4f46e5)}.heatmap-tooltip{position:absolute;z-index:100;pointer-events:none;background:#0f172af0;border:1px solid rgba(255,255,255,.12);border-radius:6px;padding:8px 12px;color:#fff;font-family:inherit;font-size:11px;box-shadow:0 4px 12px #0003;backdrop-filter:blur(8px);transform:translate(-50%,-115%);min-width:120px}.tooltip-title{font-weight:700;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;margin-bottom:4px;font-size:12px}.tooltip-row{display:flex;justify-content:space-between;gap:12px}.tooltip-row strong{color:#fbbf24}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
4874
+ `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-heatmap-wrapper{width:100%;height:100%;padding:20px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-heatmap-container{position:relative;width:100%;height:100%}.ngx-heatmap-svg{width:100%;height:100%;overflow:visible}.axis-label{font-size:10px;font-weight:700;fill:var(--text-secondary, #64748b);font-family:inherit}@keyframes cellFadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.heatmap-cell{cursor:pointer;transition:fill .2s ease,stroke .15s ease,filter .15s ease;stroke:transparent;stroke-width:1px;transform-origin:center;animation:cellFadeIn .4s ease-out both}.heatmap-cell:hover{filter:brightness(1.1) drop-shadow(0 4px 8px rgba(0,0,0,.18));stroke:var(--ngx-chart-hover-stroke, #0f172a);stroke-width:1.5px}.heatmap-tooltip{position:absolute;z-index:100;pointer-events:none;background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transform:translate(-50%,-115%);min-width:140px;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4056
4875
  }
4057
4876
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: HeatmapChartComponent, decorators: [{
4058
4877
  type: Component,
4059
- args: [{ selector: 'ngx-heatmap-chart', standalone: true, imports: [CommonModule], template: `
4878
+ args: [{ selector: 'ngx-heatmap-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
4060
4879
  <div class="ngx-heatmap-wrapper">
4061
4880
  <div class="ngx-heatmap-container">
4062
4881
  <!-- SVG Grid rendering -->
@@ -4100,6 +4919,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4100
4919
  [attr.height]="cellHeight() - cellSpacing"
4101
4920
  [attr.fill]="getCellColor(val)"
4102
4921
  class="heatmap-cell"
4922
+ [style.animation-delay]="(rIdx * 0.03 + cIdx * 0.03) + 's'"
4103
4923
  (mouseenter)="onCellEnter(rIdx, cIdx, val, $event)"
4104
4924
  (mouseleave)="onCellLeave()"
4105
4925
  (click)="onCellClick(rIdx, cIdx, val)"
@@ -4117,16 +4937,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4117
4937
  [style.left.px]="tooltip().x"
4118
4938
  [style.top.px]="tooltip().y"
4119
4939
  >
4120
- <div class="tooltip-title">{{ tooltip().title }}</div>
4121
- <div class="tooltip-row">
4122
- <span>Value:</span>
4123
- <strong>{{ tooltip().value }}</strong>
4940
+ <div class="tt-cat">{{ tooltip().title }}</div>
4941
+ <div class="tt-row">
4942
+ <span class="tt-dot" [style.background]="getCellColor(tooltip().rawVal)"></span>
4943
+ <span class="tt-name">Value</span>
4944
+ <span class="tt-val">{{ tooltip().value }}</span>
4124
4945
  </div>
4125
4946
  </div>
4126
4947
  }
4127
4948
  </div>
4128
4949
  </div>
4129
- `, styles: [":host{display:block;width:100%;height:100%}.ngx-heatmap-wrapper{width:100%;height:100%;padding:20px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05))}.ngx-heatmap-container{position:relative;width:100%;height:100%}.ngx-heatmap-svg{width:100%;height:100%;overflow:visible}.axis-label{font-size:10px;font-weight:700;fill:var(--text-secondary, #64748b);font-family:inherit}.heatmap-cell{cursor:pointer;transition:fill .2s ease,stroke .15s ease,filter .15s ease;stroke:transparent;stroke-width:1px}.heatmap-cell:hover{filter:brightness(1.08) drop-shadow(0 2px 4px rgba(0,0,0,.15));stroke:var(--primary-color, #4f46e5)}.heatmap-tooltip{position:absolute;z-index:100;pointer-events:none;background:#0f172af0;border:1px solid rgba(255,255,255,.12);border-radius:6px;padding:8px 12px;color:#fff;font-family:inherit;font-size:11px;box-shadow:0 4px 12px #0003;backdrop-filter:blur(8px);transform:translate(-50%,-115%);min-width:120px}.tooltip-title{font-weight:700;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;margin-bottom:4px;font-size:12px}.tooltip-row{display:flex;justify-content:space-between;gap:12px}.tooltip-row strong{color:#fbbf24}\n"] }]
4950
+ `, styles: [":host{display:block;width:100%;height:100%}.ngx-heatmap-wrapper{width:100%;height:100%;padding:20px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-heatmap-container{position:relative;width:100%;height:100%}.ngx-heatmap-svg{width:100%;height:100%;overflow:visible}.axis-label{font-size:10px;font-weight:700;fill:var(--text-secondary, #64748b);font-family:inherit}@keyframes cellFadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.heatmap-cell{cursor:pointer;transition:fill .2s ease,stroke .15s ease,filter .15s ease;stroke:transparent;stroke-width:1px;transform-origin:center;animation:cellFadeIn .4s ease-out both}.heatmap-cell:hover{filter:brightness(1.1) drop-shadow(0 4px 8px rgba(0,0,0,.18));stroke:var(--ngx-chart-hover-stroke, #0f172a);stroke-width:1.5px}.heatmap-tooltip{position:absolute;z-index:100;pointer-events:none;background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transform:translate(-50%,-115%);min-width:140px;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"] }]
4130
4951
  }] });
4131
4952
 
4132
4953
  class TreemapChartComponent {
@@ -4138,7 +4959,8 @@ class TreemapChartComponent {
4138
4959
  title: '',
4139
4960
  value: '',
4140
4961
  x: 0,
4141
- y: 0
4962
+ y: 0,
4963
+ color: ''
4142
4964
  });
4143
4965
  layoutRects = computed(() => {
4144
4966
  const rawData = this.data();
@@ -4215,7 +5037,8 @@ class TreemapChartComponent {
4215
5037
  title: item.label,
4216
5038
  value: item.value.toLocaleString(),
4217
5039
  x,
4218
- y
5040
+ y,
5041
+ color: item.displayColor
4219
5042
  });
4220
5043
  }
4221
5044
  onItemLeave() {
@@ -4234,9 +5057,18 @@ class TreemapChartComponent {
4234
5057
  viewBox="0 0 500 300"
4235
5058
  preserveAspectRatio="xMidYMid meet"
4236
5059
  >
5060
+ <defs>
5061
+ <linearGradient id="treemap-sheen" x1="0%" y1="0%" x2="0%" y2="100%">
5062
+ <stop offset="0%" stop-color="#ffffff" stop-opacity="0.18" />
5063
+ <stop offset="100%" stop-color="#ffffff" stop-opacity="0.0" />
5064
+ </linearGradient>
5065
+ </defs>
5066
+
4237
5067
  @for (item of layoutRects(); track item.label; let idx = $index) {
4238
5068
  <g
4239
5069
  class="treemap-group"
5070
+ [style.transform-origin]="(item.x + item.w/2) + 'px ' + (item.y + item.h/2) + 'px'"
5071
+ [style.animation-delay]="idx * 0.03 + 's'"
4240
5072
  (mouseenter)="onItemEnter(item, $event)"
4241
5073
  (mouseleave)="onItemLeave()"
4242
5074
  (click)="onItemClick(item)"
@@ -4252,6 +5084,18 @@ class TreemapChartComponent {
4252
5084
  rx="4"
4253
5085
  ry="4"
4254
5086
  />
5087
+
5088
+ <!-- Glass Sheen Overlay -->
5089
+ <rect
5090
+ [attr.x]="item.x"
5091
+ [attr.y]="item.y"
5092
+ [attr.width]="item.w"
5093
+ [attr.height]="item.h"
5094
+ fill="url(#treemap-sheen)"
5095
+ rx="4"
5096
+ ry="4"
5097
+ pointer-events="none"
5098
+ />
4255
5099
 
4256
5100
  <!-- Labels (Only show if rectangle is large enough) -->
4257
5101
  @if (item.w > 50 && item.h > 30) {
@@ -4283,20 +5127,21 @@ class TreemapChartComponent {
4283
5127
  [style.left.px]="tooltip().x"
4284
5128
  [style.top.px]="tooltip().y"
4285
5129
  >
4286
- <div class="tooltip-title">{{ tooltip().title }}</div>
4287
- <div class="tooltip-row">
4288
- <span>Value:</span>
4289
- <strong>{{ tooltip().value }}</strong>
5130
+ <div class="tt-cat">{{ tooltip().title }}</div>
5131
+ <div class="tt-row">
5132
+ <span class="tt-dot" [style.background]="tooltip().color"></span>
5133
+ <span class="tt-name">Value</span>
5134
+ <span class="tt-val">{{ tooltip().value }}</span>
4290
5135
  </div>
4291
5136
  </div>
4292
5137
  }
4293
5138
  </div>
4294
5139
  </div>
4295
- `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-treemap-wrapper{width:100%;height:100%;padding:16px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05))}.ngx-treemap-container{position:relative;width:100%;height:100%}.ngx-treemap-svg{width:100%;height:100%;display:block;overflow:visible}.treemap-group{cursor:pointer}.treemap-rect{stroke:var(--bg-secondary, #ffffff);stroke-width:1.5px;transition:fill .2s ease,stroke .15s ease,filter .15s ease}.treemap-group:hover .treemap-rect{filter:brightness(1.06) drop-shadow(0 2px 8px rgba(0,0,0,.12));stroke:var(--primary-color, #4f46e5);stroke-width:2px}.treemap-label{font-size:11px;font-weight:750;fill:#fff;font-family:inherit;pointer-events:none;text-shadow:0 1px 2px rgba(0,0,0,.3)}.treemap-value{font-size:9px;font-weight:600;fill:#fffffff2;font-family:inherit;pointer-events:none;text-shadow:0 1px 2px rgba(0,0,0,.3)}.treemap-tooltip{position:absolute;z-index:100;pointer-events:none;background:#0f172af0;border:1px solid rgba(255,255,255,.12);border-radius:6px;padding:8px 12px;color:#fff;font-family:inherit;font-size:11px;box-shadow:0 4px 12px #0003;backdrop-filter:blur(8px);transform:translate(-50%,-115%);min-width:120px}.tooltip-title{font-weight:700;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;margin-bottom:4px;font-size:12px}.tooltip-row{display:flex;justify-content:space-between;gap:12px}.tooltip-row strong{color:#fbbf24}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
5140
+ `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-treemap-wrapper{width:100%;height:100%;padding:16px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-treemap-container{position:relative;width:100%;height:100%}.ngx-treemap-svg{width:100%;height:100%;display:block;overflow:visible}@keyframes treemapScaleIn{0%{opacity:0;transform:scale(.92)}to{opacity:1;transform:scale(1)}}.treemap-group{cursor:pointer;animation:treemapScaleIn .5s cubic-bezier(.16,1,.3,1) both;transition:transform .2s cubic-bezier(.16,1,.3,1)}.treemap-group:hover{transform:scale(1.025)}.treemap-rect{stroke:var(--bg-secondary, #ffffff);stroke-width:1.5px;transition:fill .2s ease,stroke .2s ease,filter .2s ease}.treemap-group:hover .treemap-rect{filter:brightness(1.06) drop-shadow(0 4px 12px rgba(0,0,0,.22));stroke:var(--ngx-chart-hover-stroke, #0f172a);stroke-width:2px}.treemap-label{font-size:11px;font-weight:750;fill:#fff;font-family:inherit;pointer-events:none;text-shadow:0 1px 2px rgba(0,0,0,.3)}.treemap-value{font-size:9px;font-weight:600;fill:#fffffff2;font-family:inherit;pointer-events:none;text-shadow:0 1px 2px rgba(0,0,0,.3)}.treemap-tooltip{position:absolute;z-index:100;pointer-events:none;background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transform:translate(-50%,-115%);min-width:140px;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4296
5141
  }
4297
5142
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TreemapChartComponent, decorators: [{
4298
5143
  type: Component,
4299
- args: [{ selector: 'ngx-treemap-chart', standalone: true, imports: [CommonModule], template: `
5144
+ args: [{ selector: 'ngx-treemap-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
4300
5145
  <div class="ngx-treemap-wrapper">
4301
5146
  <div class="ngx-treemap-container">
4302
5147
  <!-- SVG Canvas -->
@@ -4305,9 +5150,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4305
5150
  viewBox="0 0 500 300"
4306
5151
  preserveAspectRatio="xMidYMid meet"
4307
5152
  >
5153
+ <defs>
5154
+ <linearGradient id="treemap-sheen" x1="0%" y1="0%" x2="0%" y2="100%">
5155
+ <stop offset="0%" stop-color="#ffffff" stop-opacity="0.18" />
5156
+ <stop offset="100%" stop-color="#ffffff" stop-opacity="0.0" />
5157
+ </linearGradient>
5158
+ </defs>
5159
+
4308
5160
  @for (item of layoutRects(); track item.label; let idx = $index) {
4309
5161
  <g
4310
5162
  class="treemap-group"
5163
+ [style.transform-origin]="(item.x + item.w/2) + 'px ' + (item.y + item.h/2) + 'px'"
5164
+ [style.animation-delay]="idx * 0.03 + 's'"
4311
5165
  (mouseenter)="onItemEnter(item, $event)"
4312
5166
  (mouseleave)="onItemLeave()"
4313
5167
  (click)="onItemClick(item)"
@@ -4323,6 +5177,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4323
5177
  rx="4"
4324
5178
  ry="4"
4325
5179
  />
5180
+
5181
+ <!-- Glass Sheen Overlay -->
5182
+ <rect
5183
+ [attr.x]="item.x"
5184
+ [attr.y]="item.y"
5185
+ [attr.width]="item.w"
5186
+ [attr.height]="item.h"
5187
+ fill="url(#treemap-sheen)"
5188
+ rx="4"
5189
+ ry="4"
5190
+ pointer-events="none"
5191
+ />
4326
5192
 
4327
5193
  <!-- Labels (Only show if rectangle is large enough) -->
4328
5194
  @if (item.w > 50 && item.h > 30) {
@@ -4354,16 +5220,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4354
5220
  [style.left.px]="tooltip().x"
4355
5221
  [style.top.px]="tooltip().y"
4356
5222
  >
4357
- <div class="tooltip-title">{{ tooltip().title }}</div>
4358
- <div class="tooltip-row">
4359
- <span>Value:</span>
4360
- <strong>{{ tooltip().value }}</strong>
5223
+ <div class="tt-cat">{{ tooltip().title }}</div>
5224
+ <div class="tt-row">
5225
+ <span class="tt-dot" [style.background]="tooltip().color"></span>
5226
+ <span class="tt-name">Value</span>
5227
+ <span class="tt-val">{{ tooltip().value }}</span>
4361
5228
  </div>
4362
5229
  </div>
4363
5230
  }
4364
5231
  </div>
4365
5232
  </div>
4366
- `, styles: [":host{display:block;width:100%;height:100%}.ngx-treemap-wrapper{width:100%;height:100%;padding:16px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05))}.ngx-treemap-container{position:relative;width:100%;height:100%}.ngx-treemap-svg{width:100%;height:100%;display:block;overflow:visible}.treemap-group{cursor:pointer}.treemap-rect{stroke:var(--bg-secondary, #ffffff);stroke-width:1.5px;transition:fill .2s ease,stroke .15s ease,filter .15s ease}.treemap-group:hover .treemap-rect{filter:brightness(1.06) drop-shadow(0 2px 8px rgba(0,0,0,.12));stroke:var(--primary-color, #4f46e5);stroke-width:2px}.treemap-label{font-size:11px;font-weight:750;fill:#fff;font-family:inherit;pointer-events:none;text-shadow:0 1px 2px rgba(0,0,0,.3)}.treemap-value{font-size:9px;font-weight:600;fill:#fffffff2;font-family:inherit;pointer-events:none;text-shadow:0 1px 2px rgba(0,0,0,.3)}.treemap-tooltip{position:absolute;z-index:100;pointer-events:none;background:#0f172af0;border:1px solid rgba(255,255,255,.12);border-radius:6px;padding:8px 12px;color:#fff;font-family:inherit;font-size:11px;box-shadow:0 4px 12px #0003;backdrop-filter:blur(8px);transform:translate(-50%,-115%);min-width:120px}.tooltip-title{font-weight:700;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;margin-bottom:4px;font-size:12px}.tooltip-row{display:flex;justify-content:space-between;gap:12px}.tooltip-row strong{color:#fbbf24}\n"] }]
5233
+ `, styles: [":host{display:block;width:100%;height:100%}.ngx-treemap-wrapper{width:100%;height:100%;padding:16px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-treemap-container{position:relative;width:100%;height:100%}.ngx-treemap-svg{width:100%;height:100%;display:block;overflow:visible}@keyframes treemapScaleIn{0%{opacity:0;transform:scale(.92)}to{opacity:1;transform:scale(1)}}.treemap-group{cursor:pointer;animation:treemapScaleIn .5s cubic-bezier(.16,1,.3,1) both;transition:transform .2s cubic-bezier(.16,1,.3,1)}.treemap-group:hover{transform:scale(1.025)}.treemap-rect{stroke:var(--bg-secondary, #ffffff);stroke-width:1.5px;transition:fill .2s ease,stroke .2s ease,filter .2s ease}.treemap-group:hover .treemap-rect{filter:brightness(1.06) drop-shadow(0 4px 12px rgba(0,0,0,.22));stroke:var(--ngx-chart-hover-stroke, #0f172a);stroke-width:2px}.treemap-label{font-size:11px;font-weight:750;fill:#fff;font-family:inherit;pointer-events:none;text-shadow:0 1px 2px rgba(0,0,0,.3)}.treemap-value{font-size:9px;font-weight:600;fill:#fffffff2;font-family:inherit;pointer-events:none;text-shadow:0 1px 2px rgba(0,0,0,.3)}.treemap-tooltip{position:absolute;z-index:100;pointer-events:none;background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transform:translate(-50%,-115%);min-width:140px;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"] }]
4367
5234
  }] });
4368
5235
 
4369
5236
  class AreaChartComponent {
@@ -4379,9 +5246,29 @@ class AreaChartComponent {
4379
5246
  showLegend = input(true);
4380
5247
  colors = input(CHART_COLORS);
4381
5248
  crosshair = signal(null);
5249
+ activeCategoryIndex = signal(null);
4382
5250
  tooltip = signal(null);
4383
- innerW = computed(() => 600 - this.PAD_LEFT - this.PAD_RIGHT);
5251
+ containerWidth = signal(600);
5252
+ innerW = computed(() => this.containerWidth() - this.PAD_LEFT - this.PAD_RIGHT);
4384
5253
  innerH = computed(() => this.height() - this.PAD_TOP - this.PAD_BOTTOM);
5254
+ animateState = signal(false);
5255
+ constructor() {
5256
+ const hostEl = inject(ElementRef).nativeElement;
5257
+ if (typeof ResizeObserver !== 'undefined') {
5258
+ const resizeObserver = new ResizeObserver(entries => {
5259
+ if (!entries || entries.length === 0)
5260
+ return;
5261
+ const width = entries[0].contentRect.width;
5262
+ if (width > 0) {
5263
+ // Subtract padding of .ngx-area-chart (20px on each side = 40px)
5264
+ this.containerWidth.set(width - 40);
5265
+ }
5266
+ });
5267
+ resizeObserver.observe(hostEl);
5268
+ inject(DestroyRef).onDestroy(() => resizeObserver.disconnect());
5269
+ }
5270
+ setTimeout(() => this.animateState.set(true), 50);
5271
+ }
4385
5272
  allValues = computed(() => this.series().flatMap(s => s.data));
4386
5273
  yMin = computed(() => Math.min(0, ...this.allValues()));
4387
5274
  yMax = computed(() => Math.max(1, ...this.allValues()));
@@ -4415,6 +5302,7 @@ class AreaChartComponent {
4415
5302
  const idx = Math.round(scale(mx, 0, this.innerW(), 0, cats.length - 1));
4416
5303
  const ci = Math.max(0, Math.min(cats.length - 1, idx));
4417
5304
  this.crosshair.set({ x: this.xPos(ci) });
5305
+ this.activeCategoryIndex.set(ci);
4418
5306
  const rows = this.series().map((s, si) => ({
4419
5307
  name: s.name,
4420
5308
  value: s.data[ci] ?? 0,
@@ -4427,10 +5315,15 @@ class AreaChartComponent {
4427
5315
  rows,
4428
5316
  });
4429
5317
  }
5318
+ onMouseLeave() {
5319
+ this.crosshair.set(null);
5320
+ this.activeCategoryIndex.set(null);
5321
+ this.tooltip.set(null);
5322
+ }
4430
5323
  fmtNum = fmtNum;
4431
5324
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AreaChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4432
5325
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AreaChartComponent, isStandalone: true, selector: "ngx-area-chart", inputs: { series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, categories: { classPropertyName: "categories", publicName: "categories", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showGrid: { classPropertyName: "showGrid", publicName: "showGrid", isSignal: true, isRequired: false, transformFunction: null }, showMarkers: { classPropertyName: "showMarkers", publicName: "showMarkers", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
4433
- <div class="ngx-area-chart" (mousemove)="onMouseMove($event)" (mouseleave)="crosshair.set(null)">
5326
+ <div class="ngx-area-chart" (mousemove)="onMouseMove($event)" (mouseleave)="onMouseLeave()">
4434
5327
  @if (showLegend()) {
4435
5328
  <div class="chart-legend">
4436
5329
  @for (s of series(); track s.name; let i = $index) {
@@ -4476,6 +5369,7 @@ class AreaChartComponent {
4476
5369
  [attr.d]="areaPath(s)"
4477
5370
  [attr.fill]="'url(#area-gradient-' + si + ')'"
4478
5371
  stroke="none"
5372
+ class="area-path"
4479
5373
  />
4480
5374
 
4481
5375
  <!-- Border Line -->
@@ -4486,18 +5380,20 @@ class AreaChartComponent {
4486
5380
  stroke-width="3"
4487
5381
  stroke-linejoin="round"
4488
5382
  stroke-linecap="round"
5383
+ class="line-path"
4489
5384
  />
4490
5385
 
4491
5386
  <!-- Hover Markers -->
4492
- @if (showMarkers()) {
5387
+ @if (showMarkers() && animateState()) {
4493
5388
  @for (v of s.data; track $index; let ci = $index) {
4494
5389
  <circle
4495
5390
  [attr.cx]="xPos(ci)"
4496
5391
  [attr.cy]="yPos(v)"
4497
- r="4"
5392
+ [attr.r]="activeCategoryIndex() === ci ? 6 : 4"
4498
5393
  [attr.fill]="seriesColor(si, s)"
4499
- stroke="#ffffff"
4500
- stroke-width="2"
5394
+ [attr.stroke]="activeCategoryIndex() === ci ? '#fff' : '#fff'"
5395
+ [attr.stroke-width]="activeCategoryIndex() === ci ? 2.5 : 2"
5396
+ [attr.filter]="activeCategoryIndex() === ci ? 'drop-shadow(0 2px 4px rgba(0,0,0,0.25))' : null"
4501
5397
  class="marker-dot"
4502
5398
  />
4503
5399
  }
@@ -4515,28 +5411,28 @@ class AreaChartComponent {
4515
5411
  <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #cbd5e1)"/>
4516
5412
  </g>
4517
5413
  </svg>
4518
-
4519
- <!-- Hover Tooltip -->
4520
- @if (tooltip(); as t) {
4521
- <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
4522
- <div class="tt-cat">{{ t.cat }}</div>
4523
- @for (row of t.rows; track row.name) {
4524
- <div class="tt-row">
4525
- <span class="tt-dot" [style.background]="row.color"></span>
4526
- <span class="tt-name">{{ row.name }}</span>
4527
- <strong class="tt-val">{{ fmtNum(row.value) }}</strong>
4528
- </div>
4529
- }
4530
- </div>
4531
- }
4532
5414
  </div>
5415
+
5416
+ <!-- Hover Tooltip -->
5417
+ @if (tooltip(); as t) {
5418
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
5419
+ <div class="tt-cat">{{ t.cat }}</div>
5420
+ @for (row of t.rows; track row.name) {
5421
+ <div class="tt-row">
5422
+ <span class="tt-dot" [style.background]="row.color"></span>
5423
+ <span class="tt-name">{{ row.name }}</span>
5424
+ <strong class="tt-val">{{ fmtNum(row.value) }}</strong>
5425
+ </div>
5426
+ }
5427
+ </div>
5428
+ }
4533
5429
  </div>
4534
- `, isInline: true, styles: [":host{display:block}.ngx-area-chart{position:relative;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;padding:20px}.chart-legend{display:flex;gap:16px;padding:0 0 12px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-secondary, #64748b);font-weight:500}.legend-dot{width:12px;height:4px;border-radius:2px;display:inline-block}.chart-svg-wrap{position:relative;width:100%}.chart-svg{display:block;overflow:visible;cursor:crosshair}.axis-label{font-size:10px;font-weight:600;fill:var(--text-secondary, #94a3b8)}.marker-dot{transition:r .1s ease}.marker-dot:hover{r:6px}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, #0f172a);color:#fff;padding:8px 12px;border-radius:8px;font-size:12px;white-space:nowrap;box-shadow:0 4px 16px #00000026;z-index:10}.tt-cat{font-weight:700;margin-bottom:4px;color:#fff}.tt-row{display:flex;align-items:center;gap:8px;margin-top:2px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{font-size:11px;color:#cbd5e1}.tt-val{margin-left:auto;font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5430
+ `, isInline: true, styles: [":host{display:block}.ngx-area-chart{position:relative;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;padding:20px}.chart-legend{display:flex;gap:16px;padding:0 0 12px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-secondary, #64748b);font-weight:500}.legend-dot{width:12px;height:4px;border-radius:2px;display:inline-block}.chart-svg-wrap{position:relative;width:100%}.chart-svg{display:block;overflow:visible;cursor:crosshair}.axis-label{font-size:10px;font-weight:600;fill:var(--text-secondary, #94a3b8)}@keyframes lineDraw{0%{stroke-dashoffset:1200}to{stroke-dashoffset:0}}.line-path{stroke-dasharray:1200;stroke-dashoffset:1200;animation:lineDraw 1.2s cubic-bezier(.16,1,.3,1) forwards}@keyframes areaFadeIn{0%{opacity:0}to{opacity:1}}.area-path{animation:areaFadeIn 1s cubic-bezier(.16,1,.3,1) .3s both}.marker-dot{animation:areaFadeIn .5s ease .8s both;transition:r .15s cubic-bezier(.16,1,.3,1),stroke-width .15s}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .12s cubic-bezier(.16,1,.3,1),top .12s cubic-bezier(.16,1,.3,1);font-family:inherit}.tt-cat{font-weight:700;margin-bottom:8px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:6px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:5px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4535
5431
  }
4536
5432
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AreaChartComponent, decorators: [{
4537
5433
  type: Component,
4538
5434
  args: [{ selector: 'ngx-area-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
4539
- <div class="ngx-area-chart" (mousemove)="onMouseMove($event)" (mouseleave)="crosshair.set(null)">
5435
+ <div class="ngx-area-chart" (mousemove)="onMouseMove($event)" (mouseleave)="onMouseLeave()">
4540
5436
  @if (showLegend()) {
4541
5437
  <div class="chart-legend">
4542
5438
  @for (s of series(); track s.name; let i = $index) {
@@ -4582,6 +5478,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4582
5478
  [attr.d]="areaPath(s)"
4583
5479
  [attr.fill]="'url(#area-gradient-' + si + ')'"
4584
5480
  stroke="none"
5481
+ class="area-path"
4585
5482
  />
4586
5483
 
4587
5484
  <!-- Border Line -->
@@ -4592,18 +5489,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4592
5489
  stroke-width="3"
4593
5490
  stroke-linejoin="round"
4594
5491
  stroke-linecap="round"
5492
+ class="line-path"
4595
5493
  />
4596
5494
 
4597
5495
  <!-- Hover Markers -->
4598
- @if (showMarkers()) {
5496
+ @if (showMarkers() && animateState()) {
4599
5497
  @for (v of s.data; track $index; let ci = $index) {
4600
5498
  <circle
4601
5499
  [attr.cx]="xPos(ci)"
4602
5500
  [attr.cy]="yPos(v)"
4603
- r="4"
5501
+ [attr.r]="activeCategoryIndex() === ci ? 6 : 4"
4604
5502
  [attr.fill]="seriesColor(si, s)"
4605
- stroke="#ffffff"
4606
- stroke-width="2"
5503
+ [attr.stroke]="activeCategoryIndex() === ci ? '#fff' : '#fff'"
5504
+ [attr.stroke-width]="activeCategoryIndex() === ci ? 2.5 : 2"
5505
+ [attr.filter]="activeCategoryIndex() === ci ? 'drop-shadow(0 2px 4px rgba(0,0,0,0.25))' : null"
4607
5506
  class="marker-dot"
4608
5507
  />
4609
5508
  }
@@ -4621,77 +5520,100 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4621
5520
  <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #cbd5e1)"/>
4622
5521
  </g>
4623
5522
  </svg>
4624
-
4625
- <!-- Hover Tooltip -->
4626
- @if (tooltip(); as t) {
4627
- <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
4628
- <div class="tt-cat">{{ t.cat }}</div>
4629
- @for (row of t.rows; track row.name) {
4630
- <div class="tt-row">
4631
- <span class="tt-dot" [style.background]="row.color"></span>
4632
- <span class="tt-name">{{ row.name }}</span>
4633
- <strong class="tt-val">{{ fmtNum(row.value) }}</strong>
4634
- </div>
4635
- }
4636
- </div>
4637
- }
4638
5523
  </div>
5524
+
5525
+ <!-- Hover Tooltip -->
5526
+ @if (tooltip(); as t) {
5527
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
5528
+ <div class="tt-cat">{{ t.cat }}</div>
5529
+ @for (row of t.rows; track row.name) {
5530
+ <div class="tt-row">
5531
+ <span class="tt-dot" [style.background]="row.color"></span>
5532
+ <span class="tt-name">{{ row.name }}</span>
5533
+ <strong class="tt-val">{{ fmtNum(row.value) }}</strong>
5534
+ </div>
5535
+ }
5536
+ </div>
5537
+ }
4639
5538
  </div>
4640
- `, styles: [":host{display:block}.ngx-area-chart{position:relative;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;padding:20px}.chart-legend{display:flex;gap:16px;padding:0 0 12px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-secondary, #64748b);font-weight:500}.legend-dot{width:12px;height:4px;border-radius:2px;display:inline-block}.chart-svg-wrap{position:relative;width:100%}.chart-svg{display:block;overflow:visible;cursor:crosshair}.axis-label{font-size:10px;font-weight:600;fill:var(--text-secondary, #94a3b8)}.marker-dot{transition:r .1s ease}.marker-dot:hover{r:6px}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, #0f172a);color:#fff;padding:8px 12px;border-radius:8px;font-size:12px;white-space:nowrap;box-shadow:0 4px 16px #00000026;z-index:10}.tt-cat{font-weight:700;margin-bottom:4px;color:#fff}.tt-row{display:flex;align-items:center;gap:8px;margin-top:2px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{font-size:11px;color:#cbd5e1}.tt-val{margin-left:auto;font-weight:700}\n"] }]
4641
- }] });
5539
+ `, styles: [":host{display:block}.ngx-area-chart{position:relative;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;padding:20px}.chart-legend{display:flex;gap:16px;padding:0 0 12px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-secondary, #64748b);font-weight:500}.legend-dot{width:12px;height:4px;border-radius:2px;display:inline-block}.chart-svg-wrap{position:relative;width:100%}.chart-svg{display:block;overflow:visible;cursor:crosshair}.axis-label{font-size:10px;font-weight:600;fill:var(--text-secondary, #94a3b8)}@keyframes lineDraw{0%{stroke-dashoffset:1200}to{stroke-dashoffset:0}}.line-path{stroke-dasharray:1200;stroke-dashoffset:1200;animation:lineDraw 1.2s cubic-bezier(.16,1,.3,1) forwards}@keyframes areaFadeIn{0%{opacity:0}to{opacity:1}}.area-path{animation:areaFadeIn 1s cubic-bezier(.16,1,.3,1) .3s both}.marker-dot{animation:areaFadeIn .5s ease .8s both;transition:r .15s cubic-bezier(.16,1,.3,1),stroke-width .15s}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .12s cubic-bezier(.16,1,.3,1),top .12s cubic-bezier(.16,1,.3,1);font-family:inherit}.tt-cat{font-weight:700;margin-bottom:8px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:6px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:5px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"] }]
5540
+ }], ctorParameters: () => [] });
4642
5541
 
4643
5542
  class FunnelChartComponent {
4644
5543
  data = input([]);
4645
5544
  height = input(300);
4646
5545
  colors = input(CHART_COLORS);
5546
+ mode = input('funnel');
4647
5547
  hoveredIndex = signal(null);
4648
5548
  tooltipX = signal(0);
4649
5549
  tooltipY = signal(0);
4650
- // Computes the SVG polygon coordinates for the funnel steps
5550
+ totalValue = computed(() => {
5551
+ return this.data().reduce((sum, item) => sum + item.value, 0) || 1;
5552
+ });
5553
+ // Computes the SVG polygon coordinates for the funnel / pyramid steps
4651
5554
  funnelStages = computed(() => {
4652
5555
  const items = this.data();
4653
5556
  if (items.length === 0)
4654
5557
  return [];
4655
- // Sort items descending so that the funnel goes from largest to smallest,
4656
- // or keep user's ordered sequence (normally ordered sequence is preferred for funnel steps)
4657
- const sorted = [...items];
4658
- const maxVal = sorted[0]?.value || 1;
4659
- const count = sorted.length;
5558
+ const count = items.length;
4660
5559
  const svgW = 400;
4661
5560
  const svgH = 300;
4662
5561
  const maxFunnelW = 320;
4663
- const stepH = svgH / count;
4664
- return sorted.map((item, idx) => {
4665
- // Calculate top and bottom widths based on value ratio to maxVal
4666
- const topPct = item.value / maxVal;
4667
- // Bottom percentage matches the next stage's top percentage,
4668
- // or for the last stage, is scaled down to 40% of its top percentage.
4669
- const botPct = idx < count - 1 ? sorted[idx + 1].value / maxVal : topPct * 0.4;
4670
- const topW = topPct * maxFunnelW;
4671
- const botW = botPct * maxFunnelW;
4672
- // Calculate Y coords
4673
- const yTop = idx * stepH;
4674
- const yBot = (idx + 1) * stepH;
4675
- // Calculate X coords
4676
- const xTopLeft = (svgW - topW) / 2;
4677
- const xTopRight = (svgW + topW) / 2;
4678
- const xBotLeft = (svgW - botW) / 2;
4679
- const xBotRight = (svgW + botW) / 2;
4680
- // Construct SVG points string: "x1,y1 x2,y2 x3,y3 x4,y4"
4681
- const points = `${xTopLeft},${yTop} ${xTopRight},${yTop} ${xBotRight},${yBot} ${xBotLeft},${yBot}`;
4682
- const color = item.color || this.colors()[idx % this.colors().length];
4683
- return {
4684
- name: item.name,
4685
- value: item.value,
4686
- points,
4687
- color,
4688
- yCenter: (yTop + yBot) / 2
4689
- };
4690
- });
5562
+ if (this.mode() === 'pyramid') {
5563
+ // Pyramid Mode: Stacks vertically to form a triangle pointing up.
5564
+ const totalVal = this.totalValue();
5565
+ let currentY = 0;
5566
+ return items.map((item, idx) => {
5567
+ const h = (item.value / totalVal) * svgH;
5568
+ const yTop = currentY;
5569
+ const yBot = currentY + h;
5570
+ const wTop = (yTop / svgH) * maxFunnelW;
5571
+ const wBot = (yBot / svgH) * maxFunnelW;
5572
+ const xTopLeft = (svgW - wTop) / 2;
5573
+ const xTopRight = (svgW + wTop) / 2;
5574
+ const xBotLeft = (svgW - wBot) / 2;
5575
+ const xBotRight = (svgW + wBot) / 2;
5576
+ const points = `${xTopLeft},${yTop} ${xTopRight},${yTop} ${xBotRight},${yBot} ${xBotLeft},${yBot}`;
5577
+ const color = item.color || this.colors()[idx % this.colors().length];
5578
+ currentY += h;
5579
+ return {
5580
+ name: item.name,
5581
+ value: item.value,
5582
+ points,
5583
+ color,
5584
+ yCenter: (yTop + yBot) / 2
5585
+ };
5586
+ });
5587
+ }
5588
+ else {
5589
+ // Standard Funnel Mode
5590
+ const maxVal = items[0]?.value || 1;
5591
+ const stepH = svgH / count;
5592
+ return items.map((item, idx) => {
5593
+ const topPct = item.value / maxVal;
5594
+ const botPct = idx < count - 1 ? items[idx + 1].value / maxVal : topPct * 0.4;
5595
+ const topW = topPct * maxFunnelW;
5596
+ const botW = botPct * maxFunnelW;
5597
+ const yTop = idx * stepH;
5598
+ const yBot = (idx + 1) * stepH;
5599
+ const xTopLeft = (svgW - topW) / 2;
5600
+ const xTopRight = (svgW + topW) / 2;
5601
+ const xBotLeft = (svgW - botW) / 2;
5602
+ const xBotRight = (svgW + botW) / 2;
5603
+ const points = `${xTopLeft},${yTop} ${xTopRight},${yTop} ${xBotRight},${yBot} ${xBotLeft},${yBot}`;
5604
+ const color = item.color || this.colors()[idx % this.colors().length];
5605
+ return {
5606
+ name: item.name,
5607
+ value: item.value,
5608
+ points,
5609
+ color,
5610
+ yCenter: (yTop + yBot) / 2
5611
+ };
5612
+ });
5613
+ }
4691
5614
  });
4692
5615
  onMouseMove(event, index) {
4693
5616
  const el = event.currentTarget;
4694
- const rect = el.getBoundingClientRect();
4695
5617
  const parentRect = el.parentElement?.parentElement?.getBoundingClientRect();
4696
5618
  if (parentRect) {
4697
5619
  this.tooltipX.set(event.clientX - parentRect.left);
@@ -4700,18 +5622,28 @@ class FunnelChartComponent {
4700
5622
  }
4701
5623
  fmtNum = fmtNum;
4702
5624
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FunnelChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4703
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: FunnelChartComponent, isStandalone: true, selector: "ngx-funnel-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
5625
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: FunnelChartComponent, isStandalone: true, selector: "ngx-funnel-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
4704
5626
  <div class="ngx-funnel-chart">
4705
5627
  <div class="funnel-layout">
4706
- <!-- SVG Visual Funnel -->
5628
+ <!-- SVG Visual Funnel / Pyramid -->
4707
5629
  <div class="funnel-graphic" (mouseleave)="hoveredIndex.set(null)">
4708
5630
  <svg [attr.width]="'100%'" [attr.height]="height()" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid meet" class="funnel-svg">
5631
+ <defs>
5632
+ @for (stage of funnelStages(); track stage.name; let i = $index) {
5633
+ <linearGradient [id]="'funnel-grad-' + i" x1="0%" y1="0%" x2="100%" y2="0%">
5634
+ <stop offset="0%" [attr.stop-color]="stage.color" />
5635
+ <stop offset="100%" [attr.stop-color]="stage.color" stop-opacity="0.65" />
5636
+ </linearGradient>
5637
+ }
5638
+ </defs>
4709
5639
  <g>
4710
5640
  @for (stage of funnelStages(); track stage.name; let i = $index) {
4711
5641
  <polygon
4712
5642
  [attr.points]="stage.points"
4713
- [attr.fill]="stage.color"
5643
+ [attr.fill]="'url(#funnel-grad-' + i + ')'"
4714
5644
  [class.active]="hoveredIndex() === i"
5645
+ [style.transform-origin]="'200px ' + stage.yCenter + 'px'"
5646
+ [style.animation-delay]="i * 0.06 + 's'"
4715
5647
  (mouseenter)="hoveredIndex.set(i)"
4716
5648
  (mousemove)="onMouseMove($event, i)"
4717
5649
  class="funnel-polygon"
@@ -4724,12 +5656,18 @@ class FunnelChartComponent {
4724
5656
  @if (hoveredIndex() !== null) {
4725
5657
  @if (funnelStages()[hoveredIndex()!]; as stage) {
4726
5658
  <div class="chart-tooltip" [style.left.px]="tooltipX()" [style.top.px]="tooltipY()">
4727
- <div class="tt-name">{{ stage.name }}</div>
5659
+ <div class="tt-cat">{{ stage.name }}</div>
4728
5660
  <div class="tt-row">
4729
- Value: <strong>{{ fmtNum(stage.value) }}</strong>
5661
+ <span class="tt-dot" [style.background]="stage.color"></span>
5662
+ <span class="tt-name">Value</span>
5663
+ <span class="tt-val">{{ fmtNum(stage.value) }}</span>
4730
5664
  </div>
4731
5665
  <div class="tt-row">
4732
- Conversion: <strong>{{ (stage.value / funnelStages()[0].value) | percent:'1.0-1' }}</strong>
5666
+ <span class="tt-dot" style="background: transparent;"></span>
5667
+ <span class="tt-name">{{ mode() === 'funnel' ? 'Conversion' : 'Share' }}</span>
5668
+ <span class="tt-val">
5669
+ {{ (mode() === 'funnel' ? (stage.value / funnelStages()[0].value) : (stage.value / totalValue())) | percent:'1.0-1' }}
5670
+ </span>
4733
5671
  </div>
4734
5672
  </div>
4735
5673
  }
@@ -4751,7 +5689,7 @@ class FunnelChartComponent {
4751
5689
  <div class="legend-metrics">
4752
5690
  <span class="metric-value">{{ fmtNum(stage.value) }}</span>
4753
5691
  <span class="metric-pct">
4754
- {{ (stage.value / funnelStages()[0].value) | percent:'1.0-1' }}
5692
+ {{ (mode() === 'funnel' ? (stage.value / funnelStages()[0].value) : (stage.value / totalValue())) | percent:'1.0-1' }}
4755
5693
  </span>
4756
5694
  </div>
4757
5695
  </div>
@@ -4760,22 +5698,32 @@ class FunnelChartComponent {
4760
5698
  </div>
4761
5699
  </div>
4762
5700
  </div>
4763
- `, isInline: true, styles: [":host{display:block}.ngx-funnel-chart{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;padding:20px}.funnel-layout{display:grid;grid-template-columns:1.2fr 1fr;gap:24px;align-items:center}@media (max-width: 600px){.funnel-layout{grid-template-columns:1fr}}.funnel-graphic{position:relative;width:100%}.funnel-svg{display:block;overflow:visible}.funnel-polygon{cursor:pointer;opacity:.85;transition:opacity .2s,transform .2s,filter .2s;filter:drop-shadow(0 2px 4px rgba(0,0,0,.06))}.funnel-polygon:hover,.funnel-polygon.active{opacity:1;filter:drop-shadow(0 4px 12px rgba(0,0,0,.12)) brightness(1.05)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, #0f172a);color:#fff;padding:8px 12px;border-radius:8px;font-size:12px;white-space:nowrap;box-shadow:0 4px 16px #00000026;z-index:10}.tt-name{font-weight:700;margin-bottom:4px}.tt-row{font-size:11px;opacity:.9}.funnel-legend{display:flex;flex-direction:column;gap:8px}.legend-item{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:8px;border:1px solid transparent;transition:all .2s;cursor:pointer}.legend-item:hover,.legend-item.active{background:var(--bg-primary, #f8fafc);border-color:var(--border-color, #e2e8f0)}.legend-color-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0}.legend-content{flex:1;display:flex;justify-content:space-between;align-items:center;gap:16px}.legend-title{font-size:13px;font-weight:600;color:var(--text-primary, #0f172a)}.legend-metrics{display:flex;align-items:center;gap:10px}.metric-value{font-size:13px;font-weight:700;color:var(--text-primary, #0f172a)}.metric-pct{font-size:11px;color:var(--text-secondary, #64748b);background:var(--border-light, #f1f5f9);padding:2px 6px;border-radius:4px;font-weight:600}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.PercentPipe, name: "percent" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5701
+ `, isInline: true, styles: [":host{display:block}.ngx-funnel-chart{background:var(--ngx-chart-bg, #ffffff);border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:16px;padding:20px;position:relative}.funnel-layout{display:grid;grid-template-columns:1.2fr 1fr;gap:24px;align-items:center}@media (max-width: 600px){.funnel-layout{grid-template-columns:1fr}}.funnel-graphic{position:relative;width:100%}.funnel-svg{display:block;overflow:visible}@keyframes funnelBuildIn{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}.funnel-polygon{cursor:pointer;opacity:.88;transition:opacity .25s,transform .25s cubic-bezier(.16,1,.3,1),filter .25s;animation:funnelBuildIn .7s cubic-bezier(.16,1,.3,1) both}.funnel-polygon:hover,.funnel-polygon.active{opacity:1;transform:scale(1.03);filter:drop-shadow(0 8px 16px rgba(0,0,0,.18)) brightness(1.03)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:155px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}.funnel-legend{display:flex;flex-direction:column;gap:8px}.legend-item{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:8px;border:1px solid transparent;transition:all .2s;cursor:pointer}.legend-item:hover,.legend-item.active{background:var(--ngx-chart-grid, #f8fafc);border-color:var(--ngx-chart-grid, #e2e8f0)}.legend-color-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0}.legend-content{flex:1;display:flex;justify-content:space-between;align-items:center;gap:16px}.legend-title{font-size:13px;font-weight:600;color:var(--ngx-chart-text, #0f172a)}.legend-metrics{display:flex;align-items:center;gap:10px}.metric-value{font-size:13px;font-weight:700;color:var(--ngx-chart-text, #0f172a)}.metric-pct{font-size:11px;color:var(--ngx-chart-axis-text, #64748b);background:var(--ngx-chart-grid, #f1f5f9);padding:2px 6px;border-radius:4px;font-weight:600}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.PercentPipe, name: "percent" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4764
5702
  }
4765
5703
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FunnelChartComponent, decorators: [{
4766
5704
  type: Component,
4767
5705
  args: [{ selector: 'ngx-funnel-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
4768
5706
  <div class="ngx-funnel-chart">
4769
5707
  <div class="funnel-layout">
4770
- <!-- SVG Visual Funnel -->
5708
+ <!-- SVG Visual Funnel / Pyramid -->
4771
5709
  <div class="funnel-graphic" (mouseleave)="hoveredIndex.set(null)">
4772
5710
  <svg [attr.width]="'100%'" [attr.height]="height()" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid meet" class="funnel-svg">
5711
+ <defs>
5712
+ @for (stage of funnelStages(); track stage.name; let i = $index) {
5713
+ <linearGradient [id]="'funnel-grad-' + i" x1="0%" y1="0%" x2="100%" y2="0%">
5714
+ <stop offset="0%" [attr.stop-color]="stage.color" />
5715
+ <stop offset="100%" [attr.stop-color]="stage.color" stop-opacity="0.65" />
5716
+ </linearGradient>
5717
+ }
5718
+ </defs>
4773
5719
  <g>
4774
5720
  @for (stage of funnelStages(); track stage.name; let i = $index) {
4775
5721
  <polygon
4776
5722
  [attr.points]="stage.points"
4777
- [attr.fill]="stage.color"
5723
+ [attr.fill]="'url(#funnel-grad-' + i + ')'"
4778
5724
  [class.active]="hoveredIndex() === i"
5725
+ [style.transform-origin]="'200px ' + stage.yCenter + 'px'"
5726
+ [style.animation-delay]="i * 0.06 + 's'"
4779
5727
  (mouseenter)="hoveredIndex.set(i)"
4780
5728
  (mousemove)="onMouseMove($event, i)"
4781
5729
  class="funnel-polygon"
@@ -4788,12 +5736,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4788
5736
  @if (hoveredIndex() !== null) {
4789
5737
  @if (funnelStages()[hoveredIndex()!]; as stage) {
4790
5738
  <div class="chart-tooltip" [style.left.px]="tooltipX()" [style.top.px]="tooltipY()">
4791
- <div class="tt-name">{{ stage.name }}</div>
5739
+ <div class="tt-cat">{{ stage.name }}</div>
4792
5740
  <div class="tt-row">
4793
- Value: <strong>{{ fmtNum(stage.value) }}</strong>
5741
+ <span class="tt-dot" [style.background]="stage.color"></span>
5742
+ <span class="tt-name">Value</span>
5743
+ <span class="tt-val">{{ fmtNum(stage.value) }}</span>
4794
5744
  </div>
4795
5745
  <div class="tt-row">
4796
- Conversion: <strong>{{ (stage.value / funnelStages()[0].value) | percent:'1.0-1' }}</strong>
5746
+ <span class="tt-dot" style="background: transparent;"></span>
5747
+ <span class="tt-name">{{ mode() === 'funnel' ? 'Conversion' : 'Share' }}</span>
5748
+ <span class="tt-val">
5749
+ {{ (mode() === 'funnel' ? (stage.value / funnelStages()[0].value) : (stage.value / totalValue())) | percent:'1.0-1' }}
5750
+ </span>
4797
5751
  </div>
4798
5752
  </div>
4799
5753
  }
@@ -4815,7 +5769,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4815
5769
  <div class="legend-metrics">
4816
5770
  <span class="metric-value">{{ fmtNum(stage.value) }}</span>
4817
5771
  <span class="metric-pct">
4818
- {{ (stage.value / funnelStages()[0].value) | percent:'1.0-1' }}
5772
+ {{ (mode() === 'funnel' ? (stage.value / funnelStages()[0].value) : (stage.value / totalValue())) | percent:'1.0-1' }}
4819
5773
  </span>
4820
5774
  </div>
4821
5775
  </div>
@@ -4824,7 +5778,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4824
5778
  </div>
4825
5779
  </div>
4826
5780
  </div>
4827
- `, styles: [":host{display:block}.ngx-funnel-chart{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;padding:20px}.funnel-layout{display:grid;grid-template-columns:1.2fr 1fr;gap:24px;align-items:center}@media (max-width: 600px){.funnel-layout{grid-template-columns:1fr}}.funnel-graphic{position:relative;width:100%}.funnel-svg{display:block;overflow:visible}.funnel-polygon{cursor:pointer;opacity:.85;transition:opacity .2s,transform .2s,filter .2s;filter:drop-shadow(0 2px 4px rgba(0,0,0,.06))}.funnel-polygon:hover,.funnel-polygon.active{opacity:1;filter:drop-shadow(0 4px 12px rgba(0,0,0,.12)) brightness(1.05)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, #0f172a);color:#fff;padding:8px 12px;border-radius:8px;font-size:12px;white-space:nowrap;box-shadow:0 4px 16px #00000026;z-index:10}.tt-name{font-weight:700;margin-bottom:4px}.tt-row{font-size:11px;opacity:.9}.funnel-legend{display:flex;flex-direction:column;gap:8px}.legend-item{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:8px;border:1px solid transparent;transition:all .2s;cursor:pointer}.legend-item:hover,.legend-item.active{background:var(--bg-primary, #f8fafc);border-color:var(--border-color, #e2e8f0)}.legend-color-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0}.legend-content{flex:1;display:flex;justify-content:space-between;align-items:center;gap:16px}.legend-title{font-size:13px;font-weight:600;color:var(--text-primary, #0f172a)}.legend-metrics{display:flex;align-items:center;gap:10px}.metric-value{font-size:13px;font-weight:700;color:var(--text-primary, #0f172a)}.metric-pct{font-size:11px;color:var(--text-secondary, #64748b);background:var(--border-light, #f1f5f9);padding:2px 6px;border-radius:4px;font-weight:600}\n"] }]
5781
+ `, styles: [":host{display:block}.ngx-funnel-chart{background:var(--ngx-chart-bg, #ffffff);border:1px solid var(--ngx-chart-grid, #ebedf0);border-radius:16px;padding:20px;position:relative}.funnel-layout{display:grid;grid-template-columns:1.2fr 1fr;gap:24px;align-items:center}@media (max-width: 600px){.funnel-layout{grid-template-columns:1fr}}.funnel-graphic{position:relative;width:100%}.funnel-svg{display:block;overflow:visible}@keyframes funnelBuildIn{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}.funnel-polygon{cursor:pointer;opacity:.88;transition:opacity .25s,transform .25s cubic-bezier(.16,1,.3,1),filter .25s;animation:funnelBuildIn .7s cubic-bezier(.16,1,.3,1) both}.funnel-polygon:hover,.funnel-polygon.active{opacity:1;transform:scale(1.03);filter:drop-shadow(0 8px 16px rgba(0,0,0,.18)) brightness(1.03)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:155px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}.funnel-legend{display:flex;flex-direction:column;gap:8px}.legend-item{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:8px;border:1px solid transparent;transition:all .2s;cursor:pointer}.legend-item:hover,.legend-item.active{background:var(--ngx-chart-grid, #f8fafc);border-color:var(--ngx-chart-grid, #e2e8f0)}.legend-color-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0}.legend-content{flex:1;display:flex;justify-content:space-between;align-items:center;gap:16px}.legend-title{font-size:13px;font-weight:600;color:var(--ngx-chart-text, #0f172a)}.legend-metrics{display:flex;align-items:center;gap:10px}.metric-value{font-size:13px;font-weight:700;color:var(--ngx-chart-text, #0f172a)}.metric-pct{font-size:11px;color:var(--ngx-chart-axis-text, #64748b);background:var(--ngx-chart-grid, #f1f5f9);padding:2px 6px;border-radius:4px;font-weight:600}\n"] }]
4828
5782
  }] });
4829
5783
 
4830
5784
  class ComboChartComponent {
@@ -4844,7 +5798,11 @@ class ComboChartComponent {
4844
5798
  lineYTitle = input('Percentage');
4845
5799
  activeCategoryIndex = signal(null);
4846
5800
  tooltip = signal(null);
5801
+ animateState = signal(false);
4847
5802
  container = viewChild('container');
5803
+ constructor() {
5804
+ setTimeout(() => this.animateState.set(true), 50);
5805
+ }
4848
5806
  // Dimension Calculations
4849
5807
  innerW = computed(() => {
4850
5808
  const el = this.container()?.nativeElement;
@@ -4860,8 +5818,16 @@ class ComboChartComponent {
4860
5818
  leftYPos(v) {
4861
5819
  return scale(v, this.leftMin(), this.leftMax(), this.innerH(), 0);
4862
5820
  }
4863
- barY(v) { return Math.min(this.leftYPos(0), this.leftYPos(v)); }
4864
- barH(v) { return Math.abs(this.leftYPos(0) - this.leftYPos(v)); }
5821
+ barY(v) {
5822
+ if (!this.animateState())
5823
+ return this.leftYPos(0);
5824
+ return Math.min(this.leftYPos(0), this.leftYPos(v));
5825
+ }
5826
+ barH(v) {
5827
+ if (!this.animateState())
5828
+ return 0;
5829
+ return Math.abs(this.leftYPos(0) - this.leftYPos(v));
5830
+ }
4865
5831
  // Right Y-Axis Calculations (Line values)
4866
5832
  rightValues = computed(() => this.lineSeries().flatMap(s => s.data.filter(v => v !== null)));
4867
5833
  rightMin = computed(() => Math.min(0, ...this.rightValues()));
@@ -4983,6 +5949,15 @@ class ComboChartComponent {
4983
5949
  class="chart-svg"
4984
5950
  (mouseleave)="onMouseLeave()"
4985
5951
  >
5952
+ <defs>
5953
+ @for (s of barSeries(); track s.name; let si = $index) {
5954
+ <linearGradient [id]="'combo-bar-grad-' + si" x1="0" y1="0" x2="0" y2="1">
5955
+ <stop offset="0%" [attr.stop-color]="s.color || barSeriesColor(si)" stop-opacity="1"/>
5956
+ <stop offset="100%" [attr.stop-color]="s.color || barSeriesColor(si)" stop-opacity="0.75"/>
5957
+ </linearGradient>
5958
+ }
5959
+ </defs>
5960
+
4986
5961
  <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
4987
5962
  <!-- Grid Lines -->
4988
5963
  @if (showGrid()) {
@@ -5058,8 +6033,8 @@ class ComboChartComponent {
5058
6033
  [attr.y]="barY(v)"
5059
6034
  [attr.width]="singleBarWidth()"
5060
6035
  [attr.height]="barH(v)"
5061
- [attr.fill]="s.color || barSeriesColor(si)"
5062
- [attr.rx]="2"
6036
+ [attr.fill]="s.color ? s.color : 'url(#combo-bar-grad-' + si + ')'"
6037
+ [attr.rx]="4"
5063
6038
  class="bar-rect"
5064
6039
  />
5065
6040
  }
@@ -5083,11 +6058,12 @@ class ComboChartComponent {
5083
6058
  <circle
5084
6059
  [attr.cx]="catMidX(ci)"
5085
6060
  [attr.cy]="rightYPos(v)"
5086
- [attr.r]="activeCategoryIndex() === ci ? 6 : 4"
6061
+ [attr.r]="activeCategoryIndex() === ci ? 6.5 : 4"
5087
6062
  [attr.fill]="'#ffffff'"
5088
6063
  [attr.stroke]="s.color || lineSeriesColor(si)"
5089
- stroke-width="2.5"
6064
+ [attr.stroke-width]="activeCategoryIndex() === ci ? 3 : 2.5"
5090
6065
  class="line-marker"
6066
+ [style.transform-origin]="catMidX(ci) + 'px ' + rightYPos(v) + 'px'"
5091
6067
  />
5092
6068
  }
5093
6069
  }
@@ -5116,13 +6092,13 @@ class ComboChartComponent {
5116
6092
  <!-- Dynamic Combined Tooltip -->
5117
6093
  @if (tooltip(); as t) {
5118
6094
  <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
5119
- <div class="tooltip-header">{{ t.category }}</div>
5120
- <div class="tooltip-body">
6095
+ <div class="tt-cat">{{ t.category }}</div>
6096
+ <div class="tt-body">
5121
6097
  @for (item of t.items; track item.name) {
5122
- <div class="tooltip-row">
5123
- <span class="tooltip-dot" [style.background]="item.color" [class.line-dot]="item.type === 'line'"></span>
5124
- <span class="tooltip-label">{{ item.name }}:</span>
5125
- <span class="tooltip-val">{{ fmtNum(item.value) }}{{ item.suffix || '' }}</span>
6098
+ <div class="tt-row">
6099
+ <span class="tt-dot" [style.background]="item.color" [class.line-dot]="item.type === 'line'"></span>
6100
+ <span class="tt-name">{{ item.name }}</span>
6101
+ <span class="tt-val">{{ fmtNum(item.value) }}{{ item.suffix || '' }}</span>
5126
6102
  </div>
5127
6103
  }
5128
6104
  </div>
@@ -5130,7 +6106,7 @@ class ComboChartComponent {
5130
6106
  }
5131
6107
  </div>
5132
6108
  </div>
5133
- `, isInline: true, styles: [":host{display:block;width:100%}.ngx-combo-chart{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif);transition:background-color .3s}.ngx-combo-chart.dark{background:#1e203073;border:1px solid rgba(255,255,255,.05);--ngx-chart-bg: transparent;--ngx-chart-grid: rgba(255, 255, 255, .06);--ngx-chart-axis: rgba(255, 255, 255, .12)}.chart-legend{display:flex;gap:16px;margin-bottom:16px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:#64748b}.dark .legend-item{color:#94a3b8}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.legend-dot.bar{border-radius:2px}.legend-line{width:14px;border-bottom:2px solid;display:inline-block}.legend-dot.marker{margin-left:-12px;width:6px;height:6px;border:1.5px solid #ffffff}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}.dark .axis-label{fill:#94a3b8}.axis-title{font-size:11px;font-weight:600;fill:#475569;letter-spacing:.5px}.dark .axis-title{fill:#cbd5e1}.column-highlight{fill:#3b82f60a;pointer-events:none}.dark .column-highlight{fill:#ffffff08}.bar-rect{transition:fill-opacity .2s,transform .2s}.line-path{transition:stroke .2s}.line-marker{cursor:pointer;transition:r .2s,stroke-width .2s}.hitbox{cursor:crosshair}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:#0f172ae6;backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.1);box-shadow:0 10px 15px -3px #0000004d;color:#f8fafc;padding:10px 14px;border-radius:8px;font-size:12px;z-index:100;min-width:140px;transition:left .1s ease,top .1s ease}.tooltip-header{font-weight:700;border-bottom:1px solid rgba(255,255,255,.1);padding-bottom:4px;margin-bottom:6px;color:#38bdf8}.tooltip-body{display:flex;flex-direction:column;gap:4px}.tooltip-row{display:flex;align-items:center;gap:6px}.tooltip-dot{width:7px;height:7px;border-radius:50%}.tooltip-dot.line-dot{border:1.5px solid #ffffff;box-sizing:border-box;width:8px;height:8px}.tooltip-label{color:#94a3b8;flex:1}.tooltip-val{font-weight:700;font-family:monospace}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6109
+ `, isInline: true, styles: [":host{display:block;width:100%}.ngx-combo-chart{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif);transition:background-color .3s}.ngx-combo-chart.dark{background:#1e203073;border:1px solid rgba(255,255,255,.05);--ngx-chart-bg: transparent;--ngx-chart-grid: rgba(255, 255, 255, .06);--ngx-chart-axis: rgba(255, 255, 255, .12)}.chart-legend{display:flex;gap:16px;margin-bottom:16px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:#64748b}.dark .legend-item{color:#94a3b8}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.legend-dot.bar{border-radius:2px}.legend-line{width:14px;border-bottom:2px solid;display:inline-block}.legend-dot.marker{margin-left:-12px;width:6px;height:6px;border:1.5px solid #ffffff}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}.dark .axis-label{fill:#94a3b8}.axis-title{font-size:11px;font-weight:600;fill:#475569;letter-spacing:.5px}.dark .axis-title{fill:#cbd5e1}.column-highlight{fill:#3b82f60a;pointer-events:none;rx:6;ry:6;animation:fadeIn .12s ease-out}.dark .column-highlight{fill:#ffffff08}.bar-rect{transition:y .5s cubic-bezier(.16,1,.3,1),height .5s cubic-bezier(.16,1,.3,1),fill-opacity .15s,stroke-width .15s;stroke:#fff;stroke-width:.5;cursor:pointer}.bar-rect:hover{fill-opacity:.9;stroke-width:1.5;filter:drop-shadow(0 4px 6px rgba(0,0,0,.08))}@keyframes drawLine{0%{stroke-dashoffset:1200}to{stroke-dashoffset:0}}.line-path{stroke-dasharray:1200;stroke-dashoffset:1200;animation:drawLine 1.2s cubic-bezier(.16,1,.3,1) forwards;transition:stroke .2s}@keyframes markerFade{0%{opacity:0;transform:scale(0)}to{opacity:1;transform:scale(1)}}.line-marker{cursor:pointer;transition:r .2s cubic-bezier(.16,1,.3,1),stroke-width .2s;animation:markerFade .5s cubic-bezier(.16,1,.3,1) .6s both}.hitbox{cursor:crosshair}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-body{display:flex;flex-direction:column;gap:4px}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-dot.line-dot{border:1.5px solid #ffffff;box-sizing:border-box;width:9px;height:9px}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5134
6110
  }
5135
6111
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ComboChartComponent, decorators: [{
5136
6112
  type: Component,
@@ -5162,6 +6138,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
5162
6138
  class="chart-svg"
5163
6139
  (mouseleave)="onMouseLeave()"
5164
6140
  >
6141
+ <defs>
6142
+ @for (s of barSeries(); track s.name; let si = $index) {
6143
+ <linearGradient [id]="'combo-bar-grad-' + si" x1="0" y1="0" x2="0" y2="1">
6144
+ <stop offset="0%" [attr.stop-color]="s.color || barSeriesColor(si)" stop-opacity="1"/>
6145
+ <stop offset="100%" [attr.stop-color]="s.color || barSeriesColor(si)" stop-opacity="0.75"/>
6146
+ </linearGradient>
6147
+ }
6148
+ </defs>
6149
+
5165
6150
  <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
5166
6151
  <!-- Grid Lines -->
5167
6152
  @if (showGrid()) {
@@ -5237,8 +6222,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
5237
6222
  [attr.y]="barY(v)"
5238
6223
  [attr.width]="singleBarWidth()"
5239
6224
  [attr.height]="barH(v)"
5240
- [attr.fill]="s.color || barSeriesColor(si)"
5241
- [attr.rx]="2"
6225
+ [attr.fill]="s.color ? s.color : 'url(#combo-bar-grad-' + si + ')'"
6226
+ [attr.rx]="4"
5242
6227
  class="bar-rect"
5243
6228
  />
5244
6229
  }
@@ -5262,11 +6247,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
5262
6247
  <circle
5263
6248
  [attr.cx]="catMidX(ci)"
5264
6249
  [attr.cy]="rightYPos(v)"
5265
- [attr.r]="activeCategoryIndex() === ci ? 6 : 4"
6250
+ [attr.r]="activeCategoryIndex() === ci ? 6.5 : 4"
5266
6251
  [attr.fill]="'#ffffff'"
5267
6252
  [attr.stroke]="s.color || lineSeriesColor(si)"
5268
- stroke-width="2.5"
6253
+ [attr.stroke-width]="activeCategoryIndex() === ci ? 3 : 2.5"
5269
6254
  class="line-marker"
6255
+ [style.transform-origin]="catMidX(ci) + 'px ' + rightYPos(v) + 'px'"
5270
6256
  />
5271
6257
  }
5272
6258
  }
@@ -5295,13 +6281,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
5295
6281
  <!-- Dynamic Combined Tooltip -->
5296
6282
  @if (tooltip(); as t) {
5297
6283
  <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
5298
- <div class="tooltip-header">{{ t.category }}</div>
5299
- <div class="tooltip-body">
6284
+ <div class="tt-cat">{{ t.category }}</div>
6285
+ <div class="tt-body">
5300
6286
  @for (item of t.items; track item.name) {
5301
- <div class="tooltip-row">
5302
- <span class="tooltip-dot" [style.background]="item.color" [class.line-dot]="item.type === 'line'"></span>
5303
- <span class="tooltip-label">{{ item.name }}:</span>
5304
- <span class="tooltip-val">{{ fmtNum(item.value) }}{{ item.suffix || '' }}</span>
6287
+ <div class="tt-row">
6288
+ <span class="tt-dot" [style.background]="item.color" [class.line-dot]="item.type === 'line'"></span>
6289
+ <span class="tt-name">{{ item.name }}</span>
6290
+ <span class="tt-val">{{ fmtNum(item.value) }}{{ item.suffix || '' }}</span>
5305
6291
  </div>
5306
6292
  }
5307
6293
  </div>
@@ -5309,8 +6295,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
5309
6295
  }
5310
6296
  </div>
5311
6297
  </div>
5312
- `, styles: [":host{display:block;width:100%}.ngx-combo-chart{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif);transition:background-color .3s}.ngx-combo-chart.dark{background:#1e203073;border:1px solid rgba(255,255,255,.05);--ngx-chart-bg: transparent;--ngx-chart-grid: rgba(255, 255, 255, .06);--ngx-chart-axis: rgba(255, 255, 255, .12)}.chart-legend{display:flex;gap:16px;margin-bottom:16px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:#64748b}.dark .legend-item{color:#94a3b8}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.legend-dot.bar{border-radius:2px}.legend-line{width:14px;border-bottom:2px solid;display:inline-block}.legend-dot.marker{margin-left:-12px;width:6px;height:6px;border:1.5px solid #ffffff}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}.dark .axis-label{fill:#94a3b8}.axis-title{font-size:11px;font-weight:600;fill:#475569;letter-spacing:.5px}.dark .axis-title{fill:#cbd5e1}.column-highlight{fill:#3b82f60a;pointer-events:none}.dark .column-highlight{fill:#ffffff08}.bar-rect{transition:fill-opacity .2s,transform .2s}.line-path{transition:stroke .2s}.line-marker{cursor:pointer;transition:r .2s,stroke-width .2s}.hitbox{cursor:crosshair}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:#0f172ae6;backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.1);box-shadow:0 10px 15px -3px #0000004d;color:#f8fafc;padding:10px 14px;border-radius:8px;font-size:12px;z-index:100;min-width:140px;transition:left .1s ease,top .1s ease}.tooltip-header{font-weight:700;border-bottom:1px solid rgba(255,255,255,.1);padding-bottom:4px;margin-bottom:6px;color:#38bdf8}.tooltip-body{display:flex;flex-direction:column;gap:4px}.tooltip-row{display:flex;align-items:center;gap:6px}.tooltip-dot{width:7px;height:7px;border-radius:50%}.tooltip-dot.line-dot{border:1.5px solid #ffffff;box-sizing:border-box;width:8px;height:8px}.tooltip-label{color:#94a3b8;flex:1}.tooltip-val{font-weight:700;font-family:monospace}\n"] }]
5313
- }] });
6298
+ `, styles: [":host{display:block;width:100%}.ngx-combo-chart{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif);transition:background-color .3s}.ngx-combo-chart.dark{background:#1e203073;border:1px solid rgba(255,255,255,.05);--ngx-chart-bg: transparent;--ngx-chart-grid: rgba(255, 255, 255, .06);--ngx-chart-axis: rgba(255, 255, 255, .12)}.chart-legend{display:flex;gap:16px;margin-bottom:16px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:#64748b}.dark .legend-item{color:#94a3b8}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.legend-dot.bar{border-radius:2px}.legend-line{width:14px;border-bottom:2px solid;display:inline-block}.legend-dot.marker{margin-left:-12px;width:6px;height:6px;border:1.5px solid #ffffff}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}.dark .axis-label{fill:#94a3b8}.axis-title{font-size:11px;font-weight:600;fill:#475569;letter-spacing:.5px}.dark .axis-title{fill:#cbd5e1}.column-highlight{fill:#3b82f60a;pointer-events:none;rx:6;ry:6;animation:fadeIn .12s ease-out}.dark .column-highlight{fill:#ffffff08}.bar-rect{transition:y .5s cubic-bezier(.16,1,.3,1),height .5s cubic-bezier(.16,1,.3,1),fill-opacity .15s,stroke-width .15s;stroke:#fff;stroke-width:.5;cursor:pointer}.bar-rect:hover{fill-opacity:.9;stroke-width:1.5;filter:drop-shadow(0 4px 6px rgba(0,0,0,.08))}@keyframes drawLine{0%{stroke-dashoffset:1200}to{stroke-dashoffset:0}}.line-path{stroke-dasharray:1200;stroke-dashoffset:1200;animation:drawLine 1.2s cubic-bezier(.16,1,.3,1) forwards;transition:stroke .2s}@keyframes markerFade{0%{opacity:0;transform:scale(0)}to{opacity:1;transform:scale(1)}}.line-marker{cursor:pointer;transition:r .2s cubic-bezier(.16,1,.3,1),stroke-width .2s;animation:markerFade .5s cubic-bezier(.16,1,.3,1) .6s both}.hitbox{cursor:crosshair}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-body{display:flex;flex-direction:column;gap:4px}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-dot.line-dot{border:1.5px solid #ffffff;box-sizing:border-box;width:9px;height:9px}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"] }]
6299
+ }], ctorParameters: () => [] });
5314
6300
 
5315
6301
  class ScatterPlotComponent {
5316
6302
  PAD_LEFT = 52;
@@ -5485,18 +6471,47 @@ class ScatterPlotComponent {
5485
6471
  text-anchor="middle"
5486
6472
  >{{ xTitle() }}</text>
5487
6473
 
6474
+ <!-- Active Crosshair -->
6475
+ @if (hoveredPointIndex() !== null) {
6476
+ @if (scaledPoints()[hoveredPointIndex()!]; as pt) {
6477
+ <line
6478
+ [attr.x1]="0"
6479
+ [attr.x2]="innerW()"
6480
+ [attr.y1]="pt.cy"
6481
+ [attr.y2]="pt.cy"
6482
+ stroke="rgba(79, 70, 229, 0.35)"
6483
+ stroke-width="1.2"
6484
+ stroke-dasharray="3,3"
6485
+ class="crosshair-line"
6486
+ />
6487
+ <line
6488
+ [attr.x1]="pt.cx"
6489
+ [attr.x2]="pt.cx"
6490
+ [attr.y1]="0"
6491
+ [attr.y2]="innerH()"
6492
+ stroke="rgba(79, 70, 229, 0.35)"
6493
+ stroke-width="1.2"
6494
+ stroke-dasharray="3,3"
6495
+ class="crosshair-line"
6496
+ />
6497
+ }
6498
+ }
6499
+
5488
6500
  <!-- Render Data Points -->
5489
6501
  @for (pt of scaledPoints(); track $index; let i = $index) {
5490
6502
  <circle
5491
6503
  [attr.cx]="pt.cx"
5492
6504
  [attr.cy]="pt.cy"
5493
- [attr.r]="pt.r"
6505
+ [attr.r]="hoveredPointIndex() === i ? pt.r + 3.5 : pt.r"
5494
6506
  [attr.fill]="pt.color"
5495
6507
  [attr.stroke]="'#ffffff'"
5496
6508
  stroke-width="1.5"
5497
6509
  class="scatter-point"
5498
6510
  [class.hovered]="hoveredPointIndex() === i"
6511
+ [style.transform-origin]="pt.cx + 'px ' + pt.cy + 'px'"
6512
+ [style.animation-delay]="(i * 0.015) + 's'"
5499
6513
  (mouseenter)="onPointHover($event, pt.raw, i)"
6514
+ (mousemove)="onPointHover($event, pt.raw, i)"
5500
6515
  />
5501
6516
  }
5502
6517
 
@@ -5510,20 +6525,30 @@ class ScatterPlotComponent {
5510
6525
  @if (tooltip(); as t) {
5511
6526
  <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
5512
6527
  @if (t.label) {
5513
- <div class="tooltip-header">{{ t.label }}</div>
6528
+ <div class="tt-cat">{{ t.label }}</div>
6529
+ } @else {
6530
+ <div class="tt-cat">Point Data</div>
5514
6531
  }
5515
- <div class="tooltip-body">
5516
- @if (t.group) {
5517
- <div class="tooltip-group">Group: <strong>{{ t.group }}</strong></div>
5518
- }
5519
- <div class="tooltip-val">{{ xTitle() }}: <strong>{{ fmtNum(ptX(t)) }}</strong></div>
5520
- <div class="tooltip-val">{{ yTitle() }}: <strong>{{ fmtNum(ptY(t)) }}</strong></div>
6532
+ <div class="tt-row">
6533
+ <span class="tt-dot" [style.background]="t.color"></span>
6534
+ <span class="tt-name">Group</span>
6535
+ <span class="tt-val">{{ t.group || 'Default' }}</span>
6536
+ </div>
6537
+ <div class="tt-row">
6538
+ <span class="tt-dot" style="background: transparent;"></span>
6539
+ <span class="tt-name">{{ xTitle() }}</span>
6540
+ <span class="tt-val">{{ fmtNum(ptX(t)) }}</span>
6541
+ </div>
6542
+ <div class="tt-row">
6543
+ <span class="tt-dot" style="background: transparent;"></span>
6544
+ <span class="tt-name">{{ yTitle() }}</span>
6545
+ <span class="tt-val">{{ fmtNum(ptY(t)) }}</span>
5521
6546
  </div>
5522
6547
  </div>
5523
6548
  }
5524
6549
  </div>
5525
6550
  </div>
5526
- `, isInline: true, styles: [":host{display:block;width:100%}.ngx-scatter-plot{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif);transition:background-color .3s}.ngx-scatter-plot.dark{background:#1e203073;border:1px solid rgba(255,255,255,.05);--ngx-chart-bg: transparent;--ngx-chart-grid: rgba(255, 255, 255, .06);--ngx-chart-axis: rgba(255, 255, 255, .12)}.chart-legend{display:flex;gap:16px;margin-bottom:16px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:#64748b}.dark .legend-item{color:#94a3b8}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}.dark .axis-label{fill:#94a3b8}.axis-title{font-size:11px;font-weight:600;fill:#475569;letter-spacing:.5px}.dark .axis-title{fill:#cbd5e1}.scatter-point{cursor:pointer;transition:r .2s,opacity .2s,filter .2s}.scatter-point.hovered{r:8px;opacity:.95;filter:brightness(1.1)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:#0f172af2;backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.1);box-shadow:0 10px 15px -3px #0000004d;color:#f8fafc;padding:8px 12px;border-radius:6px;font-size:11px;z-index:100;min-width:120px}.tooltip-header{font-weight:700;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;margin-bottom:6px;color:#38bdf8}.tooltip-body{display:flex;flex-direction:column;gap:3px}.tooltip-group{color:#cbd5e1;margin-bottom:3px}.tooltip-val{color:#94a3b8}.tooltip-val strong{color:#f8fafc;font-family:monospace}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6551
+ `, isInline: true, styles: [":host{display:block;width:100%}.ngx-scatter-plot{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif);transition:background-color .3s}.ngx-scatter-plot.dark{background:#1e203073;border:1px solid rgba(255,255,255,.05);--ngx-chart-bg: transparent;--ngx-chart-grid: rgba(255, 255, 255, .06);--ngx-chart-axis: rgba(255, 255, 255, .12)}.chart-legend{display:flex;gap:16px;margin-bottom:16px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:#64748b}.dark .legend-item{color:#94a3b8}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}.dark .axis-label{fill:#94a3b8}.axis-title{font-size:11px;font-weight:600;fill:#475569;letter-spacing:.5px}.dark .axis-title{fill:#cbd5e1}@keyframes scatterPointPop{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:.85}}.scatter-point{cursor:pointer;transition:r .25s cubic-bezier(.16,1,.3,1),opacity .25s,filter .25s,stroke-width .2s;animation:scatterPointPop .5s cubic-bezier(.16,1,.3,1) both}.scatter-point.hovered{opacity:.95;filter:drop-shadow(0 0 6px var(--ngx-chart-hover-stroke, #4f46e5));stroke:#fff;stroke-width:2px}.crosshair-line{pointer-events:none;animation:fadeIn .15s ease-out forwards}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;z-index:100;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5527
6552
  }
5528
6553
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ScatterPlotComponent, decorators: [{
5529
6554
  type: Component,
@@ -5606,18 +6631,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
5606
6631
  text-anchor="middle"
5607
6632
  >{{ xTitle() }}</text>
5608
6633
 
6634
+ <!-- Active Crosshair -->
6635
+ @if (hoveredPointIndex() !== null) {
6636
+ @if (scaledPoints()[hoveredPointIndex()!]; as pt) {
6637
+ <line
6638
+ [attr.x1]="0"
6639
+ [attr.x2]="innerW()"
6640
+ [attr.y1]="pt.cy"
6641
+ [attr.y2]="pt.cy"
6642
+ stroke="rgba(79, 70, 229, 0.35)"
6643
+ stroke-width="1.2"
6644
+ stroke-dasharray="3,3"
6645
+ class="crosshair-line"
6646
+ />
6647
+ <line
6648
+ [attr.x1]="pt.cx"
6649
+ [attr.x2]="pt.cx"
6650
+ [attr.y1]="0"
6651
+ [attr.y2]="innerH()"
6652
+ stroke="rgba(79, 70, 229, 0.35)"
6653
+ stroke-width="1.2"
6654
+ stroke-dasharray="3,3"
6655
+ class="crosshair-line"
6656
+ />
6657
+ }
6658
+ }
6659
+
5609
6660
  <!-- Render Data Points -->
5610
6661
  @for (pt of scaledPoints(); track $index; let i = $index) {
5611
6662
  <circle
5612
6663
  [attr.cx]="pt.cx"
5613
6664
  [attr.cy]="pt.cy"
5614
- [attr.r]="pt.r"
6665
+ [attr.r]="hoveredPointIndex() === i ? pt.r + 3.5 : pt.r"
5615
6666
  [attr.fill]="pt.color"
5616
6667
  [attr.stroke]="'#ffffff'"
5617
6668
  stroke-width="1.5"
5618
6669
  class="scatter-point"
5619
6670
  [class.hovered]="hoveredPointIndex() === i"
6671
+ [style.transform-origin]="pt.cx + 'px ' + pt.cy + 'px'"
6672
+ [style.animation-delay]="(i * 0.015) + 's'"
5620
6673
  (mouseenter)="onPointHover($event, pt.raw, i)"
6674
+ (mousemove)="onPointHover($event, pt.raw, i)"
5621
6675
  />
5622
6676
  }
5623
6677
 
@@ -5631,20 +6685,1619 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
5631
6685
  @if (tooltip(); as t) {
5632
6686
  <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
5633
6687
  @if (t.label) {
5634
- <div class="tooltip-header">{{ t.label }}</div>
6688
+ <div class="tt-cat">{{ t.label }}</div>
6689
+ } @else {
6690
+ <div class="tt-cat">Point Data</div>
5635
6691
  }
5636
- <div class="tooltip-body">
5637
- @if (t.group) {
5638
- <div class="tooltip-group">Group: <strong>{{ t.group }}</strong></div>
5639
- }
5640
- <div class="tooltip-val">{{ xTitle() }}: <strong>{{ fmtNum(ptX(t)) }}</strong></div>
5641
- <div class="tooltip-val">{{ yTitle() }}: <strong>{{ fmtNum(ptY(t)) }}</strong></div>
6692
+ <div class="tt-row">
6693
+ <span class="tt-dot" [style.background]="t.color"></span>
6694
+ <span class="tt-name">Group</span>
6695
+ <span class="tt-val">{{ t.group || 'Default' }}</span>
6696
+ </div>
6697
+ <div class="tt-row">
6698
+ <span class="tt-dot" style="background: transparent;"></span>
6699
+ <span class="tt-name">{{ xTitle() }}</span>
6700
+ <span class="tt-val">{{ fmtNum(ptX(t)) }}</span>
6701
+ </div>
6702
+ <div class="tt-row">
6703
+ <span class="tt-dot" style="background: transparent;"></span>
6704
+ <span class="tt-name">{{ yTitle() }}</span>
6705
+ <span class="tt-val">{{ fmtNum(ptY(t)) }}</span>
6706
+ </div>
6707
+ </div>
6708
+ }
6709
+ </div>
6710
+ </div>
6711
+ `, styles: [":host{display:block;width:100%}.ngx-scatter-plot{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif);transition:background-color .3s}.ngx-scatter-plot.dark{background:#1e203073;border:1px solid rgba(255,255,255,.05);--ngx-chart-bg: transparent;--ngx-chart-grid: rgba(255, 255, 255, .06);--ngx-chart-axis: rgba(255, 255, 255, .12)}.chart-legend{display:flex;gap:16px;margin-bottom:16px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:#64748b}.dark .legend-item{color:#94a3b8}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}.dark .axis-label{fill:#94a3b8}.axis-title{font-size:11px;font-weight:600;fill:#475569;letter-spacing:.5px}.dark .axis-title{fill:#cbd5e1}@keyframes scatterPointPop{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:.85}}.scatter-point{cursor:pointer;transition:r .25s cubic-bezier(.16,1,.3,1),opacity .25s,filter .25s,stroke-width .2s;animation:scatterPointPop .5s cubic-bezier(.16,1,.3,1) both}.scatter-point.hovered{opacity:.95;filter:drop-shadow(0 0 6px var(--ngx-chart-hover-stroke, #4f46e5));stroke:#fff;stroke-width:2px}.crosshair-line{pointer-events:none;animation:fadeIn .15s ease-out forwards}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;z-index:100;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"] }]
6712
+ }] });
6713
+
6714
+ class WaterfallChartComponent {
6715
+ PAD_LEFT = 52;
6716
+ PAD_TOP = 20;
6717
+ PAD_RIGHT = 24;
6718
+ PAD_BOTTOM = 36;
6719
+ data = input([]);
6720
+ height = input(300);
6721
+ showGrid = input(true);
6722
+ showLabels = input(true);
6723
+ // Styling properties
6724
+ positiveColor = input('#10b981'); // Emerald
6725
+ negativeColor = input('#ef4444'); // Rose/Red
6726
+ totalColor = input('#64748b'); // Slate
6727
+ hoveredIndex = signal(null);
6728
+ tooltip = signal(null);
6729
+ container = viewChild('container');
6730
+ innerW = computed(() => {
6731
+ const el = this.container()?.nativeElement;
6732
+ const totalW = el ? el.getBoundingClientRect().width : 600;
6733
+ return Math.max(200, totalW - this.PAD_LEFT - this.PAD_RIGHT);
6734
+ });
6735
+ innerH = computed(() => this.height() - this.PAD_TOP - this.PAD_BOTTOM);
6736
+ // Compute intermediate running balances and waterfall metrics
6737
+ processedData = computed(() => {
6738
+ const raw = this.data();
6739
+ let balance = 0;
6740
+ return raw.map(item => {
6741
+ const start = balance;
6742
+ if (item.isTotal) {
6743
+ // If it's explicitly designated as a Total, the column represents the current total
6744
+ // but wait: does it reset or just display the accumulated balance? It displays the balance!
6745
+ const val = balance;
6746
+ return {
6747
+ label: item.label,
6748
+ value: val,
6749
+ start: 0,
6750
+ end: val,
6751
+ isTotal: true,
6752
+ runningBalance: val
6753
+ };
6754
+ }
6755
+ else {
6756
+ balance += item.value;
6757
+ return {
6758
+ label: item.label,
6759
+ value: item.value,
6760
+ start: start,
6761
+ end: balance,
6762
+ isTotal: false,
6763
+ runningBalance: balance
6764
+ };
6765
+ }
6766
+ });
6767
+ });
6768
+ // Bounds
6769
+ yMin = computed(() => {
6770
+ const vals = [0, ...this.processedData().map(d => d.end), ...this.processedData().map(d => d.start)];
6771
+ return Math.min(...vals) < 0 ? Math.min(...vals) * 1.1 : 0;
6772
+ });
6773
+ yMax = computed(() => {
6774
+ const vals = [0, ...this.processedData().map(d => d.end), ...this.processedData().map(d => d.start)];
6775
+ return Math.max(...vals) * 1.1;
6776
+ });
6777
+ yTicks = computed(() => niceTicks(this.yMin(), this.yMax(), 5));
6778
+ // Scale functions
6779
+ xPos(index, count) {
6780
+ const step = this.innerW() / count;
6781
+ return index * step + step * 0.15; // 15% margin
6782
+ }
6783
+ yPos(y) {
6784
+ return scale(y, this.yMin(), this.yMax(), this.innerH(), 0);
6785
+ }
6786
+ barWidth(count) {
6787
+ return (this.innerW() / count) * 0.7; // 70% width
6788
+ }
6789
+ computedBars = computed(() => {
6790
+ const items = this.processedData();
6791
+ const count = items.length;
6792
+ if (count === 0)
6793
+ return [];
6794
+ const width = this.barWidth(count);
6795
+ return items.map((item, idx) => {
6796
+ const x = this.xPos(idx, count);
6797
+ const yStart = this.yPos(item.start);
6798
+ const yEnd = this.yPos(item.end);
6799
+ const y = Math.min(yStart, yEnd);
6800
+ const rectH = Math.max(2, Math.abs(yStart - yEnd));
6801
+ let fill = 'url(#waterfall-tot)';
6802
+ let color = this.totalColor();
6803
+ if (!item.isTotal) {
6804
+ fill = item.value >= 0 ? 'url(#waterfall-pos)' : 'url(#waterfall-neg)';
6805
+ color = item.value >= 0 ? this.positiveColor() : this.negativeColor();
6806
+ }
6807
+ // Connect line is drawn from the end value of this item
6808
+ const connectY = yEnd;
6809
+ return {
6810
+ x,
6811
+ y,
6812
+ rectH,
6813
+ width,
6814
+ color,
6815
+ fill,
6816
+ connectY,
6817
+ label: item.label,
6818
+ value: item.value,
6819
+ balance: item.runningBalance,
6820
+ isTotal: item.isTotal
6821
+ };
6822
+ });
6823
+ });
6824
+ onBarHover(event, bar, index) {
6825
+ this.hoveredIndex.set(index);
6826
+ const containerEl = this.container()?.nativeElement;
6827
+ if (!containerEl)
6828
+ return;
6829
+ const rect = containerEl.getBoundingClientRect();
6830
+ const tooltipX = event.clientX - rect.left;
6831
+ const tooltipY = event.clientY - rect.top;
6832
+ this.tooltip.set({
6833
+ x: tooltipX,
6834
+ y: tooltipY,
6835
+ label: bar.label,
6836
+ value: bar.value,
6837
+ balance: bar.balance,
6838
+ color: bar.color
6839
+ });
6840
+ }
6841
+ fmtNum = fmtNum;
6842
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: WaterfallChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
6843
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: WaterfallChartComponent, isStandalone: true, selector: "ngx-waterfall-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showGrid: { classPropertyName: "showGrid", publicName: "showGrid", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, positiveColor: { classPropertyName: "positiveColor", publicName: "positiveColor", isSignal: true, isRequired: false, transformFunction: null }, negativeColor: { classPropertyName: "negativeColor", publicName: "negativeColor", isSignal: true, isRequired: false, transformFunction: null }, totalColor: { classPropertyName: "totalColor", publicName: "totalColor", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, isSignal: true }], ngImport: i0, template: `
6844
+ <div class="ngx-waterfall-chart" (mouseleave)="hoveredIndex.set(null); tooltip.set(null)">
6845
+ <div class="chart-svg-container" #container>
6846
+ <svg
6847
+ [attr.width]="'100%'"
6848
+ [attr.height]="height()"
6849
+ class="chart-svg"
6850
+ >
6851
+ <defs>
6852
+ <linearGradient id="waterfall-pos" x1="0" y1="0" x2="0" y2="1">
6853
+ <stop offset="0%" [attr.stop-color]="positiveColor()" stop-opacity="1"/>
6854
+ <stop offset="100%" [attr.stop-color]="positiveColor()" stop-opacity="0.75"/>
6855
+ </linearGradient>
6856
+ <linearGradient id="waterfall-neg" x1="0" y1="0" x2="0" y2="1">
6857
+ <stop offset="0%" [attr.stop-color]="negativeColor()" stop-opacity="1"/>
6858
+ <stop offset="100%" [attr.stop-color]="negativeColor()" stop-opacity="0.75"/>
6859
+ </linearGradient>
6860
+ <linearGradient id="waterfall-tot" x1="0" y1="0" x2="0" y2="1">
6861
+ <stop offset="0%" [attr.stop-color]="totalColor()" stop-opacity="1"/>
6862
+ <stop offset="100%" [attr.stop-color]="totalColor()" stop-opacity="0.75"/>
6863
+ </linearGradient>
6864
+ </defs>
6865
+ <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
6866
+ <!-- Grid Lines (Horizontal) -->
6867
+ @if (showGrid()) {
6868
+ @for (tick of yTicks(); track tick) {
6869
+ <line
6870
+ [attr.x1]="0"
6871
+ [attr.x2]="innerW()"
6872
+ [attr.y1]="yPos(tick)"
6873
+ [attr.y2]="yPos(tick)"
6874
+ stroke="var(--ngx-chart-grid, #ebedf0)"
6875
+ stroke-dasharray="3,3"
6876
+ />
6877
+ }
6878
+ }
6879
+
6880
+ <!-- Y-Axis Labels -->
6881
+ @for (tick of yTicks(); track tick) {
6882
+ <text
6883
+ x="-10"
6884
+ [attr.y]="yPos(tick) + 4"
6885
+ class="axis-label y"
6886
+ text-anchor="end"
6887
+ >{{ fmtNum(tick) }}</text>
6888
+ }
6889
+
6890
+ <!-- X-Axis Labels -->
6891
+ @for (bar of computedBars(); track $index; let i = $index) {
6892
+ <text
6893
+ [attr.x]="bar.x + bar.width / 2"
6894
+ [attr.y]="innerH() + 20"
6895
+ class="axis-label x"
6896
+ text-anchor="middle"
6897
+ >{{ bar.label }}</text>
6898
+ }
6899
+
6900
+ <!-- Connecting dashed lines between columns -->
6901
+ @for (bar of computedBars(); track $index; let i = $index) {
6902
+ @if (i < computedBars().length - 1) {
6903
+ <line
6904
+ [attr.x1]="bar.x + bar.width"
6905
+ [attr.x2]="computedBars()[i+1].x"
6906
+ [attr.y1]="bar.connectY"
6907
+ [attr.y2]="bar.connectY"
6908
+ stroke="var(--ngx-chart-axis, #ced4da)"
6909
+ stroke-dasharray="3,3"
6910
+ stroke-width="1.5"
6911
+ />
6912
+ }
6913
+ }
6914
+
6915
+ <!-- Bars -->
6916
+ @for (bar of computedBars(); track $index; let i = $index) {
6917
+ <rect
6918
+ [attr.x]="bar.x"
6919
+ [attr.y]="bar.y"
6920
+ [attr.width]="bar.width"
6921
+ [attr.height]="bar.rectH"
6922
+ [attr.fill]="bar.fill"
6923
+ [attr.rx]="4"
6924
+ class="waterfall-bar"
6925
+ [class.hovered]="hoveredIndex() === i"
6926
+ (mouseenter)="onBarHover($event, bar, i)"
6927
+ />
6928
+ @if (showLabels() && bar.rectH > 14) {
6929
+ <text
6930
+ [attr.x]="bar.x + bar.width / 2"
6931
+ [attr.y]="bar.y + (bar.rectH / 2) + 4"
6932
+ text-anchor="middle"
6933
+ class="bar-value-label"
6934
+ >
6935
+ {{ bar.value > 0 ? '+' : '' }}{{ fmtNum(bar.value) }}
6936
+ </text>
6937
+ }
6938
+ }
6939
+
6940
+ <!-- Base axes borders -->
6941
+ <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
6942
+ <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
6943
+ </g>
6944
+ </svg>
6945
+
6946
+ <!-- Tooltip -->
6947
+ @if (tooltip(); as t) {
6948
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
6949
+ <div class="tooltip-header">{{ t.label }}</div>
6950
+ <div class="tooltip-body">
6951
+ <div class="tooltip-val">Change: <strong [style.color]="t.color">{{ t.value > 0 ? '+' : '' }}{{ fmtNum(t.value) }}</strong></div>
6952
+ <div class="tooltip-val">Running Balance: <strong>{{ fmtNum(t.balance) }}</strong></div>
6953
+ </div>
6954
+ </div>
6955
+ }
6956
+ </div>
6957
+ </div>
6958
+ `, isInline: true, styles: [":host{display:block;width:100%}.ngx-waterfall-chart{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif)}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}.waterfall-bar{cursor:pointer;transition:opacity .2s,filter .2s,stroke-width .2s;stroke:#fff;stroke-width:.5}.waterfall-bar.hovered{opacity:.95;stroke-width:1.5;filter:brightness(1.04) drop-shadow(0 4px 8px rgba(0,0,0,.12))}.bar-value-label{font-size:9px;fill:#fff;font-weight:600;pointer-events:none}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .12s cubic-bezier(.16,1,.3,1),top .12s cubic-bezier(.16,1,.3,1);font-family:inherit}.tooltip-header{font-weight:700;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:6px;margin-bottom:8px;color:#38bdf8;font-size:12.5px}.tooltip-body{display:flex;flex-direction:column;gap:5px}.tooltip-val{color:#f8fafccc}.tooltip-val strong{color:#f8fafc;font-family:monospace}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6959
+ }
6960
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: WaterfallChartComponent, decorators: [{
6961
+ type: Component,
6962
+ args: [{ selector: 'ngx-waterfall-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
6963
+ <div class="ngx-waterfall-chart" (mouseleave)="hoveredIndex.set(null); tooltip.set(null)">
6964
+ <div class="chart-svg-container" #container>
6965
+ <svg
6966
+ [attr.width]="'100%'"
6967
+ [attr.height]="height()"
6968
+ class="chart-svg"
6969
+ >
6970
+ <defs>
6971
+ <linearGradient id="waterfall-pos" x1="0" y1="0" x2="0" y2="1">
6972
+ <stop offset="0%" [attr.stop-color]="positiveColor()" stop-opacity="1"/>
6973
+ <stop offset="100%" [attr.stop-color]="positiveColor()" stop-opacity="0.75"/>
6974
+ </linearGradient>
6975
+ <linearGradient id="waterfall-neg" x1="0" y1="0" x2="0" y2="1">
6976
+ <stop offset="0%" [attr.stop-color]="negativeColor()" stop-opacity="1"/>
6977
+ <stop offset="100%" [attr.stop-color]="negativeColor()" stop-opacity="0.75"/>
6978
+ </linearGradient>
6979
+ <linearGradient id="waterfall-tot" x1="0" y1="0" x2="0" y2="1">
6980
+ <stop offset="0%" [attr.stop-color]="totalColor()" stop-opacity="1"/>
6981
+ <stop offset="100%" [attr.stop-color]="totalColor()" stop-opacity="0.75"/>
6982
+ </linearGradient>
6983
+ </defs>
6984
+ <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
6985
+ <!-- Grid Lines (Horizontal) -->
6986
+ @if (showGrid()) {
6987
+ @for (tick of yTicks(); track tick) {
6988
+ <line
6989
+ [attr.x1]="0"
6990
+ [attr.x2]="innerW()"
6991
+ [attr.y1]="yPos(tick)"
6992
+ [attr.y2]="yPos(tick)"
6993
+ stroke="var(--ngx-chart-grid, #ebedf0)"
6994
+ stroke-dasharray="3,3"
6995
+ />
6996
+ }
6997
+ }
6998
+
6999
+ <!-- Y-Axis Labels -->
7000
+ @for (tick of yTicks(); track tick) {
7001
+ <text
7002
+ x="-10"
7003
+ [attr.y]="yPos(tick) + 4"
7004
+ class="axis-label y"
7005
+ text-anchor="end"
7006
+ >{{ fmtNum(tick) }}</text>
7007
+ }
7008
+
7009
+ <!-- X-Axis Labels -->
7010
+ @for (bar of computedBars(); track $index; let i = $index) {
7011
+ <text
7012
+ [attr.x]="bar.x + bar.width / 2"
7013
+ [attr.y]="innerH() + 20"
7014
+ class="axis-label x"
7015
+ text-anchor="middle"
7016
+ >{{ bar.label }}</text>
7017
+ }
7018
+
7019
+ <!-- Connecting dashed lines between columns -->
7020
+ @for (bar of computedBars(); track $index; let i = $index) {
7021
+ @if (i < computedBars().length - 1) {
7022
+ <line
7023
+ [attr.x1]="bar.x + bar.width"
7024
+ [attr.x2]="computedBars()[i+1].x"
7025
+ [attr.y1]="bar.connectY"
7026
+ [attr.y2]="bar.connectY"
7027
+ stroke="var(--ngx-chart-axis, #ced4da)"
7028
+ stroke-dasharray="3,3"
7029
+ stroke-width="1.5"
7030
+ />
7031
+ }
7032
+ }
7033
+
7034
+ <!-- Bars -->
7035
+ @for (bar of computedBars(); track $index; let i = $index) {
7036
+ <rect
7037
+ [attr.x]="bar.x"
7038
+ [attr.y]="bar.y"
7039
+ [attr.width]="bar.width"
7040
+ [attr.height]="bar.rectH"
7041
+ [attr.fill]="bar.fill"
7042
+ [attr.rx]="4"
7043
+ class="waterfall-bar"
7044
+ [class.hovered]="hoveredIndex() === i"
7045
+ (mouseenter)="onBarHover($event, bar, i)"
7046
+ />
7047
+ @if (showLabels() && bar.rectH > 14) {
7048
+ <text
7049
+ [attr.x]="bar.x + bar.width / 2"
7050
+ [attr.y]="bar.y + (bar.rectH / 2) + 4"
7051
+ text-anchor="middle"
7052
+ class="bar-value-label"
7053
+ >
7054
+ {{ bar.value > 0 ? '+' : '' }}{{ fmtNum(bar.value) }}
7055
+ </text>
7056
+ }
7057
+ }
7058
+
7059
+ <!-- Base axes borders -->
7060
+ <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
7061
+ <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
7062
+ </g>
7063
+ </svg>
7064
+
7065
+ <!-- Tooltip -->
7066
+ @if (tooltip(); as t) {
7067
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
7068
+ <div class="tooltip-header">{{ t.label }}</div>
7069
+ <div class="tooltip-body">
7070
+ <div class="tooltip-val">Change: <strong [style.color]="t.color">{{ t.value > 0 ? '+' : '' }}{{ fmtNum(t.value) }}</strong></div>
7071
+ <div class="tooltip-val">Running Balance: <strong>{{ fmtNum(t.balance) }}</strong></div>
7072
+ </div>
7073
+ </div>
7074
+ }
7075
+ </div>
7076
+ </div>
7077
+ `, styles: [":host{display:block;width:100%}.ngx-waterfall-chart{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif)}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}.waterfall-bar{cursor:pointer;transition:opacity .2s,filter .2s,stroke-width .2s;stroke:#fff;stroke-width:.5}.waterfall-bar.hovered{opacity:.95;stroke-width:1.5;filter:brightness(1.04) drop-shadow(0 4px 8px rgba(0,0,0,.12))}.bar-value-label{font-size:9px;fill:#fff;font-weight:600;pointer-events:none}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-8px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:150px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .12s cubic-bezier(.16,1,.3,1),top .12s cubic-bezier(.16,1,.3,1);font-family:inherit}.tooltip-header{font-weight:700;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:6px;margin-bottom:8px;color:#38bdf8;font-size:12.5px}.tooltip-body{display:flex;flex-direction:column;gap:5px}.tooltip-val{color:#f8fafccc}.tooltip-val strong{color:#f8fafc;font-family:monospace}\n"] }]
7078
+ }] });
7079
+
7080
+ class BoxPlotChartComponent {
7081
+ PAD_LEFT = 52;
7082
+ PAD_TOP = 20;
7083
+ PAD_RIGHT = 24;
7084
+ PAD_BOTTOM = 36;
7085
+ data = input([]);
7086
+ height = input(300);
7087
+ showGrid = input(true);
7088
+ showLabels = input(true);
7089
+ // Styles
7090
+ color = input('#4f46e5'); // Primary Indigo
7091
+ fillColor = input('rgba(79, 70, 229, 0.12)'); // Translucent primary
7092
+ outlierColor = input('#ef4444'); // Red/Rose
7093
+ hoveredIndex = signal(null);
7094
+ tooltip = signal(null);
7095
+ container = viewChild('container');
7096
+ innerW = computed(() => {
7097
+ const el = this.container()?.nativeElement;
7098
+ const totalW = el ? el.getBoundingClientRect().width : 600;
7099
+ return Math.max(200, totalW - this.PAD_LEFT - this.PAD_RIGHT);
7100
+ });
7101
+ innerH = computed(() => this.height() - this.PAD_TOP - this.PAD_BOTTOM);
7102
+ // Range and Ticks bounds calculation
7103
+ yMin = computed(() => {
7104
+ const items = this.data();
7105
+ if (items.length === 0)
7106
+ return 0;
7107
+ const allVals = items.flatMap(item => [
7108
+ item.min,
7109
+ ...(item.outliers || [])
7110
+ ]);
7111
+ const minVal = Math.min(...allVals);
7112
+ return minVal < 0 ? minVal * 1.15 : minVal * 0.85;
7113
+ });
7114
+ yMax = computed(() => {
7115
+ const items = this.data();
7116
+ if (items.length === 0)
7117
+ return 100;
7118
+ const allVals = items.flatMap(item => [
7119
+ item.max,
7120
+ ...(item.outliers || [])
7121
+ ]);
7122
+ return Math.max(...allVals) * 1.15;
7123
+ });
7124
+ yTicks = computed(() => niceTicks(this.yMin(), this.yMax(), 5));
7125
+ // Box positions
7126
+ xPos(index) {
7127
+ const count = this.data().length || 1;
7128
+ const step = this.innerW() / count;
7129
+ return index * step + step * 0.2;
7130
+ }
7131
+ yPos(y) {
7132
+ return scale(y, this.yMin(), this.yMax(), this.innerH(), 0);
7133
+ }
7134
+ boxWidth() {
7135
+ const count = this.data().length || 1;
7136
+ return (this.innerW() / count) * 0.6;
7137
+ }
7138
+ capWidth() {
7139
+ return this.boxWidth() * 0.45;
7140
+ }
7141
+ computedBoxes = computed(() => {
7142
+ const items = this.data();
7143
+ const count = items.length;
7144
+ if (count === 0)
7145
+ return [];
7146
+ const width = this.boxWidth();
7147
+ return items.map((item, idx) => {
7148
+ const x = this.xPos(idx);
7149
+ const centerX = x + width / 2;
7150
+ const yMin = this.yPos(item.min);
7151
+ const yQ1 = this.yPos(item.q1);
7152
+ const yMedian = this.yPos(item.median);
7153
+ const yQ3 = this.yPos(item.q3);
7154
+ const yMax = this.yPos(item.max);
7155
+ const boxHeight = Math.abs(yQ1 - yQ3);
7156
+ const outlierPoints = (item.outliers || []).map(val => ({
7157
+ value: val,
7158
+ y: this.yPos(val)
7159
+ }));
7160
+ return {
7161
+ x,
7162
+ centerX,
7163
+ width,
7164
+ yMin,
7165
+ yQ1,
7166
+ yMedian,
7167
+ yQ3,
7168
+ yMax,
7169
+ boxHeight,
7170
+ outlierPoints,
7171
+ raw: item
7172
+ };
7173
+ });
7174
+ });
7175
+ onBoxHover(event, item, index) {
7176
+ this.hoveredIndex.set(index);
7177
+ const containerEl = this.container()?.nativeElement;
7178
+ if (!containerEl)
7179
+ return;
7180
+ const rect = containerEl.getBoundingClientRect();
7181
+ const tooltipX = event.clientX - rect.left;
7182
+ const tooltipY = event.clientY - rect.top;
7183
+ this.tooltip.set({
7184
+ x: tooltipX,
7185
+ y: tooltipY,
7186
+ label: item.label,
7187
+ min: item.min,
7188
+ q1: item.q1,
7189
+ median: item.median,
7190
+ q3: item.q3,
7191
+ max: item.max,
7192
+ isOutlier: false
7193
+ });
7194
+ }
7195
+ onOutlierHover(event, label, outlierVal) {
7196
+ const containerEl = this.container()?.nativeElement;
7197
+ if (!containerEl)
7198
+ return;
7199
+ const rect = containerEl.getBoundingClientRect();
7200
+ const tooltipX = event.clientX - rect.left;
7201
+ const tooltipY = event.clientY - rect.top;
7202
+ this.tooltip.set({
7203
+ x: tooltipX,
7204
+ y: tooltipY,
7205
+ label: `${label} outlier`,
7206
+ min: 0,
7207
+ q1: 0,
7208
+ median: 0,
7209
+ q3: 0,
7210
+ max: 0,
7211
+ isOutlier: true,
7212
+ outlierVal
7213
+ });
7214
+ }
7215
+ fmtNum = fmtNum;
7216
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: BoxPlotChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7217
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: BoxPlotChartComponent, isStandalone: true, selector: "ngx-box-plot-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showGrid: { classPropertyName: "showGrid", publicName: "showGrid", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, fillColor: { classPropertyName: "fillColor", publicName: "fillColor", isSignal: true, isRequired: false, transformFunction: null }, outlierColor: { classPropertyName: "outlierColor", publicName: "outlierColor", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, isSignal: true }], ngImport: i0, template: `
7218
+ <div class="ngx-box-plot-chart" (mouseleave)="hoveredIndex.set(null); tooltip.set(null)">
7219
+ <div class="chart-svg-container" #container>
7220
+ <svg
7221
+ [attr.width]="'100%'"
7222
+ [attr.height]="height()"
7223
+ class="chart-svg"
7224
+ >
7225
+ <defs>
7226
+ <linearGradient id="boxplot-grad" x1="0" y1="0" x2="0" y2="1">
7227
+ <stop offset="0%" [attr.stop-color]="color()" stop-opacity="0.32" />
7228
+ <stop offset="100%" [attr.stop-color]="color()" stop-opacity="0.08" />
7229
+ </linearGradient>
7230
+ </defs>
7231
+
7232
+ <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
7233
+ <!-- Grid Lines (Horizontal) -->
7234
+ @if (showGrid()) {
7235
+ @for (tick of yTicks(); track tick) {
7236
+ <line
7237
+ [attr.x1]="0"
7238
+ [attr.x2]="innerW()"
7239
+ [attr.y1]="yPos(tick)"
7240
+ [attr.y2]="yPos(tick)"
7241
+ stroke="var(--ngx-chart-grid, #ebedf0)"
7242
+ stroke-dasharray="3,3"
7243
+ />
7244
+ }
7245
+ }
7246
+
7247
+ <!-- Y-Axis Labels -->
7248
+ @for (tick of yTicks(); track tick) {
7249
+ <text
7250
+ x="-10"
7251
+ [attr.y]="yPos(tick) + 4"
7252
+ class="axis-label y"
7253
+ text-anchor="end"
7254
+ >{{ fmtNum(tick) }}</text>
7255
+ }
7256
+
7257
+ <!-- X-Axis Labels -->
7258
+ @for (item of data(); track $index; let i = $index) {
7259
+ <text
7260
+ [attr.x]="xPos(i) + boxWidth() / 2"
7261
+ [attr.y]="innerH() + 20"
7262
+ class="axis-label x"
7263
+ text-anchor="middle"
7264
+ >{{ item.label }}</text>
7265
+ }
7266
+
7267
+ <!-- Box Plot Elements -->
7268
+ @for (box of computedBoxes(); track $index; let i = $index) {
7269
+ <!-- Whiskers (Vertical Lines) -->
7270
+ <line
7271
+ [attr.x1]="box.centerX"
7272
+ [attr.x2]="box.centerX"
7273
+ [attr.y1]="box.yMin"
7274
+ [attr.y2]="box.yMax"
7275
+ [attr.stroke]="color()"
7276
+ stroke-width="1.5"
7277
+ class="whisker-line"
7278
+ />
7279
+
7280
+ <!-- Whisker Caps (Horizontal Lines) -->
7281
+ <line
7282
+ [attr.x1]="box.centerX - capWidth() / 2"
7283
+ [attr.x2]="box.centerX + capWidth() / 2"
7284
+ [attr.y1]="box.yMin"
7285
+ [attr.y2]="box.yMin"
7286
+ [attr.stroke]="color()"
7287
+ stroke-width="1.5"
7288
+ class="whisker-line"
7289
+ />
7290
+ <line
7291
+ [attr.x1]="box.centerX - capWidth() / 2"
7292
+ [attr.x2]="box.centerX + capWidth() / 2"
7293
+ [attr.y1]="box.yMax"
7294
+ [attr.y2]="box.yMax"
7295
+ [attr.stroke]="color()"
7296
+ stroke-width="1.5"
7297
+ class="whisker-line"
7298
+ />
7299
+
7300
+ <!-- Interquartile Box -->
7301
+ <rect
7302
+ [attr.x]="box.x"
7303
+ [attr.y]="box.yQ3"
7304
+ [attr.width]="box.width"
7305
+ [attr.height]="box.boxHeight"
7306
+ fill="url(#boxplot-grad)"
7307
+ [attr.stroke]="color()"
7308
+ stroke-width="2"
7309
+ [attr.rx]="4"
7310
+ class="boxplot-rect"
7311
+ [class.hovered]="hoveredIndex() === i"
7312
+ [style.transform-origin]="box.centerX + 'px ' + box.yMedian + 'px'"
7313
+ [style.animation-delay]="i * 0.05 + 's'"
7314
+ (mouseenter)="onBoxHover($event, box.raw, i)"
7315
+ (mousemove)="onBoxHover($event, box.raw, i)"
7316
+ />
7317
+
7318
+ <!-- Median line -->
7319
+ <line
7320
+ [attr.x1]="box.x"
7321
+ [attr.x2]="box.x + box.width"
7322
+ [attr.y1]="box.yMedian"
7323
+ [attr.y2]="box.yMedian"
7324
+ [attr.stroke]="color()"
7325
+ stroke-width="2.5"
7326
+ class="median-line"
7327
+ />
7328
+
7329
+ <!-- Outliers (plotted as circles) -->
7330
+ @for (outlier of box.outlierPoints; track $index) {
7331
+ <circle
7332
+ [attr.cx]="box.centerX"
7333
+ [attr.cy]="outlier.y"
7334
+ [attr.r]="3.5"
7335
+ [attr.fill]="outlierColor()"
7336
+ [attr.stroke]="'#ffffff'"
7337
+ stroke-width="1.2"
7338
+ class="outlier-dot"
7339
+ [style.transform-origin]="box.centerX + 'px ' + outlier.y + 'px'"
7340
+ (mouseenter)="onOutlierHover($event, box.raw.label, outlier.value)"
7341
+ (mousemove)="onOutlierHover($event, box.raw.label, outlier.value)"
7342
+ />
7343
+ }
7344
+ }
7345
+
7346
+ <!-- Base axes borders -->
7347
+ <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
7348
+ <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
7349
+ </g>
7350
+ </svg>
7351
+
7352
+ <!-- Tooltip -->
7353
+ @if (tooltip(); as t) {
7354
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
7355
+ <div class="tooltip-header">{{ t.label }}</div>
7356
+ <div class="tooltip-body">
7357
+ @if (t.isOutlier) {
7358
+ <div class="tooltip-val">
7359
+ <span>Outlier:</span>
7360
+ <strong>{{ fmtNum(t.outlierVal!) }}</strong>
7361
+ </div>
7362
+ } @else {
7363
+ <div class="tooltip-val">
7364
+ <span>Maximum:</span>
7365
+ <strong>{{ fmtNum(t.max) }}</strong>
7366
+ </div>
7367
+ <div class="tooltip-val">
7368
+ <span>Third Quartile (Q3):</span>
7369
+ <strong>{{ fmtNum(t.q3) }}</strong>
7370
+ </div>
7371
+ <div class="tooltip-val" style="color: #38bdf8;">
7372
+ <span>Median:</span>
7373
+ <strong>{{ fmtNum(t.median) }}</strong>
7374
+ </div>
7375
+ <div class="tooltip-val">
7376
+ <span>First Quartile (Q1):</span>
7377
+ <strong>{{ fmtNum(t.q1) }}</strong>
7378
+ </div>
7379
+ <div class="tooltip-val">
7380
+ <span>Minimum:</span>
7381
+ <strong>{{ fmtNum(t.min) }}</strong>
7382
+ </div>
7383
+ }
7384
+ </div>
7385
+ </div>
7386
+ }
7387
+ </div>
7388
+ </div>
7389
+ `, isInline: true, styles: [":host{display:block;width:100%}.ngx-box-plot-chart{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif)}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}@keyframes boxPlotGrow{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}.boxplot-rect{cursor:pointer;transition:opacity .2s,fill .2s,stroke-width .2s,filter .2s;animation:boxPlotGrow .6s cubic-bezier(.16,1,.3,1) both}.boxplot-rect:hover,.boxplot-rect.hovered{filter:brightness(1.05) drop-shadow(0 4px 8px rgba(0,0,0,.15));stroke-width:2.5px}@keyframes whiskerFade{0%{opacity:0}to{opacity:1}}.whisker-line,.median-line{animation:whiskerFade .6s ease-out .2s both}@keyframes outlierPop{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}.outlier-dot{cursor:crosshair;transition:r .2s cubic-bezier(.16,1,.3,1),fill .2s;animation:outlierPop .4s cubic-bezier(.16,1,.3,1) .5s both}.outlier-dot:hover{r:5.5px;fill:#ef4444}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;z-index:100;min-width:155px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tooltip-header{font-weight:700;margin-bottom:6px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tooltip-body{display:flex;flex-direction:column;gap:4px}.tooltip-val{display:flex;justify-content:space-between;gap:16px;color:#f8fafcd9}.tooltip-val strong{color:#f8fafc;font-family:monospace;font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
7390
+ }
7391
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: BoxPlotChartComponent, decorators: [{
7392
+ type: Component,
7393
+ args: [{ selector: 'ngx-box-plot-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
7394
+ <div class="ngx-box-plot-chart" (mouseleave)="hoveredIndex.set(null); tooltip.set(null)">
7395
+ <div class="chart-svg-container" #container>
7396
+ <svg
7397
+ [attr.width]="'100%'"
7398
+ [attr.height]="height()"
7399
+ class="chart-svg"
7400
+ >
7401
+ <defs>
7402
+ <linearGradient id="boxplot-grad" x1="0" y1="0" x2="0" y2="1">
7403
+ <stop offset="0%" [attr.stop-color]="color()" stop-opacity="0.32" />
7404
+ <stop offset="100%" [attr.stop-color]="color()" stop-opacity="0.08" />
7405
+ </linearGradient>
7406
+ </defs>
7407
+
7408
+ <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
7409
+ <!-- Grid Lines (Horizontal) -->
7410
+ @if (showGrid()) {
7411
+ @for (tick of yTicks(); track tick) {
7412
+ <line
7413
+ [attr.x1]="0"
7414
+ [attr.x2]="innerW()"
7415
+ [attr.y1]="yPos(tick)"
7416
+ [attr.y2]="yPos(tick)"
7417
+ stroke="var(--ngx-chart-grid, #ebedf0)"
7418
+ stroke-dasharray="3,3"
7419
+ />
7420
+ }
7421
+ }
7422
+
7423
+ <!-- Y-Axis Labels -->
7424
+ @for (tick of yTicks(); track tick) {
7425
+ <text
7426
+ x="-10"
7427
+ [attr.y]="yPos(tick) + 4"
7428
+ class="axis-label y"
7429
+ text-anchor="end"
7430
+ >{{ fmtNum(tick) }}</text>
7431
+ }
7432
+
7433
+ <!-- X-Axis Labels -->
7434
+ @for (item of data(); track $index; let i = $index) {
7435
+ <text
7436
+ [attr.x]="xPos(i) + boxWidth() / 2"
7437
+ [attr.y]="innerH() + 20"
7438
+ class="axis-label x"
7439
+ text-anchor="middle"
7440
+ >{{ item.label }}</text>
7441
+ }
7442
+
7443
+ <!-- Box Plot Elements -->
7444
+ @for (box of computedBoxes(); track $index; let i = $index) {
7445
+ <!-- Whiskers (Vertical Lines) -->
7446
+ <line
7447
+ [attr.x1]="box.centerX"
7448
+ [attr.x2]="box.centerX"
7449
+ [attr.y1]="box.yMin"
7450
+ [attr.y2]="box.yMax"
7451
+ [attr.stroke]="color()"
7452
+ stroke-width="1.5"
7453
+ class="whisker-line"
7454
+ />
7455
+
7456
+ <!-- Whisker Caps (Horizontal Lines) -->
7457
+ <line
7458
+ [attr.x1]="box.centerX - capWidth() / 2"
7459
+ [attr.x2]="box.centerX + capWidth() / 2"
7460
+ [attr.y1]="box.yMin"
7461
+ [attr.y2]="box.yMin"
7462
+ [attr.stroke]="color()"
7463
+ stroke-width="1.5"
7464
+ class="whisker-line"
7465
+ />
7466
+ <line
7467
+ [attr.x1]="box.centerX - capWidth() / 2"
7468
+ [attr.x2]="box.centerX + capWidth() / 2"
7469
+ [attr.y1]="box.yMax"
7470
+ [attr.y2]="box.yMax"
7471
+ [attr.stroke]="color()"
7472
+ stroke-width="1.5"
7473
+ class="whisker-line"
7474
+ />
7475
+
7476
+ <!-- Interquartile Box -->
7477
+ <rect
7478
+ [attr.x]="box.x"
7479
+ [attr.y]="box.yQ3"
7480
+ [attr.width]="box.width"
7481
+ [attr.height]="box.boxHeight"
7482
+ fill="url(#boxplot-grad)"
7483
+ [attr.stroke]="color()"
7484
+ stroke-width="2"
7485
+ [attr.rx]="4"
7486
+ class="boxplot-rect"
7487
+ [class.hovered]="hoveredIndex() === i"
7488
+ [style.transform-origin]="box.centerX + 'px ' + box.yMedian + 'px'"
7489
+ [style.animation-delay]="i * 0.05 + 's'"
7490
+ (mouseenter)="onBoxHover($event, box.raw, i)"
7491
+ (mousemove)="onBoxHover($event, box.raw, i)"
7492
+ />
7493
+
7494
+ <!-- Median line -->
7495
+ <line
7496
+ [attr.x1]="box.x"
7497
+ [attr.x2]="box.x + box.width"
7498
+ [attr.y1]="box.yMedian"
7499
+ [attr.y2]="box.yMedian"
7500
+ [attr.stroke]="color()"
7501
+ stroke-width="2.5"
7502
+ class="median-line"
7503
+ />
7504
+
7505
+ <!-- Outliers (plotted as circles) -->
7506
+ @for (outlier of box.outlierPoints; track $index) {
7507
+ <circle
7508
+ [attr.cx]="box.centerX"
7509
+ [attr.cy]="outlier.y"
7510
+ [attr.r]="3.5"
7511
+ [attr.fill]="outlierColor()"
7512
+ [attr.stroke]="'#ffffff'"
7513
+ stroke-width="1.2"
7514
+ class="outlier-dot"
7515
+ [style.transform-origin]="box.centerX + 'px ' + outlier.y + 'px'"
7516
+ (mouseenter)="onOutlierHover($event, box.raw.label, outlier.value)"
7517
+ (mousemove)="onOutlierHover($event, box.raw.label, outlier.value)"
7518
+ />
7519
+ }
7520
+ }
7521
+
7522
+ <!-- Base axes borders -->
7523
+ <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
7524
+ <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
7525
+ </g>
7526
+ </svg>
7527
+
7528
+ <!-- Tooltip -->
7529
+ @if (tooltip(); as t) {
7530
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
7531
+ <div class="tooltip-header">{{ t.label }}</div>
7532
+ <div class="tooltip-body">
7533
+ @if (t.isOutlier) {
7534
+ <div class="tooltip-val">
7535
+ <span>Outlier:</span>
7536
+ <strong>{{ fmtNum(t.outlierVal!) }}</strong>
7537
+ </div>
7538
+ } @else {
7539
+ <div class="tooltip-val">
7540
+ <span>Maximum:</span>
7541
+ <strong>{{ fmtNum(t.max) }}</strong>
7542
+ </div>
7543
+ <div class="tooltip-val">
7544
+ <span>Third Quartile (Q3):</span>
7545
+ <strong>{{ fmtNum(t.q3) }}</strong>
7546
+ </div>
7547
+ <div class="tooltip-val" style="color: #38bdf8;">
7548
+ <span>Median:</span>
7549
+ <strong>{{ fmtNum(t.median) }}</strong>
7550
+ </div>
7551
+ <div class="tooltip-val">
7552
+ <span>First Quartile (Q1):</span>
7553
+ <strong>{{ fmtNum(t.q1) }}</strong>
7554
+ </div>
7555
+ <div class="tooltip-val">
7556
+ <span>Minimum:</span>
7557
+ <strong>{{ fmtNum(t.min) }}</strong>
7558
+ </div>
7559
+ }
7560
+ </div>
7561
+ </div>
7562
+ }
7563
+ </div>
7564
+ </div>
7565
+ `, styles: [":host{display:block;width:100%}.ngx-box-plot-chart{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif)}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}@keyframes boxPlotGrow{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}.boxplot-rect{cursor:pointer;transition:opacity .2s,fill .2s,stroke-width .2s,filter .2s;animation:boxPlotGrow .6s cubic-bezier(.16,1,.3,1) both}.boxplot-rect:hover,.boxplot-rect.hovered{filter:brightness(1.05) drop-shadow(0 4px 8px rgba(0,0,0,.15));stroke-width:2.5px}@keyframes whiskerFade{0%{opacity:0}to{opacity:1}}.whisker-line,.median-line{animation:whiskerFade .6s ease-out .2s both}@keyframes outlierPop{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}.outlier-dot{cursor:crosshair;transition:r .2s cubic-bezier(.16,1,.3,1),fill .2s;animation:outlierPop .4s cubic-bezier(.16,1,.3,1) .5s both}.outlier-dot:hover{r:5.5px;fill:#ef4444}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;z-index:100;min-width:155px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tooltip-header{font-weight:700;margin-bottom:6px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tooltip-body{display:flex;flex-direction:column;gap:4px}.tooltip-val{display:flex;justify-content:space-between;gap:16px;color:#f8fafcd9}.tooltip-val strong{color:#f8fafc;font-family:monospace;font-weight:700}\n"] }]
7566
+ }] });
7567
+
7568
+ class RadialBarChartComponent {
7569
+ data = input([]);
7570
+ height = input(300);
7571
+ showLegend = input(true);
7572
+ // Configuration properties
7573
+ strokeWidth = input(10);
7574
+ ringGap = input(4);
7575
+ colors = input(CHART_COLORS);
7576
+ hoveredIndex = signal(null);
7577
+ tooltip = signal(null);
7578
+ tooltipX = signal(0);
7579
+ tooltipY = signal(0);
7580
+ animateState = signal(false);
7581
+ size = computed(() => this.height());
7582
+ center = computed(() => this.size() / 2);
7583
+ constructor() {
7584
+ setTimeout(() => this.animateState.set(true), 50);
7585
+ }
7586
+ // Ring properties
7587
+ computedRings = computed(() => {
7588
+ const raw = this.data();
7589
+ const count = raw.length;
7590
+ const centerPt = this.center();
7591
+ const ringW = this.strokeWidth();
7592
+ const gap = this.ringGap();
7593
+ // Start radii calculation from the outside inwards
7594
+ // Max radius leaves padding on outside
7595
+ const maxRadius = centerPt - ringW - 4;
7596
+ return raw.map((item, idx) => {
7597
+ // Offset outwards to inwards
7598
+ const r = maxRadius - idx * (ringW + gap);
7599
+ const pct = Math.min(100, Math.max(0, Math.round((item.value / item.max) * 100)));
7600
+ const color = item.color || this.colors()[idx % this.colors().length];
7601
+ // Circular arc math
7602
+ const C = 2 * Math.PI * r;
7603
+ // dasharray structure: "arcLength, circumference"
7604
+ const arcLength = (pct / 100) * C;
7605
+ const dashArray = `${arcLength}, ${C}`;
7606
+ return {
7607
+ r,
7608
+ pct,
7609
+ color,
7610
+ dashArray,
7611
+ circumference: C,
7612
+ label: item.label,
7613
+ value: item.value,
7614
+ max: item.max,
7615
+ raw: item
7616
+ };
7617
+ });
7618
+ });
7619
+ // Calculate average percentage of completion
7620
+ avgPct = computed(() => {
7621
+ const raw = this.data();
7622
+ if (raw.length === 0)
7623
+ return 0;
7624
+ const sum = raw.reduce((acc, curr) => acc + (curr.value / curr.max), 0);
7625
+ return Math.round((sum / raw.length) * 100);
7626
+ });
7627
+ onRingHover(item, index) {
7628
+ this.hoveredIndex.set(index);
7629
+ const ring = this.computedRings()[index];
7630
+ if (ring) {
7631
+ this.tooltip.set(ring);
7632
+ }
7633
+ }
7634
+ onRingMouseMove(event) {
7635
+ const el = event.currentTarget;
7636
+ const container = el.closest('.ngx-radial-bar-chart');
7637
+ if (container) {
7638
+ const rect = container.getBoundingClientRect();
7639
+ this.tooltipX.set(event.clientX - rect.left);
7640
+ this.tooltipY.set(event.clientY - rect.top);
7641
+ }
7642
+ }
7643
+ onMouseLeave() {
7644
+ this.hoveredIndex.set(null);
7645
+ this.tooltip.set(null);
7646
+ }
7647
+ fmtNum = fmtNum;
7648
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: RadialBarChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7649
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: RadialBarChartComponent, isStandalone: true, selector: "ngx-radial-bar-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, ringGap: { classPropertyName: "ringGap", publicName: "ringGap", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7650
+ <div class="ngx-radial-bar-chart" (mouseleave)="onMouseLeave()">
7651
+ <div class="chart-layout">
7652
+ <!-- SVG Concentric Circles -->
7653
+ <div class="radial-visual">
7654
+ <svg
7655
+ [attr.width]="height()"
7656
+ [attr.height]="height()"
7657
+ [attr.viewBox]="'0 0 ' + size() + ' ' + size()"
7658
+ class="radial-svg"
7659
+ >
7660
+ <defs>
7661
+ @for (ring of computedRings(); track $index; let i = $index) {
7662
+ <linearGradient [id]="'radial-grad-' + i" x1="0%" y1="0%" x2="100%" y2="100%">
7663
+ <stop offset="0%" [attr.stop-color]="ring.color" />
7664
+ <stop offset="100%" [attr.stop-color]="ring.color" stop-opacity="0.6" />
7665
+ </linearGradient>
7666
+ }
7667
+ </defs>
7668
+ <!-- Rotate group by -90deg so rings start at 12 o'clock -->
7669
+ <g [attr.transform]="'translate(' + center() + ',' + center() + ') rotate(-90)'">
7670
+ @for (ring of computedRings(); track $index; let i = $index) {
7671
+ <!-- Background track ring -->
7672
+ <circle
7673
+ cx="0"
7674
+ cy="0"
7675
+ [attr.r]="ring.r"
7676
+ fill="none"
7677
+ [attr.stroke]="ring.color"
7678
+ stroke-opacity="0.08"
7679
+ [attr.stroke-width]="strokeWidth()"
7680
+ />
7681
+
7682
+ <!-- Active progress ring -->
7683
+ <circle
7684
+ cx="0"
7685
+ cy="0"
7686
+ [attr.r]="ring.r"
7687
+ fill="none"
7688
+ [attr.stroke]="'url(#radial-grad-' + i + ')'"
7689
+ [attr.stroke-width]="hoveredIndex() === i ? strokeWidth() + 3 : strokeWidth()"
7690
+ [attr.stroke-dasharray]="ring.dashArray"
7691
+ [attr.stroke-dashoffset]="animateState() ? 0 : ring.circumference"
7692
+ stroke-linecap="round"
7693
+ class="progress-ring"
7694
+ [class.hovered]="hoveredIndex() === i"
7695
+ (mouseenter)="onRingHover(ring.raw, i)"
7696
+ (mousemove)="onRingMouseMove($event)"
7697
+ />
7698
+ }
7699
+ </g>
7700
+ </svg>
7701
+
7702
+ <!-- Inside Center Details (Hover/Selected summary) -->
7703
+ <div class="center-content">
7704
+ @if (hoveredIndex() !== null) {
7705
+ @if (computedRings()[hoveredIndex()!]; as active) {
7706
+ <span class="center-label">{{ active.label }}</span>
7707
+ <span class="center-value" [style.color]="active.color">
7708
+ {{ active.pct }}%
7709
+ </span>
7710
+ <span class="center-sublabel">
7711
+ {{ fmtNum(active.value) }} / {{ fmtNum(active.max) }}
7712
+ </span>
7713
+ }
7714
+ } @else if (data().length > 0) {
7715
+ <span class="center-label">Average</span>
7716
+ <span class="center-value">{{ avgPct() }}%</span>
7717
+ <span class="center-sublabel">Completed</span>
7718
+ }
7719
+ </div>
7720
+ </div>
7721
+
7722
+ <!-- Legend / List -->
7723
+ @if (showLegend() && data().length > 0) {
7724
+ <div class="radial-legend">
7725
+ @for (ring of computedRings(); track $index; let i = $index) {
7726
+ <div
7727
+ class="legend-item"
7728
+ [class.active]="hoveredIndex() === i"
7729
+ (mouseenter)="hoveredIndex.set(i)"
7730
+ (mouseleave)="hoveredIndex.set(null)"
7731
+ >
7732
+ <span class="legend-color-dot" [style.background]="ring.color"></span>
7733
+ <div class="legend-content">
7734
+ <span class="legend-title">{{ ring.label }}</span>
7735
+ <div class="legend-metrics">
7736
+ <span class="metric-value">{{ ring.pct }}%</span>
7737
+ </div>
7738
+ </div>
7739
+ </div>
7740
+ }
7741
+ </div>
7742
+ }
7743
+ </div>
7744
+
7745
+ <!-- Glassmorphic Tooltip -->
7746
+ @if (tooltip() && hoveredIndex() !== null) {
7747
+ <div
7748
+ class="chart-tooltip"
7749
+ [style.left.px]="tooltipX()"
7750
+ [style.top.px]="tooltipY()"
7751
+ >
7752
+ <div class="tt-cat">{{ tooltip().label }}</div>
7753
+ <div class="tt-row">
7754
+ <span class="tt-dot" [style.background]="tooltip().color"></span>
7755
+ <span class="tt-name">Progress</span>
7756
+ <span class="tt-val">{{ tooltip().pct }}%</span>
7757
+ </div>
7758
+ <div class="tt-row">
7759
+ <span class="tt-dot" style="background: transparent;"></span>
7760
+ <span class="tt-name">Value</span>
7761
+ <span class="tt-val">{{ fmtNum(tooltip().value) }} / {{ fmtNum(tooltip().max) }}</span>
7762
+ </div>
7763
+ </div>
7764
+ }
7765
+ </div>
7766
+ `, isInline: true, styles: [":host{display:block}.ngx-radial-bar-chart{background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif);position:relative}.chart-layout{display:flex;align-items:center;justify-content:center;gap:24px;flex-wrap:wrap}.radial-visual{position:relative;display:flex;align-items:center;justify-content:center}.radial-svg{display:block}.progress-ring{cursor:pointer;transition:stroke-width .3s cubic-bezier(.16,1,.3,1),stroke-dashoffset 1.2s cubic-bezier(.16,1,.3,1),filter .3s ease,opacity .2s}.progress-ring.hovered{filter:drop-shadow(0 0 6px rgba(0,0,0,.15))}.center-content{position:absolute;display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none;text-align:center}.center-label{font-size:11px;font-weight:600;color:#64748b;text-transform:uppercase;letter-spacing:.5px}.center-value{font-size:24px;font-weight:800;color:#1e293b;line-height:1.1;margin:2px 0}.center-sublabel{font-size:10px;color:#94a3b8}.radial-legend{display:flex;flex-direction:column;gap:6px;min-width:150px}.legend-item{display:flex;align-items:center;gap:10px;padding:6px 12px;border-radius:8px;border:1px solid transparent;transition:all .2s;cursor:pointer}.legend-item:hover,.legend-item.active{background:var(--ngx-chart-grid, #f8fafc);border-color:var(--ngx-chart-grid, #e2e8f0)}.legend-color-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0}.legend-content{flex:1;display:flex;justify-content:space-between;align-items:center;gap:12px}.legend-title{font-size:12px;font-weight:600;color:#475569}.metric-value{font-size:12px;font-weight:700;color:#1e293b}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:160px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
7767
+ }
7768
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: RadialBarChartComponent, decorators: [{
7769
+ type: Component,
7770
+ args: [{ selector: 'ngx-radial-bar-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
7771
+ <div class="ngx-radial-bar-chart" (mouseleave)="onMouseLeave()">
7772
+ <div class="chart-layout">
7773
+ <!-- SVG Concentric Circles -->
7774
+ <div class="radial-visual">
7775
+ <svg
7776
+ [attr.width]="height()"
7777
+ [attr.height]="height()"
7778
+ [attr.viewBox]="'0 0 ' + size() + ' ' + size()"
7779
+ class="radial-svg"
7780
+ >
7781
+ <defs>
7782
+ @for (ring of computedRings(); track $index; let i = $index) {
7783
+ <linearGradient [id]="'radial-grad-' + i" x1="0%" y1="0%" x2="100%" y2="100%">
7784
+ <stop offset="0%" [attr.stop-color]="ring.color" />
7785
+ <stop offset="100%" [attr.stop-color]="ring.color" stop-opacity="0.6" />
7786
+ </linearGradient>
7787
+ }
7788
+ </defs>
7789
+ <!-- Rotate group by -90deg so rings start at 12 o'clock -->
7790
+ <g [attr.transform]="'translate(' + center() + ',' + center() + ') rotate(-90)'">
7791
+ @for (ring of computedRings(); track $index; let i = $index) {
7792
+ <!-- Background track ring -->
7793
+ <circle
7794
+ cx="0"
7795
+ cy="0"
7796
+ [attr.r]="ring.r"
7797
+ fill="none"
7798
+ [attr.stroke]="ring.color"
7799
+ stroke-opacity="0.08"
7800
+ [attr.stroke-width]="strokeWidth()"
7801
+ />
7802
+
7803
+ <!-- Active progress ring -->
7804
+ <circle
7805
+ cx="0"
7806
+ cy="0"
7807
+ [attr.r]="ring.r"
7808
+ fill="none"
7809
+ [attr.stroke]="'url(#radial-grad-' + i + ')'"
7810
+ [attr.stroke-width]="hoveredIndex() === i ? strokeWidth() + 3 : strokeWidth()"
7811
+ [attr.stroke-dasharray]="ring.dashArray"
7812
+ [attr.stroke-dashoffset]="animateState() ? 0 : ring.circumference"
7813
+ stroke-linecap="round"
7814
+ class="progress-ring"
7815
+ [class.hovered]="hoveredIndex() === i"
7816
+ (mouseenter)="onRingHover(ring.raw, i)"
7817
+ (mousemove)="onRingMouseMove($event)"
7818
+ />
7819
+ }
7820
+ </g>
7821
+ </svg>
7822
+
7823
+ <!-- Inside Center Details (Hover/Selected summary) -->
7824
+ <div class="center-content">
7825
+ @if (hoveredIndex() !== null) {
7826
+ @if (computedRings()[hoveredIndex()!]; as active) {
7827
+ <span class="center-label">{{ active.label }}</span>
7828
+ <span class="center-value" [style.color]="active.color">
7829
+ {{ active.pct }}%
7830
+ </span>
7831
+ <span class="center-sublabel">
7832
+ {{ fmtNum(active.value) }} / {{ fmtNum(active.max) }}
7833
+ </span>
7834
+ }
7835
+ } @else if (data().length > 0) {
7836
+ <span class="center-label">Average</span>
7837
+ <span class="center-value">{{ avgPct() }}%</span>
7838
+ <span class="center-sublabel">Completed</span>
7839
+ }
7840
+ </div>
7841
+ </div>
7842
+
7843
+ <!-- Legend / List -->
7844
+ @if (showLegend() && data().length > 0) {
7845
+ <div class="radial-legend">
7846
+ @for (ring of computedRings(); track $index; let i = $index) {
7847
+ <div
7848
+ class="legend-item"
7849
+ [class.active]="hoveredIndex() === i"
7850
+ (mouseenter)="hoveredIndex.set(i)"
7851
+ (mouseleave)="hoveredIndex.set(null)"
7852
+ >
7853
+ <span class="legend-color-dot" [style.background]="ring.color"></span>
7854
+ <div class="legend-content">
7855
+ <span class="legend-title">{{ ring.label }}</span>
7856
+ <div class="legend-metrics">
7857
+ <span class="metric-value">{{ ring.pct }}%</span>
7858
+ </div>
7859
+ </div>
7860
+ </div>
7861
+ }
7862
+ </div>
7863
+ }
7864
+ </div>
7865
+
7866
+ <!-- Glassmorphic Tooltip -->
7867
+ @if (tooltip() && hoveredIndex() !== null) {
7868
+ <div
7869
+ class="chart-tooltip"
7870
+ [style.left.px]="tooltipX()"
7871
+ [style.top.px]="tooltipY()"
7872
+ >
7873
+ <div class="tt-cat">{{ tooltip().label }}</div>
7874
+ <div class="tt-row">
7875
+ <span class="tt-dot" [style.background]="tooltip().color"></span>
7876
+ <span class="tt-name">Progress</span>
7877
+ <span class="tt-val">{{ tooltip().pct }}%</span>
7878
+ </div>
7879
+ <div class="tt-row">
7880
+ <span class="tt-dot" style="background: transparent;"></span>
7881
+ <span class="tt-name">Value</span>
7882
+ <span class="tt-val">{{ fmtNum(tooltip().value) }} / {{ fmtNum(tooltip().max) }}</span>
7883
+ </div>
7884
+ </div>
7885
+ }
7886
+ </div>
7887
+ `, styles: [":host{display:block}.ngx-radial-bar-chart{background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif);position:relative}.chart-layout{display:flex;align-items:center;justify-content:center;gap:24px;flex-wrap:wrap}.radial-visual{position:relative;display:flex;align-items:center;justify-content:center}.radial-svg{display:block}.progress-ring{cursor:pointer;transition:stroke-width .3s cubic-bezier(.16,1,.3,1),stroke-dashoffset 1.2s cubic-bezier(.16,1,.3,1),filter .3s ease,opacity .2s}.progress-ring.hovered{filter:drop-shadow(0 0 6px rgba(0,0,0,.15))}.center-content{position:absolute;display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none;text-align:center}.center-label{font-size:11px;font-weight:600;color:#64748b;text-transform:uppercase;letter-spacing:.5px}.center-value{font-size:24px;font-weight:800;color:#1e293b;line-height:1.1;margin:2px 0}.center-sublabel{font-size:10px;color:#94a3b8}.radial-legend{display:flex;flex-direction:column;gap:6px;min-width:150px}.legend-item{display:flex;align-items:center;gap:10px;padding:6px 12px;border-radius:8px;border:1px solid transparent;transition:all .2s;cursor:pointer}.legend-item:hover,.legend-item.active{background:var(--ngx-chart-grid, #f8fafc);border-color:var(--ngx-chart-grid, #e2e8f0)}.legend-color-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0}.legend-content{flex:1;display:flex;justify-content:space-between;align-items:center;gap:12px}.legend-title{font-size:12px;font-weight:600;color:#475569}.metric-value{font-size:12px;font-weight:700;color:#1e293b}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:12px;min-width:160px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);z-index:100;transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tt-row{display:flex;align-items:center;gap:8px;margin-top:4px}.tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.tt-name{color:#f8fafccc;flex:1}.tt-val{font-weight:700;font-family:monospace}\n"] }]
7888
+ }], ctorParameters: () => [] });
7889
+
7890
+ class CandlestickChartComponent {
7891
+ PAD_LEFT = 52;
7892
+ PAD_TOP = 20;
7893
+ PAD_RIGHT = 24;
7894
+ PAD_BOTTOM = 36;
7895
+ data = input([]);
7896
+ height = input(300);
7897
+ showGrid = input(true);
7898
+ showLabels = input(true);
7899
+ // Bullish/Bearish colors
7900
+ bullishColor = input('#10b981'); // Emerald/Green
7901
+ bearishColor = input('#ef4444'); // Rose/Red
7902
+ hoveredIndex = signal(null);
7903
+ tooltip = signal(null);
7904
+ container = viewChild('container');
7905
+ innerW = computed(() => {
7906
+ const el = this.container()?.nativeElement;
7907
+ const totalW = el ? el.getBoundingClientRect().width : 600;
7908
+ return Math.max(200, totalW - this.PAD_LEFT - this.PAD_RIGHT);
7909
+ });
7910
+ innerH = computed(() => this.height() - this.PAD_TOP - this.PAD_BOTTOM);
7911
+ // Range bounds calculation
7912
+ yMin = computed(() => {
7913
+ const items = this.data();
7914
+ if (items.length === 0)
7915
+ return 0;
7916
+ const lows = items.map(d => d.low);
7917
+ return Math.min(...lows) * 0.98; // 2% padding below
7918
+ });
7919
+ yMax = computed(() => {
7920
+ const items = this.data();
7921
+ if (items.length === 0)
7922
+ return 100;
7923
+ const highs = items.map(d => d.high);
7924
+ return Math.max(...highs) * 1.02; // 2% padding above
7925
+ });
7926
+ yTicks = computed(() => niceTicks(this.yMin(), this.yMax(), 5));
7927
+ // Category scaling positions
7928
+ xPos(index) {
7929
+ const count = this.data().length || 1;
7930
+ const step = this.innerW() / count;
7931
+ return index * step + step * 0.15;
7932
+ }
7933
+ yPos(y) {
7934
+ return scale(y, this.yMin(), this.yMax(), this.innerH(), 0);
7935
+ }
7936
+ candleWidth() {
7937
+ const count = this.data().length || 1;
7938
+ return (this.innerW() / count) * 0.7; // 70% width
7939
+ }
7940
+ computedCandles = computed(() => {
7941
+ const items = this.data();
7942
+ const count = items.length;
7943
+ if (count === 0)
7944
+ return [];
7945
+ const width = this.candleWidth();
7946
+ return items.map((item, idx) => {
7947
+ const x = this.xPos(idx);
7948
+ const centerX = x + width / 2;
7949
+ const yOpen = this.yPos(item.open);
7950
+ const yClose = this.yPos(item.close);
7951
+ const yHigh = this.yPos(item.high);
7952
+ const yLow = this.yPos(item.low);
7953
+ const y = Math.min(yOpen, yClose);
7954
+ const rectH = Math.max(2, Math.abs(yOpen - yClose));
7955
+ const isBullish = item.close >= item.open;
7956
+ const color = isBullish ? this.bullishColor() : this.bearishColor();
7957
+ return {
7958
+ x,
7959
+ centerX,
7960
+ width,
7961
+ yHigh,
7962
+ yLow,
7963
+ yOpen,
7964
+ yClose,
7965
+ y,
7966
+ rectH,
7967
+ color,
7968
+ isBullish,
7969
+ raw: item
7970
+ };
7971
+ });
7972
+ });
7973
+ onCandleHover(event, item, index) {
7974
+ this.hoveredIndex.set(index);
7975
+ const containerEl = this.container()?.nativeElement;
7976
+ if (!containerEl)
7977
+ return;
7978
+ const rect = containerEl.getBoundingClientRect();
7979
+ const tooltipX = event.clientX - rect.left;
7980
+ const tooltipY = event.clientY - rect.top;
7981
+ const isBullish = item.close >= item.open;
7982
+ const change = item.close - item.open;
7983
+ const changePct = ((change / item.open) * 100).toFixed(2) + '%';
7984
+ this.tooltip.set({
7985
+ x: tooltipX,
7986
+ y: tooltipY,
7987
+ date: item.date,
7988
+ open: item.open,
7989
+ high: item.high,
7990
+ low: item.low,
7991
+ close: item.close,
7992
+ direction: isBullish ? 'Bullish' : 'Bearish',
7993
+ changePct
7994
+ });
7995
+ }
7996
+ formatDate(d) {
7997
+ if (d instanceof Date) {
7998
+ return d.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
7999
+ }
8000
+ return d;
8001
+ }
8002
+ fmtNum = fmtNum;
8003
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: CandlestickChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
8004
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: CandlestickChartComponent, isStandalone: true, selector: "ngx-candlestick-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, showGrid: { classPropertyName: "showGrid", publicName: "showGrid", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, bullishColor: { classPropertyName: "bullishColor", publicName: "bullishColor", isSignal: true, isRequired: false, transformFunction: null }, bearishColor: { classPropertyName: "bearishColor", publicName: "bearishColor", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, isSignal: true }], ngImport: i0, template: `
8005
+ <div class="ngx-candlestick-chart" (mouseleave)="hoveredIndex.set(null); tooltip.set(null)">
8006
+ <div class="chart-svg-container" #container>
8007
+ <svg
8008
+ [attr.width]="'100%'"
8009
+ [attr.height]="height()"
8010
+ class="chart-svg"
8011
+ >
8012
+ <defs>
8013
+ <linearGradient id="candle-bullish-grad" x1="0" y1="0" x2="0" y2="1">
8014
+ <stop offset="0%" [attr.stop-color]="bullishColor()" />
8015
+ <stop offset="100%" [attr.stop-color]="bullishColor()" stop-opacity="0.8" />
8016
+ </linearGradient>
8017
+ <linearGradient id="candle-bearish-grad" x1="0" y1="0" x2="0" y2="1">
8018
+ <stop offset="0%" [attr.stop-color]="bearishColor()" />
8019
+ <stop offset="100%" [attr.stop-color]="bearishColor()" stop-opacity="0.8" />
8020
+ </linearGradient>
8021
+ </defs>
8022
+
8023
+ <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
8024
+ <!-- Grid Lines (Horizontal) -->
8025
+ @if (showGrid()) {
8026
+ @for (tick of yTicks(); track tick) {
8027
+ <line
8028
+ [attr.x1]="0"
8029
+ [attr.x2]="innerW()"
8030
+ [attr.y1]="yPos(tick)"
8031
+ [attr.y2]="yPos(tick)"
8032
+ stroke="var(--ngx-chart-grid, #ebedf0)"
8033
+ stroke-dasharray="3,3"
8034
+ />
8035
+ }
8036
+ }
8037
+
8038
+ <!-- Y-Axis Labels -->
8039
+ @for (tick of yTicks(); track tick) {
8040
+ <text
8041
+ x="-10"
8042
+ [attr.y]="yPos(tick) + 4"
8043
+ class="axis-label y"
8044
+ text-anchor="end"
8045
+ >{{ fmtNum(tick) }}</text>
8046
+ }
8047
+
8048
+ <!-- X-Axis Labels -->
8049
+ @for (item of data(); track $index; let i = $index) {
8050
+ <text
8051
+ [attr.x]="xPos(i) + candleWidth() / 2"
8052
+ [attr.y]="innerH() + 20"
8053
+ class="axis-label x"
8054
+ text-anchor="middle"
8055
+ >{{ formatDate(item.date) }}</text>
8056
+ }
8057
+
8058
+ <!-- Active Crosshair -->
8059
+ @if (hoveredIndex() !== null) {
8060
+ @if (computedCandles()[hoveredIndex()!]; as candle) {
8061
+ <line
8062
+ [attr.x1]="0"
8063
+ [attr.x2]="innerW()"
8064
+ [attr.y1]="candle.yClose"
8065
+ [attr.y2]="candle.yClose"
8066
+ stroke="rgba(100, 116, 139, 0.25)"
8067
+ stroke-width="1.2"
8068
+ stroke-dasharray="3,3"
8069
+ class="crosshair-line"
8070
+ />
8071
+ <line
8072
+ [attr.x1]="candle.centerX"
8073
+ [attr.x2]="candle.centerX"
8074
+ [attr.y1]="0"
8075
+ [attr.y2]="innerH()"
8076
+ stroke="rgba(100, 116, 139, 0.25)"
8077
+ stroke-width="1.2"
8078
+ stroke-dasharray="3,3"
8079
+ class="crosshair-line"
8080
+ />
8081
+ }
8082
+ }
8083
+
8084
+ <!-- Candles -->
8085
+ @for (candle of computedCandles(); track $index; let i = $index) {
8086
+ <!-- Whisker/Wick Line (High to Low) -->
8087
+ <line
8088
+ [attr.x1]="candle.centerX"
8089
+ [attr.x2]="candle.centerX"
8090
+ [attr.y1]="candle.yHigh"
8091
+ [attr.y2]="candle.yLow"
8092
+ [attr.stroke]="candle.color"
8093
+ stroke-width="1.5"
8094
+ class="candle-wick"
8095
+ />
8096
+
8097
+ <!-- Candle Body Rect (Open to Close) -->
8098
+ <rect
8099
+ [attr.x]="candle.x"
8100
+ [attr.y]="candle.y"
8101
+ [attr.width]="candle.width"
8102
+ [attr.height]="candle.rectH"
8103
+ [attr.fill]="candle.isBullish ? 'url(#candle-bullish-grad)' : 'url(#candle-bearish-grad)'"
8104
+ [attr.stroke]="candle.color"
8105
+ stroke-width="1"
8106
+ class="candle-rect"
8107
+ [class.hovered]="hoveredIndex() === i"
8108
+ [style.transform-origin]="candle.centerX + 'px ' + candle.yOpen + 'px'"
8109
+ [style.animation-delay]="i * 0.03 + 's'"
8110
+ (mouseenter)="onCandleHover($event, candle.raw, i)"
8111
+ (mousemove)="onCandleHover($event, candle.raw, i)"
8112
+ />
8113
+ }
8114
+
8115
+ <!-- Base axes borders -->
8116
+ <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
8117
+ <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
8118
+ </g>
8119
+ </svg>
8120
+
8121
+ <!-- Tooltip -->
8122
+ @if (tooltip(); as t) {
8123
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
8124
+ <div class="tooltip-header">{{ formatDate(t.date) }}</div>
8125
+ <div class="tooltip-body">
8126
+ <div class="tooltip-direction" [style.color]="t.direction === 'Bullish' ? '#10b981' : '#ef4444'">
8127
+ <strong>{{ t.direction }}</strong> ({{ t.changePct }})
8128
+ </div>
8129
+ <div class="tooltip-val">
8130
+ <span>High:</span>
8131
+ <strong>{{ fmtNum(t.high) }}</strong>
8132
+ </div>
8133
+ <div class="tooltip-val">
8134
+ <span>Open:</span>
8135
+ <strong>{{ fmtNum(t.open) }}</strong>
8136
+ </div>
8137
+ <div class="tooltip-val" style="color: #38bdf8;">
8138
+ <span>Close:</span>
8139
+ <strong>{{ fmtNum(t.close) }}</strong>
8140
+ </div>
8141
+ <div class="tooltip-val">
8142
+ <span>Low:</span>
8143
+ <strong>{{ fmtNum(t.low) }}</strong>
8144
+ </div>
8145
+ </div>
8146
+ </div>
8147
+ }
8148
+ </div>
8149
+ </div>
8150
+ `, isInline: true, styles: [":host{display:block;width:100%}.ngx-candlestick-chart{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif)}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}@keyframes candleGrow{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}.candle-rect{cursor:pointer;transition:fill .15s,opacity .15s,stroke-width .15s,filter .15s;animation:candleGrow .6s cubic-bezier(.16,1,.3,1) both}.candle-rect.hovered{filter:brightness(1.05) drop-shadow(0 4px 10px rgba(0,0,0,.18));stroke-width:1.5px}@keyframes wickFade{0%{opacity:0}to{opacity:1}}.candle-wick{animation:wickFade .6s ease-out .2s both}.crosshair-line{pointer-events:none}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;z-index:100;min-width:155px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tooltip-header{font-weight:700;margin-bottom:6px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tooltip-direction{font-size:10px;font-weight:700;margin-bottom:6px;text-transform:uppercase;letter-spacing:.3px}.tooltip-body{display:flex;flex-direction:column;gap:4px}.tooltip-val{display:flex;justify-content:space-between;gap:16px;color:#f8fafcd9}.tooltip-val strong{color:#f8fafc;font-family:monospace;font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
8151
+ }
8152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: CandlestickChartComponent, decorators: [{
8153
+ type: Component,
8154
+ args: [{ selector: 'ngx-candlestick-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
8155
+ <div class="ngx-candlestick-chart" (mouseleave)="hoveredIndex.set(null); tooltip.set(null)">
8156
+ <div class="chart-svg-container" #container>
8157
+ <svg
8158
+ [attr.width]="'100%'"
8159
+ [attr.height]="height()"
8160
+ class="chart-svg"
8161
+ >
8162
+ <defs>
8163
+ <linearGradient id="candle-bullish-grad" x1="0" y1="0" x2="0" y2="1">
8164
+ <stop offset="0%" [attr.stop-color]="bullishColor()" />
8165
+ <stop offset="100%" [attr.stop-color]="bullishColor()" stop-opacity="0.8" />
8166
+ </linearGradient>
8167
+ <linearGradient id="candle-bearish-grad" x1="0" y1="0" x2="0" y2="1">
8168
+ <stop offset="0%" [attr.stop-color]="bearishColor()" />
8169
+ <stop offset="100%" [attr.stop-color]="bearishColor()" stop-opacity="0.8" />
8170
+ </linearGradient>
8171
+ </defs>
8172
+
8173
+ <g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
8174
+ <!-- Grid Lines (Horizontal) -->
8175
+ @if (showGrid()) {
8176
+ @for (tick of yTicks(); track tick) {
8177
+ <line
8178
+ [attr.x1]="0"
8179
+ [attr.x2]="innerW()"
8180
+ [attr.y1]="yPos(tick)"
8181
+ [attr.y2]="yPos(tick)"
8182
+ stroke="var(--ngx-chart-grid, #ebedf0)"
8183
+ stroke-dasharray="3,3"
8184
+ />
8185
+ }
8186
+ }
8187
+
8188
+ <!-- Y-Axis Labels -->
8189
+ @for (tick of yTicks(); track tick) {
8190
+ <text
8191
+ x="-10"
8192
+ [attr.y]="yPos(tick) + 4"
8193
+ class="axis-label y"
8194
+ text-anchor="end"
8195
+ >{{ fmtNum(tick) }}</text>
8196
+ }
8197
+
8198
+ <!-- X-Axis Labels -->
8199
+ @for (item of data(); track $index; let i = $index) {
8200
+ <text
8201
+ [attr.x]="xPos(i) + candleWidth() / 2"
8202
+ [attr.y]="innerH() + 20"
8203
+ class="axis-label x"
8204
+ text-anchor="middle"
8205
+ >{{ formatDate(item.date) }}</text>
8206
+ }
8207
+
8208
+ <!-- Active Crosshair -->
8209
+ @if (hoveredIndex() !== null) {
8210
+ @if (computedCandles()[hoveredIndex()!]; as candle) {
8211
+ <line
8212
+ [attr.x1]="0"
8213
+ [attr.x2]="innerW()"
8214
+ [attr.y1]="candle.yClose"
8215
+ [attr.y2]="candle.yClose"
8216
+ stroke="rgba(100, 116, 139, 0.25)"
8217
+ stroke-width="1.2"
8218
+ stroke-dasharray="3,3"
8219
+ class="crosshair-line"
8220
+ />
8221
+ <line
8222
+ [attr.x1]="candle.centerX"
8223
+ [attr.x2]="candle.centerX"
8224
+ [attr.y1]="0"
8225
+ [attr.y2]="innerH()"
8226
+ stroke="rgba(100, 116, 139, 0.25)"
8227
+ stroke-width="1.2"
8228
+ stroke-dasharray="3,3"
8229
+ class="crosshair-line"
8230
+ />
8231
+ }
8232
+ }
8233
+
8234
+ <!-- Candles -->
8235
+ @for (candle of computedCandles(); track $index; let i = $index) {
8236
+ <!-- Whisker/Wick Line (High to Low) -->
8237
+ <line
8238
+ [attr.x1]="candle.centerX"
8239
+ [attr.x2]="candle.centerX"
8240
+ [attr.y1]="candle.yHigh"
8241
+ [attr.y2]="candle.yLow"
8242
+ [attr.stroke]="candle.color"
8243
+ stroke-width="1.5"
8244
+ class="candle-wick"
8245
+ />
8246
+
8247
+ <!-- Candle Body Rect (Open to Close) -->
8248
+ <rect
8249
+ [attr.x]="candle.x"
8250
+ [attr.y]="candle.y"
8251
+ [attr.width]="candle.width"
8252
+ [attr.height]="candle.rectH"
8253
+ [attr.fill]="candle.isBullish ? 'url(#candle-bullish-grad)' : 'url(#candle-bearish-grad)'"
8254
+ [attr.stroke]="candle.color"
8255
+ stroke-width="1"
8256
+ class="candle-rect"
8257
+ [class.hovered]="hoveredIndex() === i"
8258
+ [style.transform-origin]="candle.centerX + 'px ' + candle.yOpen + 'px'"
8259
+ [style.animation-delay]="i * 0.03 + 's'"
8260
+ (mouseenter)="onCandleHover($event, candle.raw, i)"
8261
+ (mousemove)="onCandleHover($event, candle.raw, i)"
8262
+ />
8263
+ }
8264
+
8265
+ <!-- Base axes borders -->
8266
+ <line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
8267
+ <line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
8268
+ </g>
8269
+ </svg>
8270
+
8271
+ <!-- Tooltip -->
8272
+ @if (tooltip(); as t) {
8273
+ <div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
8274
+ <div class="tooltip-header">{{ formatDate(t.date) }}</div>
8275
+ <div class="tooltip-body">
8276
+ <div class="tooltip-direction" [style.color]="t.direction === 'Bullish' ? '#10b981' : '#ef4444'">
8277
+ <strong>{{ t.direction }}</strong> ({{ t.changePct }})
8278
+ </div>
8279
+ <div class="tooltip-val">
8280
+ <span>High:</span>
8281
+ <strong>{{ fmtNum(t.high) }}</strong>
8282
+ </div>
8283
+ <div class="tooltip-val">
8284
+ <span>Open:</span>
8285
+ <strong>{{ fmtNum(t.open) }}</strong>
8286
+ </div>
8287
+ <div class="tooltip-val" style="color: #38bdf8;">
8288
+ <span>Close:</span>
8289
+ <strong>{{ fmtNum(t.close) }}</strong>
8290
+ </div>
8291
+ <div class="tooltip-val">
8292
+ <span>Low:</span>
8293
+ <strong>{{ fmtNum(t.low) }}</strong>
8294
+ </div>
5642
8295
  </div>
5643
8296
  </div>
5644
8297
  }
5645
8298
  </div>
5646
8299
  </div>
5647
- `, styles: [":host{display:block;width:100%}.ngx-scatter-plot{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif);transition:background-color .3s}.ngx-scatter-plot.dark{background:#1e203073;border:1px solid rgba(255,255,255,.05);--ngx-chart-bg: transparent;--ngx-chart-grid: rgba(255, 255, 255, .06);--ngx-chart-axis: rgba(255, 255, 255, .12)}.chart-legend{display:flex;gap:16px;margin-bottom:16px;flex-wrap:wrap}.legend-item{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:#64748b}.dark .legend-item{color:#94a3b8}.legend-dot{width:10px;height:10px;border-radius:50%;display:inline-block}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}.dark .axis-label{fill:#94a3b8}.axis-title{font-size:11px;font-weight:600;fill:#475569;letter-spacing:.5px}.dark .axis-title{fill:#cbd5e1}.scatter-point{cursor:pointer;transition:r .2s,opacity .2s,filter .2s}.scatter-point.hovered{r:8px;opacity:.95;filter:brightness(1.1)}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:#0f172af2;backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.1);box-shadow:0 10px 15px -3px #0000004d;color:#f8fafc;padding:8px 12px;border-radius:6px;font-size:11px;z-index:100;min-width:120px}.tooltip-header{font-weight:700;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;margin-bottom:6px;color:#38bdf8}.tooltip-body{display:flex;flex-direction:column;gap:3px}.tooltip-group{color:#cbd5e1;margin-bottom:3px}.tooltip-val{color:#94a3b8}.tooltip-val strong{color:#f8fafc;font-family:monospace}\n"] }]
8300
+ `, styles: [":host{display:block;width:100%}.ngx-candlestick-chart{position:relative;background:var(--ngx-chart-bg, #ffffff);border-radius:16px;padding:16px;box-sizing:border-box;font-family:var(--ngx-font-family, system-ui, sans-serif)}.chart-svg-container{position:relative;width:100%}.chart-svg{display:block;overflow:visible}.axis-label{font-size:10px;fill:#64748b;font-weight:500}@keyframes candleGrow{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}.candle-rect{cursor:pointer;transition:fill .15s,opacity .15s,stroke-width .15s,filter .15s;animation:candleGrow .6s cubic-bezier(.16,1,.3,1) both}.candle-rect.hovered{filter:brightness(1.05) drop-shadow(0 4px 10px rgba(0,0,0,.18));stroke-width:1.5px}@keyframes wickFade{0%{opacity:0}to{opacity:1}}.candle-wick{animation:wickFade .6s ease-out .2s both}.crosshair-line{pointer-events:none}.chart-tooltip{position:absolute;pointer-events:none;transform:translate(-50%,-100%) translateY(-10px);background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .92));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:10px 14px;border-radius:10px;font-size:11px;z-index:100;min-width:155px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transition:left .1s cubic-bezier(.16,1,.3,1),top .1s cubic-bezier(.16,1,.3,1)}.tooltip-header{font-weight:700;margin-bottom:6px;font-size:12.5px;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px;color:#38bdf8}.tooltip-direction{font-size:10px;font-weight:700;margin-bottom:6px;text-transform:uppercase;letter-spacing:.3px}.tooltip-body{display:flex;flex-direction:column;gap:4px}.tooltip-val{display:flex;justify-content:space-between;gap:16px;color:#f8fafcd9}.tooltip-val strong{color:#f8fafc;font-family:monospace;font-weight:700}\n"] }]
5648
8301
  }] });
5649
8302
 
5650
8303
  /*
@@ -5656,5 +8309,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
5656
8309
  * Generated bundle index. Do not edit.
5657
8310
  */
5658
8311
 
5659
- export { AreaChartComponent, BarChartComponent, CHART_COLORS, ComboChartComponent, DEFAULT_GANTT_CONFIG, DependencyType, FunnelChartComponent, GanttChartComponent, GanttItemType, GanttLinkLineType, GanttPrintService, GanttScaleService, GaugeChartComponent, HeatmapChartComponent, LineChartComponent, PieChartComponent, RadarChartComponent, ScatterPlotComponent, SparklineComponent, TreemapChartComponent, ZoomLevel, addDays, addHours, addMonths, addQuarters, addWeeks, addYears, daysInMonth, diffDays, diffHours, getColumnDates, getDateRange, isWeekend, snapToDay, startOfDay, startOfHour, startOfMonth, startOfQuarter, startOfWeek, startOfYear };
8312
+ export { AreaChartComponent, BarChartComponent, BoxPlotChartComponent, CHART_COLORS, CandlestickChartComponent, ComboChartComponent, DEFAULT_GANTT_CONFIG, DependencyType, FunnelChartComponent, GanttChartComponent, GanttItemType, GanttLinkLineType, GanttPrintService, GanttScaleService, GaugeChartComponent, HeatmapChartComponent, LineChartComponent, PieChartComponent, RadarChartComponent, RadialBarChartComponent, ScatterPlotComponent, SparklineComponent, TreemapChartComponent, WaterfallChartComponent, ZoomLevel, addDays, addHours, addMonths, addQuarters, addWeeks, addYears, daysInMonth, diffDays, diffHours, getColumnDates, getDateRange, isWeekend, snapToDay, startOfDay, startOfHour, startOfMonth, startOfQuarter, startOfWeek, startOfYear };
5660
8313
  //# sourceMappingURL=ngx-core-components-charts.mjs.map