ngx-core-components 0.3.5 → 0.3.7
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.
- package/charts/combo-chart/combo-chart.component.d.ts +58 -0
- package/charts/public-api.d.ts +3 -0
- package/charts/scatter-plot/scatter-plot.component.d.ts +66 -0
- package/fesm2022/ngx-core-components-charts.mjs +821 -1
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-grid.mjs +1085 -145
- package/fesm2022/ngx-core-components-grid.mjs.map +1 -1
- package/fesm2022/ngx-core-components-inputs.mjs +545 -63
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
- package/fesm2022/ngx-core-components-navigation.mjs +122 -1
- package/fesm2022/ngx-core-components-navigation.mjs.map +1 -1
- package/fesm2022/ngx-core-components-views.mjs +1043 -445
- package/fesm2022/ngx-core-components-views.mjs.map +1 -1
- package/fesm2022/ngx-core-components.mjs +5 -5
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/grid/data-grid/data-grid.component.d.ts +74 -6
- package/grid/pivot-grid/pivot-grid.component.d.ts +32 -0
- package/grid/public-api.d.ts +2 -0
- package/inputs/date-range-picker/date-range-picker.component.d.ts +41 -5
- package/inputs/form-builder/form-builder.component.d.ts +36 -0
- package/inputs/public-api.d.ts +3 -0
- package/inputs/signature-pad/signature-pad.component.d.ts +24 -0
- package/navigation/context-menu/context-menu.component.d.ts +23 -0
- package/navigation/public-api.d.ts +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +13 -8
- package/views/json-viewer/json-viewer.component.d.ts +18 -0
- package/views/kanban/kanban.component.d.ts +38 -18
- package/views/kanban/models.d.ts +21 -0
- package/views/org-chart/org-chart.component.d.ts +18 -0
- package/views/public-api.d.ts +5 -2
- package/views/scheduler/models.d.ts +12 -1
- package/views/scheduler/scheduler.component.d.ts +58 -10
|
@@ -4440,6 +4440,826 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
4440
4440
|
`, 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"] }]
|
|
4441
4441
|
}] });
|
|
4442
4442
|
|
|
4443
|
+
class ComboChartComponent {
|
|
4444
|
+
PAD_LEFT = 52;
|
|
4445
|
+
PAD_TOP = 16;
|
|
4446
|
+
PAD_RIGHT = 52;
|
|
4447
|
+
PAD_BOTTOM = 36;
|
|
4448
|
+
barSeries = input([]);
|
|
4449
|
+
lineSeries = input([]);
|
|
4450
|
+
categories = input([]);
|
|
4451
|
+
height = input(300);
|
|
4452
|
+
showGrid = input(true);
|
|
4453
|
+
showLegend = input(true);
|
|
4454
|
+
theme = input('light');
|
|
4455
|
+
colors = input(CHART_COLORS);
|
|
4456
|
+
barYTitle = input('Volume');
|
|
4457
|
+
lineYTitle = input('Percentage');
|
|
4458
|
+
activeCategoryIndex = signal(null);
|
|
4459
|
+
tooltip = signal(null);
|
|
4460
|
+
container = viewChild('container');
|
|
4461
|
+
// Dimension Calculations
|
|
4462
|
+
innerW = computed(() => {
|
|
4463
|
+
const el = this.container()?.nativeElement;
|
|
4464
|
+
const totalW = el ? el.getBoundingClientRect().width : 600;
|
|
4465
|
+
return Math.max(200, totalW - this.PAD_LEFT - this.PAD_RIGHT);
|
|
4466
|
+
});
|
|
4467
|
+
innerH = computed(() => this.height() - this.PAD_TOP - this.PAD_BOTTOM);
|
|
4468
|
+
// Left Y-Axis Calculations (Bar values)
|
|
4469
|
+
leftValues = computed(() => this.barSeries().flatMap(s => s.data.filter(v => v !== null)));
|
|
4470
|
+
leftMin = computed(() => Math.min(0, ...this.leftValues()));
|
|
4471
|
+
leftMax = computed(() => Math.max(1, ...this.leftValues()));
|
|
4472
|
+
leftYTicks = computed(() => niceTicks(this.leftMin(), this.leftMax(), 5));
|
|
4473
|
+
leftYPos(v) {
|
|
4474
|
+
return scale(v, this.leftMin(), this.leftMax(), this.innerH(), 0);
|
|
4475
|
+
}
|
|
4476
|
+
barY(v) { return Math.min(this.leftYPos(0), this.leftYPos(v)); }
|
|
4477
|
+
barH(v) { return Math.abs(this.leftYPos(0) - this.leftYPos(v)); }
|
|
4478
|
+
// Right Y-Axis Calculations (Line values)
|
|
4479
|
+
rightValues = computed(() => this.lineSeries().flatMap(s => s.data.filter(v => v !== null)));
|
|
4480
|
+
rightMin = computed(() => Math.min(0, ...this.rightValues()));
|
|
4481
|
+
rightMax = computed(() => Math.max(100, ...this.rightValues()));
|
|
4482
|
+
rightYTicks = computed(() => niceTicks(this.rightMin(), this.rightMax(), 5));
|
|
4483
|
+
rightYPos(v) {
|
|
4484
|
+
return scale(v, this.rightMin(), this.rightMax(), this.innerH(), 0);
|
|
4485
|
+
}
|
|
4486
|
+
// Layout positioning
|
|
4487
|
+
groupW = computed(() => this.categories().length > 0 ? this.innerW() / this.categories().length : 0);
|
|
4488
|
+
singleBarWidth = computed(() => {
|
|
4489
|
+
const numSeries = this.barSeries().length || 1;
|
|
4490
|
+
return Math.max(4, (this.groupW() - 12) / numSeries);
|
|
4491
|
+
});
|
|
4492
|
+
catMidX(i) {
|
|
4493
|
+
return i * this.groupW() + this.groupW() / 2;
|
|
4494
|
+
}
|
|
4495
|
+
barX(ci, si) {
|
|
4496
|
+
const numSeries = this.barSeries().length;
|
|
4497
|
+
const groupStartX = ci * this.groupW() + 6;
|
|
4498
|
+
return groupStartX + si * this.singleBarWidth();
|
|
4499
|
+
}
|
|
4500
|
+
barSeriesColor(si) {
|
|
4501
|
+
return this.colors()[si % this.colors().length];
|
|
4502
|
+
}
|
|
4503
|
+
lineSeriesColor(si) {
|
|
4504
|
+
// Avoid color collision by shifting indices
|
|
4505
|
+
const offset = this.barSeries().length || 0;
|
|
4506
|
+
return this.colors()[(si + offset) % this.colors().length];
|
|
4507
|
+
}
|
|
4508
|
+
// Line paths generator
|
|
4509
|
+
linePath(series) {
|
|
4510
|
+
const pts = series.data.map((v, ci) => {
|
|
4511
|
+
if (v === null || v === undefined)
|
|
4512
|
+
return null;
|
|
4513
|
+
return [this.catMidX(ci), this.rightYPos(v)];
|
|
4514
|
+
}).filter((p) => p !== null);
|
|
4515
|
+
if (pts.length < 2)
|
|
4516
|
+
return '';
|
|
4517
|
+
let d = `M ${pts[0][0]} ${pts[0][1]}`;
|
|
4518
|
+
for (let i = 1; i < pts.length; i++) {
|
|
4519
|
+
d += ` L ${pts[i][0]} ${pts[i][1]}`;
|
|
4520
|
+
}
|
|
4521
|
+
return d;
|
|
4522
|
+
}
|
|
4523
|
+
onMouseMove(event, index) {
|
|
4524
|
+
this.activeCategoryIndex.set(index);
|
|
4525
|
+
const containerEl = this.container()?.nativeElement;
|
|
4526
|
+
if (!containerEl)
|
|
4527
|
+
return;
|
|
4528
|
+
const rect = containerEl.getBoundingClientRect();
|
|
4529
|
+
const tooltipX = event.clientX - rect.left;
|
|
4530
|
+
const tooltipY = event.clientY - rect.top;
|
|
4531
|
+
const catName = this.categories()[index] || `Category ${index + 1}`;
|
|
4532
|
+
const items = [];
|
|
4533
|
+
// Bars info
|
|
4534
|
+
this.barSeries().forEach((s, si) => {
|
|
4535
|
+
const val = s.data[index];
|
|
4536
|
+
if (val !== undefined && val !== null) {
|
|
4537
|
+
items.push({
|
|
4538
|
+
name: s.name,
|
|
4539
|
+
value: val,
|
|
4540
|
+
color: s.color || this.barSeriesColor(si),
|
|
4541
|
+
type: 'bar'
|
|
4542
|
+
});
|
|
4543
|
+
}
|
|
4544
|
+
});
|
|
4545
|
+
// Lines info
|
|
4546
|
+
this.lineSeries().forEach((s, si) => {
|
|
4547
|
+
const val = s.data[index];
|
|
4548
|
+
if (val !== undefined && val !== null) {
|
|
4549
|
+
items.push({
|
|
4550
|
+
name: s.name,
|
|
4551
|
+
value: val,
|
|
4552
|
+
color: s.color || this.lineSeriesColor(si),
|
|
4553
|
+
type: 'line',
|
|
4554
|
+
suffix: '%'
|
|
4555
|
+
});
|
|
4556
|
+
}
|
|
4557
|
+
});
|
|
4558
|
+
this.tooltip.set({
|
|
4559
|
+
x: tooltipX,
|
|
4560
|
+
y: tooltipY,
|
|
4561
|
+
category: catName,
|
|
4562
|
+
items
|
|
4563
|
+
});
|
|
4564
|
+
}
|
|
4565
|
+
onMouseLeave() {
|
|
4566
|
+
this.activeCategoryIndex.set(null);
|
|
4567
|
+
this.tooltip.set(null);
|
|
4568
|
+
}
|
|
4569
|
+
fmtNum = fmtNum;
|
|
4570
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ComboChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4571
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: ComboChartComponent, isStandalone: true, selector: "ngx-combo-chart", inputs: { barSeries: { classPropertyName: "barSeries", publicName: "barSeries", isSignal: true, isRequired: false, transformFunction: null }, lineSeries: { classPropertyName: "lineSeries", publicName: "lineSeries", 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 }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, barYTitle: { classPropertyName: "barYTitle", publicName: "barYTitle", isSignal: true, isRequired: false, transformFunction: null }, lineYTitle: { classPropertyName: "lineYTitle", publicName: "lineYTitle", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
4572
|
+
<div class="ngx-combo-chart" [class.dark]="theme() === 'dark'">
|
|
4573
|
+
<!-- Legend -->
|
|
4574
|
+
@if (showLegend()) {
|
|
4575
|
+
<div class="chart-legend">
|
|
4576
|
+
@for (s of barSeries(); track s.name; let i = $index) {
|
|
4577
|
+
<span class="legend-item">
|
|
4578
|
+
<span class="legend-dot bar" [style.background]="barSeriesColor(i)"></span>
|
|
4579
|
+
{{ s.name }} (Bar)
|
|
4580
|
+
</span>
|
|
4581
|
+
}
|
|
4582
|
+
@for (s of lineSeries(); track s.name; let i = $index) {
|
|
4583
|
+
<span class="legend-item">
|
|
4584
|
+
<span class="legend-line" [style.border-color]="lineSeriesColor(i)"></span>
|
|
4585
|
+
<span class="legend-dot marker" [style.background]="lineSeriesColor(i)"></span>
|
|
4586
|
+
{{ s.name }} (Line)
|
|
4587
|
+
</span>
|
|
4588
|
+
}
|
|
4589
|
+
</div>
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4592
|
+
<div class="chart-svg-container" #container>
|
|
4593
|
+
<svg
|
|
4594
|
+
[attr.width]="'100%'"
|
|
4595
|
+
[attr.height]="height()"
|
|
4596
|
+
class="chart-svg"
|
|
4597
|
+
(mouseleave)="onMouseLeave()"
|
|
4598
|
+
>
|
|
4599
|
+
<g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
|
|
4600
|
+
<!-- Grid Lines -->
|
|
4601
|
+
@if (showGrid()) {
|
|
4602
|
+
@for (tick of leftYTicks(); track tick) {
|
|
4603
|
+
<line
|
|
4604
|
+
[attr.x1]="0"
|
|
4605
|
+
[attr.x2]="innerW()"
|
|
4606
|
+
[attr.y1]="leftYPos(tick)"
|
|
4607
|
+
[attr.y2]="leftYPos(tick)"
|
|
4608
|
+
stroke="var(--ngx-chart-grid, #ebedf0)"
|
|
4609
|
+
stroke-dasharray="3,3"
|
|
4610
|
+
/>
|
|
4611
|
+
}
|
|
4612
|
+
}
|
|
4613
|
+
|
|
4614
|
+
<!-- Y-Axis (Left) - Bars -->
|
|
4615
|
+
@for (tick of leftYTicks(); track tick) {
|
|
4616
|
+
<text
|
|
4617
|
+
x="-10"
|
|
4618
|
+
[attr.y]="leftYPos(tick) + 4"
|
|
4619
|
+
class="axis-label left"
|
|
4620
|
+
text-anchor="end"
|
|
4621
|
+
>{{ fmtNum(tick) }}</text>
|
|
4622
|
+
}
|
|
4623
|
+
<text
|
|
4624
|
+
[attr.transform]="'rotate(-90) translate(' + (-innerH()/2) + ', -36)'"
|
|
4625
|
+
class="axis-title left"
|
|
4626
|
+
text-anchor="middle"
|
|
4627
|
+
>{{ barYTitle() }}</text>
|
|
4628
|
+
|
|
4629
|
+
<!-- Y-Axis (Right) - Lines -->
|
|
4630
|
+
@for (tick of rightYTicks(); track tick) {
|
|
4631
|
+
<text
|
|
4632
|
+
[attr.x]="innerW() + 10"
|
|
4633
|
+
[attr.y]="rightYPos(tick) + 4"
|
|
4634
|
+
class="axis-label right"
|
|
4635
|
+
text-anchor="start"
|
|
4636
|
+
>{{ fmtNum(tick) }}</text>
|
|
4637
|
+
}
|
|
4638
|
+
<text
|
|
4639
|
+
[attr.transform]="'rotate(90) translate(' + (innerH()/2) + ', ' + (-innerW() - 36) + ')'"
|
|
4640
|
+
class="axis-title right"
|
|
4641
|
+
text-anchor="middle"
|
|
4642
|
+
>{{ lineYTitle() }}</text>
|
|
4643
|
+
|
|
4644
|
+
<!-- X-Axis Labels -->
|
|
4645
|
+
@for (cat of categories(); track cat; let i = $index) {
|
|
4646
|
+
<text
|
|
4647
|
+
[attr.x]="catMidX(i)"
|
|
4648
|
+
[attr.y]="innerH() + 20"
|
|
4649
|
+
class="axis-label x"
|
|
4650
|
+
text-anchor="middle"
|
|
4651
|
+
>{{ cat }}</text>
|
|
4652
|
+
}
|
|
4653
|
+
|
|
4654
|
+
<!-- Active Category Column Highlight -->
|
|
4655
|
+
@if (activeCategoryIndex() !== null) {
|
|
4656
|
+
<rect
|
|
4657
|
+
[attr.x]="activeCategoryIndex()! * groupW() + 2"
|
|
4658
|
+
[attr.y]="0"
|
|
4659
|
+
[attr.width]="groupW() - 4"
|
|
4660
|
+
[attr.height]="innerH()"
|
|
4661
|
+
class="column-highlight"
|
|
4662
|
+
/>
|
|
4663
|
+
}
|
|
4664
|
+
|
|
4665
|
+
<!-- Bars (Left Y-Axis Scale) -->
|
|
4666
|
+
@for (s of barSeries(); track s.name; let si = $index) {
|
|
4667
|
+
@for (v of s.data; track $index; let ci = $index) {
|
|
4668
|
+
@if (v !== null && v !== undefined) {
|
|
4669
|
+
<rect
|
|
4670
|
+
[attr.x]="barX(ci, si)"
|
|
4671
|
+
[attr.y]="barY(v)"
|
|
4672
|
+
[attr.width]="singleBarWidth()"
|
|
4673
|
+
[attr.height]="barH(v)"
|
|
4674
|
+
[attr.fill]="s.color || barSeriesColor(si)"
|
|
4675
|
+
[attr.rx]="2"
|
|
4676
|
+
class="bar-rect"
|
|
4677
|
+
/>
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4682
|
+
<!-- Lines (Right Y-Axis Scale) -->
|
|
4683
|
+
@for (s of lineSeries(); track s.name; let si = $index) {
|
|
4684
|
+
<!-- Draw Line Path -->
|
|
4685
|
+
<path
|
|
4686
|
+
[attr.d]="linePath(s)"
|
|
4687
|
+
fill="none"
|
|
4688
|
+
[attr.stroke]="s.color || lineSeriesColor(si)"
|
|
4689
|
+
stroke-width="3"
|
|
4690
|
+
stroke-linecap="round"
|
|
4691
|
+
class="line-path"
|
|
4692
|
+
/>
|
|
4693
|
+
<!-- Draw Markers -->
|
|
4694
|
+
@for (v of s.data; track $index; let ci = $index) {
|
|
4695
|
+
@if (v !== null && v !== undefined) {
|
|
4696
|
+
<circle
|
|
4697
|
+
[attr.cx]="catMidX(ci)"
|
|
4698
|
+
[attr.cy]="rightYPos(v)"
|
|
4699
|
+
[attr.r]="activeCategoryIndex() === ci ? 6 : 4"
|
|
4700
|
+
[attr.fill]="'#ffffff'"
|
|
4701
|
+
[attr.stroke]="s.color || lineSeriesColor(si)"
|
|
4702
|
+
stroke-width="2.5"
|
|
4703
|
+
class="line-marker"
|
|
4704
|
+
/>
|
|
4705
|
+
}
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4709
|
+
<!-- Invisible Hover Interactive Hitboxes -->
|
|
4710
|
+
@for (cat of categories(); track cat; let i = $index) {
|
|
4711
|
+
<rect
|
|
4712
|
+
[attr.x]="i * groupW()"
|
|
4713
|
+
[attr.y]="0"
|
|
4714
|
+
[attr.width]="groupW()"
|
|
4715
|
+
[attr.height]="innerH()"
|
|
4716
|
+
fill="transparent"
|
|
4717
|
+
class="hitbox"
|
|
4718
|
+
(mousemove)="onMouseMove($event, i)"
|
|
4719
|
+
/>
|
|
4720
|
+
}
|
|
4721
|
+
|
|
4722
|
+
<!-- Base axes borders -->
|
|
4723
|
+
<line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
4724
|
+
<line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
4725
|
+
<line [attr.x1]="innerW()" [attr.x2]="innerW()" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
4726
|
+
</g>
|
|
4727
|
+
</svg>
|
|
4728
|
+
|
|
4729
|
+
<!-- Dynamic Combined Tooltip -->
|
|
4730
|
+
@if (tooltip(); as t) {
|
|
4731
|
+
<div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
|
|
4732
|
+
<div class="tooltip-header">{{ t.category }}</div>
|
|
4733
|
+
<div class="tooltip-body">
|
|
4734
|
+
@for (item of t.items; track item.name) {
|
|
4735
|
+
<div class="tooltip-row">
|
|
4736
|
+
<span class="tooltip-dot" [style.background]="item.color" [class.line-dot]="item.type === 'line'"></span>
|
|
4737
|
+
<span class="tooltip-label">{{ item.name }}:</span>
|
|
4738
|
+
<span class="tooltip-val">{{ fmtNum(item.value) }}{{ item.suffix || '' }}</span>
|
|
4739
|
+
</div>
|
|
4740
|
+
}
|
|
4741
|
+
</div>
|
|
4742
|
+
</div>
|
|
4743
|
+
}
|
|
4744
|
+
</div>
|
|
4745
|
+
</div>
|
|
4746
|
+
`, 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 });
|
|
4747
|
+
}
|
|
4748
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ComboChartComponent, decorators: [{
|
|
4749
|
+
type: Component,
|
|
4750
|
+
args: [{ selector: 'ngx-combo-chart', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
4751
|
+
<div class="ngx-combo-chart" [class.dark]="theme() === 'dark'">
|
|
4752
|
+
<!-- Legend -->
|
|
4753
|
+
@if (showLegend()) {
|
|
4754
|
+
<div class="chart-legend">
|
|
4755
|
+
@for (s of barSeries(); track s.name; let i = $index) {
|
|
4756
|
+
<span class="legend-item">
|
|
4757
|
+
<span class="legend-dot bar" [style.background]="barSeriesColor(i)"></span>
|
|
4758
|
+
{{ s.name }} (Bar)
|
|
4759
|
+
</span>
|
|
4760
|
+
}
|
|
4761
|
+
@for (s of lineSeries(); track s.name; let i = $index) {
|
|
4762
|
+
<span class="legend-item">
|
|
4763
|
+
<span class="legend-line" [style.border-color]="lineSeriesColor(i)"></span>
|
|
4764
|
+
<span class="legend-dot marker" [style.background]="lineSeriesColor(i)"></span>
|
|
4765
|
+
{{ s.name }} (Line)
|
|
4766
|
+
</span>
|
|
4767
|
+
}
|
|
4768
|
+
</div>
|
|
4769
|
+
}
|
|
4770
|
+
|
|
4771
|
+
<div class="chart-svg-container" #container>
|
|
4772
|
+
<svg
|
|
4773
|
+
[attr.width]="'100%'"
|
|
4774
|
+
[attr.height]="height()"
|
|
4775
|
+
class="chart-svg"
|
|
4776
|
+
(mouseleave)="onMouseLeave()"
|
|
4777
|
+
>
|
|
4778
|
+
<g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
|
|
4779
|
+
<!-- Grid Lines -->
|
|
4780
|
+
@if (showGrid()) {
|
|
4781
|
+
@for (tick of leftYTicks(); track tick) {
|
|
4782
|
+
<line
|
|
4783
|
+
[attr.x1]="0"
|
|
4784
|
+
[attr.x2]="innerW()"
|
|
4785
|
+
[attr.y1]="leftYPos(tick)"
|
|
4786
|
+
[attr.y2]="leftYPos(tick)"
|
|
4787
|
+
stroke="var(--ngx-chart-grid, #ebedf0)"
|
|
4788
|
+
stroke-dasharray="3,3"
|
|
4789
|
+
/>
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4792
|
+
|
|
4793
|
+
<!-- Y-Axis (Left) - Bars -->
|
|
4794
|
+
@for (tick of leftYTicks(); track tick) {
|
|
4795
|
+
<text
|
|
4796
|
+
x="-10"
|
|
4797
|
+
[attr.y]="leftYPos(tick) + 4"
|
|
4798
|
+
class="axis-label left"
|
|
4799
|
+
text-anchor="end"
|
|
4800
|
+
>{{ fmtNum(tick) }}</text>
|
|
4801
|
+
}
|
|
4802
|
+
<text
|
|
4803
|
+
[attr.transform]="'rotate(-90) translate(' + (-innerH()/2) + ', -36)'"
|
|
4804
|
+
class="axis-title left"
|
|
4805
|
+
text-anchor="middle"
|
|
4806
|
+
>{{ barYTitle() }}</text>
|
|
4807
|
+
|
|
4808
|
+
<!-- Y-Axis (Right) - Lines -->
|
|
4809
|
+
@for (tick of rightYTicks(); track tick) {
|
|
4810
|
+
<text
|
|
4811
|
+
[attr.x]="innerW() + 10"
|
|
4812
|
+
[attr.y]="rightYPos(tick) + 4"
|
|
4813
|
+
class="axis-label right"
|
|
4814
|
+
text-anchor="start"
|
|
4815
|
+
>{{ fmtNum(tick) }}</text>
|
|
4816
|
+
}
|
|
4817
|
+
<text
|
|
4818
|
+
[attr.transform]="'rotate(90) translate(' + (innerH()/2) + ', ' + (-innerW() - 36) + ')'"
|
|
4819
|
+
class="axis-title right"
|
|
4820
|
+
text-anchor="middle"
|
|
4821
|
+
>{{ lineYTitle() }}</text>
|
|
4822
|
+
|
|
4823
|
+
<!-- X-Axis Labels -->
|
|
4824
|
+
@for (cat of categories(); track cat; let i = $index) {
|
|
4825
|
+
<text
|
|
4826
|
+
[attr.x]="catMidX(i)"
|
|
4827
|
+
[attr.y]="innerH() + 20"
|
|
4828
|
+
class="axis-label x"
|
|
4829
|
+
text-anchor="middle"
|
|
4830
|
+
>{{ cat }}</text>
|
|
4831
|
+
}
|
|
4832
|
+
|
|
4833
|
+
<!-- Active Category Column Highlight -->
|
|
4834
|
+
@if (activeCategoryIndex() !== null) {
|
|
4835
|
+
<rect
|
|
4836
|
+
[attr.x]="activeCategoryIndex()! * groupW() + 2"
|
|
4837
|
+
[attr.y]="0"
|
|
4838
|
+
[attr.width]="groupW() - 4"
|
|
4839
|
+
[attr.height]="innerH()"
|
|
4840
|
+
class="column-highlight"
|
|
4841
|
+
/>
|
|
4842
|
+
}
|
|
4843
|
+
|
|
4844
|
+
<!-- Bars (Left Y-Axis Scale) -->
|
|
4845
|
+
@for (s of barSeries(); track s.name; let si = $index) {
|
|
4846
|
+
@for (v of s.data; track $index; let ci = $index) {
|
|
4847
|
+
@if (v !== null && v !== undefined) {
|
|
4848
|
+
<rect
|
|
4849
|
+
[attr.x]="barX(ci, si)"
|
|
4850
|
+
[attr.y]="barY(v)"
|
|
4851
|
+
[attr.width]="singleBarWidth()"
|
|
4852
|
+
[attr.height]="barH(v)"
|
|
4853
|
+
[attr.fill]="s.color || barSeriesColor(si)"
|
|
4854
|
+
[attr.rx]="2"
|
|
4855
|
+
class="bar-rect"
|
|
4856
|
+
/>
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
}
|
|
4860
|
+
|
|
4861
|
+
<!-- Lines (Right Y-Axis Scale) -->
|
|
4862
|
+
@for (s of lineSeries(); track s.name; let si = $index) {
|
|
4863
|
+
<!-- Draw Line Path -->
|
|
4864
|
+
<path
|
|
4865
|
+
[attr.d]="linePath(s)"
|
|
4866
|
+
fill="none"
|
|
4867
|
+
[attr.stroke]="s.color || lineSeriesColor(si)"
|
|
4868
|
+
stroke-width="3"
|
|
4869
|
+
stroke-linecap="round"
|
|
4870
|
+
class="line-path"
|
|
4871
|
+
/>
|
|
4872
|
+
<!-- Draw Markers -->
|
|
4873
|
+
@for (v of s.data; track $index; let ci = $index) {
|
|
4874
|
+
@if (v !== null && v !== undefined) {
|
|
4875
|
+
<circle
|
|
4876
|
+
[attr.cx]="catMidX(ci)"
|
|
4877
|
+
[attr.cy]="rightYPos(v)"
|
|
4878
|
+
[attr.r]="activeCategoryIndex() === ci ? 6 : 4"
|
|
4879
|
+
[attr.fill]="'#ffffff'"
|
|
4880
|
+
[attr.stroke]="s.color || lineSeriesColor(si)"
|
|
4881
|
+
stroke-width="2.5"
|
|
4882
|
+
class="line-marker"
|
|
4883
|
+
/>
|
|
4884
|
+
}
|
|
4885
|
+
}
|
|
4886
|
+
}
|
|
4887
|
+
|
|
4888
|
+
<!-- Invisible Hover Interactive Hitboxes -->
|
|
4889
|
+
@for (cat of categories(); track cat; let i = $index) {
|
|
4890
|
+
<rect
|
|
4891
|
+
[attr.x]="i * groupW()"
|
|
4892
|
+
[attr.y]="0"
|
|
4893
|
+
[attr.width]="groupW()"
|
|
4894
|
+
[attr.height]="innerH()"
|
|
4895
|
+
fill="transparent"
|
|
4896
|
+
class="hitbox"
|
|
4897
|
+
(mousemove)="onMouseMove($event, i)"
|
|
4898
|
+
/>
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4901
|
+
<!-- Base axes borders -->
|
|
4902
|
+
<line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
4903
|
+
<line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
4904
|
+
<line [attr.x1]="innerW()" [attr.x2]="innerW()" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
4905
|
+
</g>
|
|
4906
|
+
</svg>
|
|
4907
|
+
|
|
4908
|
+
<!-- Dynamic Combined Tooltip -->
|
|
4909
|
+
@if (tooltip(); as t) {
|
|
4910
|
+
<div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
|
|
4911
|
+
<div class="tooltip-header">{{ t.category }}</div>
|
|
4912
|
+
<div class="tooltip-body">
|
|
4913
|
+
@for (item of t.items; track item.name) {
|
|
4914
|
+
<div class="tooltip-row">
|
|
4915
|
+
<span class="tooltip-dot" [style.background]="item.color" [class.line-dot]="item.type === 'line'"></span>
|
|
4916
|
+
<span class="tooltip-label">{{ item.name }}:</span>
|
|
4917
|
+
<span class="tooltip-val">{{ fmtNum(item.value) }}{{ item.suffix || '' }}</span>
|
|
4918
|
+
</div>
|
|
4919
|
+
}
|
|
4920
|
+
</div>
|
|
4921
|
+
</div>
|
|
4922
|
+
}
|
|
4923
|
+
</div>
|
|
4924
|
+
</div>
|
|
4925
|
+
`, 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"] }]
|
|
4926
|
+
}] });
|
|
4927
|
+
|
|
4928
|
+
class ScatterPlotComponent {
|
|
4929
|
+
PAD_LEFT = 52;
|
|
4930
|
+
PAD_TOP = 16;
|
|
4931
|
+
PAD_RIGHT = 24;
|
|
4932
|
+
PAD_BOTTOM = 48;
|
|
4933
|
+
data = input([]);
|
|
4934
|
+
xTitle = input('X Axis');
|
|
4935
|
+
yTitle = input('Y Axis');
|
|
4936
|
+
height = input(300);
|
|
4937
|
+
showGrid = input(true);
|
|
4938
|
+
showLegend = input(true);
|
|
4939
|
+
theme = input('light');
|
|
4940
|
+
colors = input(CHART_COLORS);
|
|
4941
|
+
hoveredPointIndex = signal(null);
|
|
4942
|
+
tooltip = signal(null);
|
|
4943
|
+
container = viewChild('container');
|
|
4944
|
+
// Dynamic dimension scales
|
|
4945
|
+
innerW = computed(() => {
|
|
4946
|
+
const el = this.container()?.nativeElement;
|
|
4947
|
+
const totalW = el ? el.getBoundingClientRect().width : 600;
|
|
4948
|
+
return Math.max(200, totalW - this.PAD_LEFT - this.PAD_RIGHT);
|
|
4949
|
+
});
|
|
4950
|
+
innerH = computed(() => this.height() - this.PAD_TOP - this.PAD_BOTTOM);
|
|
4951
|
+
// Group mappings
|
|
4952
|
+
uniqueGroups = computed(() => {
|
|
4953
|
+
const grps = new Set();
|
|
4954
|
+
this.data().forEach(p => {
|
|
4955
|
+
if (p.group)
|
|
4956
|
+
grps.add(p.group);
|
|
4957
|
+
});
|
|
4958
|
+
return Array.from(grps);
|
|
4959
|
+
});
|
|
4960
|
+
groupColor(groupName) {
|
|
4961
|
+
if (!groupName)
|
|
4962
|
+
return this.colors()[0];
|
|
4963
|
+
const idx = this.uniqueGroups().indexOf(groupName);
|
|
4964
|
+
return this.colors()[idx % this.colors().length];
|
|
4965
|
+
}
|
|
4966
|
+
// Bounds Calculations
|
|
4967
|
+
xValues = computed(() => this.data().map(pt => pt.x));
|
|
4968
|
+
xMin = computed(() => this.xValues().length > 0 ? Math.min(...this.xValues()) * 0.9 : 0);
|
|
4969
|
+
xMax = computed(() => this.xValues().length > 0 ? Math.max(...this.xValues()) * 1.1 : 100);
|
|
4970
|
+
xTicks = computed(() => niceTicks(this.xMin(), this.xMax(), 5));
|
|
4971
|
+
yValues = computed(() => this.data().map(pt => pt.y));
|
|
4972
|
+
yMin = computed(() => this.yValues().length > 0 ? Math.min(...this.yValues()) * 0.9 : 0);
|
|
4973
|
+
yMax = computed(() => this.yValues().length > 0 ? Math.max(...this.yValues()) * 1.1 : 100);
|
|
4974
|
+
yTicks = computed(() => niceTicks(this.yMin(), this.yMax(), 5));
|
|
4975
|
+
// Map absolute coordinate points to SVG canvas
|
|
4976
|
+
xPos(x) {
|
|
4977
|
+
return scale(x, this.xMin(), this.xMax(), 0, this.innerW());
|
|
4978
|
+
}
|
|
4979
|
+
yPos(y) {
|
|
4980
|
+
return scale(y, this.yMin(), this.yMax(), this.innerH(), 0);
|
|
4981
|
+
}
|
|
4982
|
+
scaledPoints = computed(() => {
|
|
4983
|
+
return this.data().map((pt, i) => {
|
|
4984
|
+
const cx = this.xPos(pt.x);
|
|
4985
|
+
const cy = this.yPos(pt.y);
|
|
4986
|
+
const r = pt.size ? Math.max(3, Math.min(20, pt.size)) : 6;
|
|
4987
|
+
return {
|
|
4988
|
+
cx,
|
|
4989
|
+
cy,
|
|
4990
|
+
r,
|
|
4991
|
+
color: this.groupColor(pt.group),
|
|
4992
|
+
raw: pt
|
|
4993
|
+
};
|
|
4994
|
+
});
|
|
4995
|
+
});
|
|
4996
|
+
onPointHover(event, pt, index) {
|
|
4997
|
+
this.hoveredPointIndex.set(index);
|
|
4998
|
+
const containerEl = this.container()?.nativeElement;
|
|
4999
|
+
if (!containerEl)
|
|
5000
|
+
return;
|
|
5001
|
+
const rect = containerEl.getBoundingClientRect();
|
|
5002
|
+
const tooltipX = event.clientX - rect.left;
|
|
5003
|
+
const tooltipY = event.clientY - rect.top;
|
|
5004
|
+
this.tooltip.set({
|
|
5005
|
+
x: tooltipX,
|
|
5006
|
+
y: tooltipY,
|
|
5007
|
+
label: pt.label,
|
|
5008
|
+
group: pt.group,
|
|
5009
|
+
xVal: pt.x,
|
|
5010
|
+
yVal: pt.y,
|
|
5011
|
+
color: this.groupColor(pt.group)
|
|
5012
|
+
});
|
|
5013
|
+
}
|
|
5014
|
+
onMouseLeave() {
|
|
5015
|
+
this.hoveredPointIndex.set(null);
|
|
5016
|
+
this.tooltip.set(null);
|
|
5017
|
+
}
|
|
5018
|
+
ptX(t) { return t.xVal; }
|
|
5019
|
+
ptY(t) { return t.yVal; }
|
|
5020
|
+
fmtNum = fmtNum;
|
|
5021
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ScatterPlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5022
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: ScatterPlotComponent, isStandalone: true, selector: "ngx-scatter-plot", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, xTitle: { classPropertyName: "xTitle", publicName: "xTitle", isSignal: true, isRequired: false, transformFunction: null }, yTitle: { classPropertyName: "yTitle", publicName: "yTitle", 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 }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
5023
|
+
<div class="ngx-scatter-plot" [class.dark]="theme() === 'dark'">
|
|
5024
|
+
<!-- Legend -->
|
|
5025
|
+
@if (showLegend() && uniqueGroups().length > 0) {
|
|
5026
|
+
<div class="chart-legend">
|
|
5027
|
+
@for (group of uniqueGroups(); track group; let i = $index) {
|
|
5028
|
+
<span class="legend-item">
|
|
5029
|
+
<span class="legend-dot" [style.background]="groupColor(group)"></span>
|
|
5030
|
+
{{ group }}
|
|
5031
|
+
</span>
|
|
5032
|
+
}
|
|
5033
|
+
</div>
|
|
5034
|
+
}
|
|
5035
|
+
|
|
5036
|
+
<div class="chart-svg-container" #container>
|
|
5037
|
+
<svg
|
|
5038
|
+
[attr.width]="'100%'"
|
|
5039
|
+
[attr.height]="height()"
|
|
5040
|
+
class="chart-svg"
|
|
5041
|
+
(mouseleave)="onMouseLeave()"
|
|
5042
|
+
>
|
|
5043
|
+
<g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
|
|
5044
|
+
<!-- Grid Lines (Horizontal and Vertical) -->
|
|
5045
|
+
@if (showGrid()) {
|
|
5046
|
+
<!-- Horizontal Grid Lines -->
|
|
5047
|
+
@for (tick of yTicks(); track tick) {
|
|
5048
|
+
<line
|
|
5049
|
+
[attr.x1]="0"
|
|
5050
|
+
[attr.x2]="innerW()"
|
|
5051
|
+
[attr.y1]="yPos(tick)"
|
|
5052
|
+
[attr.y2]="yPos(tick)"
|
|
5053
|
+
stroke="var(--ngx-chart-grid, #ebedf0)"
|
|
5054
|
+
stroke-dasharray="3,3"
|
|
5055
|
+
/>
|
|
5056
|
+
}
|
|
5057
|
+
<!-- Vertical Grid Lines -->
|
|
5058
|
+
@for (tick of xTicks(); track tick) {
|
|
5059
|
+
<line
|
|
5060
|
+
[attr.x1]="xPos(tick)"
|
|
5061
|
+
[attr.x2]="xPos(tick)"
|
|
5062
|
+
[attr.y1]="0"
|
|
5063
|
+
[attr.y2]="innerH()"
|
|
5064
|
+
stroke="var(--ngx-chart-grid, #ebedf0)"
|
|
5065
|
+
stroke-dasharray="3,3"
|
|
5066
|
+
/>
|
|
5067
|
+
}
|
|
5068
|
+
}
|
|
5069
|
+
|
|
5070
|
+
<!-- Y-Axis Labels -->
|
|
5071
|
+
@for (tick of yTicks(); track tick) {
|
|
5072
|
+
<text
|
|
5073
|
+
x="-10"
|
|
5074
|
+
[attr.y]="yPos(tick) + 4"
|
|
5075
|
+
class="axis-label y"
|
|
5076
|
+
text-anchor="end"
|
|
5077
|
+
>{{ fmtNum(tick) }}</text>
|
|
5078
|
+
}
|
|
5079
|
+
<text
|
|
5080
|
+
[attr.transform]="'rotate(-90) translate(' + (-innerH()/2) + ', -36)'"
|
|
5081
|
+
class="axis-title y"
|
|
5082
|
+
text-anchor="middle"
|
|
5083
|
+
>{{ yTitle() }}</text>
|
|
5084
|
+
|
|
5085
|
+
<!-- X-Axis Labels -->
|
|
5086
|
+
@for (tick of xTicks(); track tick) {
|
|
5087
|
+
<text
|
|
5088
|
+
[attr.x]="xPos(tick)"
|
|
5089
|
+
[attr.y]="innerH() + 20"
|
|
5090
|
+
class="axis-label x"
|
|
5091
|
+
text-anchor="middle"
|
|
5092
|
+
>{{ fmtNum(tick) }}</text>
|
|
5093
|
+
}
|
|
5094
|
+
<text
|
|
5095
|
+
[attr.x]="innerW() / 2"
|
|
5096
|
+
[attr.y]="innerH() + 38"
|
|
5097
|
+
class="axis-title x"
|
|
5098
|
+
text-anchor="middle"
|
|
5099
|
+
>{{ xTitle() }}</text>
|
|
5100
|
+
|
|
5101
|
+
<!-- Render Data Points -->
|
|
5102
|
+
@for (pt of scaledPoints(); track $index; let i = $index) {
|
|
5103
|
+
<circle
|
|
5104
|
+
[attr.cx]="pt.cx"
|
|
5105
|
+
[attr.cy]="pt.cy"
|
|
5106
|
+
[attr.r]="pt.r"
|
|
5107
|
+
[attr.fill]="pt.color"
|
|
5108
|
+
[attr.stroke]="'#ffffff'"
|
|
5109
|
+
stroke-width="1.5"
|
|
5110
|
+
class="scatter-point"
|
|
5111
|
+
[class.hovered]="hoveredPointIndex() === i"
|
|
5112
|
+
(mouseenter)="onPointHover($event, pt.raw, i)"
|
|
5113
|
+
/>
|
|
5114
|
+
}
|
|
5115
|
+
|
|
5116
|
+
<!-- Base axes borders -->
|
|
5117
|
+
<line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
5118
|
+
<line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
5119
|
+
</g>
|
|
5120
|
+
</svg>
|
|
5121
|
+
|
|
5122
|
+
<!-- Tooltip -->
|
|
5123
|
+
@if (tooltip(); as t) {
|
|
5124
|
+
<div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
|
|
5125
|
+
@if (t.label) {
|
|
5126
|
+
<div class="tooltip-header">{{ t.label }}</div>
|
|
5127
|
+
}
|
|
5128
|
+
<div class="tooltip-body">
|
|
5129
|
+
@if (t.group) {
|
|
5130
|
+
<div class="tooltip-group">Group: <strong>{{ t.group }}</strong></div>
|
|
5131
|
+
}
|
|
5132
|
+
<div class="tooltip-val">{{ xTitle() }}: <strong>{{ fmtNum(ptX(t)) }}</strong></div>
|
|
5133
|
+
<div class="tooltip-val">{{ yTitle() }}: <strong>{{ fmtNum(ptY(t)) }}</strong></div>
|
|
5134
|
+
</div>
|
|
5135
|
+
</div>
|
|
5136
|
+
}
|
|
5137
|
+
</div>
|
|
5138
|
+
</div>
|
|
5139
|
+
`, 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 });
|
|
5140
|
+
}
|
|
5141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ScatterPlotComponent, decorators: [{
|
|
5142
|
+
type: Component,
|
|
5143
|
+
args: [{ selector: 'ngx-scatter-plot', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
5144
|
+
<div class="ngx-scatter-plot" [class.dark]="theme() === 'dark'">
|
|
5145
|
+
<!-- Legend -->
|
|
5146
|
+
@if (showLegend() && uniqueGroups().length > 0) {
|
|
5147
|
+
<div class="chart-legend">
|
|
5148
|
+
@for (group of uniqueGroups(); track group; let i = $index) {
|
|
5149
|
+
<span class="legend-item">
|
|
5150
|
+
<span class="legend-dot" [style.background]="groupColor(group)"></span>
|
|
5151
|
+
{{ group }}
|
|
5152
|
+
</span>
|
|
5153
|
+
}
|
|
5154
|
+
</div>
|
|
5155
|
+
}
|
|
5156
|
+
|
|
5157
|
+
<div class="chart-svg-container" #container>
|
|
5158
|
+
<svg
|
|
5159
|
+
[attr.width]="'100%'"
|
|
5160
|
+
[attr.height]="height()"
|
|
5161
|
+
class="chart-svg"
|
|
5162
|
+
(mouseleave)="onMouseLeave()"
|
|
5163
|
+
>
|
|
5164
|
+
<g [attr.transform]="'translate(' + PAD_LEFT + ',' + PAD_TOP + ')'">
|
|
5165
|
+
<!-- Grid Lines (Horizontal and Vertical) -->
|
|
5166
|
+
@if (showGrid()) {
|
|
5167
|
+
<!-- Horizontal Grid Lines -->
|
|
5168
|
+
@for (tick of yTicks(); track tick) {
|
|
5169
|
+
<line
|
|
5170
|
+
[attr.x1]="0"
|
|
5171
|
+
[attr.x2]="innerW()"
|
|
5172
|
+
[attr.y1]="yPos(tick)"
|
|
5173
|
+
[attr.y2]="yPos(tick)"
|
|
5174
|
+
stroke="var(--ngx-chart-grid, #ebedf0)"
|
|
5175
|
+
stroke-dasharray="3,3"
|
|
5176
|
+
/>
|
|
5177
|
+
}
|
|
5178
|
+
<!-- Vertical Grid Lines -->
|
|
5179
|
+
@for (tick of xTicks(); track tick) {
|
|
5180
|
+
<line
|
|
5181
|
+
[attr.x1]="xPos(tick)"
|
|
5182
|
+
[attr.x2]="xPos(tick)"
|
|
5183
|
+
[attr.y1]="0"
|
|
5184
|
+
[attr.y2]="innerH()"
|
|
5185
|
+
stroke="var(--ngx-chart-grid, #ebedf0)"
|
|
5186
|
+
stroke-dasharray="3,3"
|
|
5187
|
+
/>
|
|
5188
|
+
}
|
|
5189
|
+
}
|
|
5190
|
+
|
|
5191
|
+
<!-- Y-Axis Labels -->
|
|
5192
|
+
@for (tick of yTicks(); track tick) {
|
|
5193
|
+
<text
|
|
5194
|
+
x="-10"
|
|
5195
|
+
[attr.y]="yPos(tick) + 4"
|
|
5196
|
+
class="axis-label y"
|
|
5197
|
+
text-anchor="end"
|
|
5198
|
+
>{{ fmtNum(tick) }}</text>
|
|
5199
|
+
}
|
|
5200
|
+
<text
|
|
5201
|
+
[attr.transform]="'rotate(-90) translate(' + (-innerH()/2) + ', -36)'"
|
|
5202
|
+
class="axis-title y"
|
|
5203
|
+
text-anchor="middle"
|
|
5204
|
+
>{{ yTitle() }}</text>
|
|
5205
|
+
|
|
5206
|
+
<!-- X-Axis Labels -->
|
|
5207
|
+
@for (tick of xTicks(); track tick) {
|
|
5208
|
+
<text
|
|
5209
|
+
[attr.x]="xPos(tick)"
|
|
5210
|
+
[attr.y]="innerH() + 20"
|
|
5211
|
+
class="axis-label x"
|
|
5212
|
+
text-anchor="middle"
|
|
5213
|
+
>{{ fmtNum(tick) }}</text>
|
|
5214
|
+
}
|
|
5215
|
+
<text
|
|
5216
|
+
[attr.x]="innerW() / 2"
|
|
5217
|
+
[attr.y]="innerH() + 38"
|
|
5218
|
+
class="axis-title x"
|
|
5219
|
+
text-anchor="middle"
|
|
5220
|
+
>{{ xTitle() }}</text>
|
|
5221
|
+
|
|
5222
|
+
<!-- Render Data Points -->
|
|
5223
|
+
@for (pt of scaledPoints(); track $index; let i = $index) {
|
|
5224
|
+
<circle
|
|
5225
|
+
[attr.cx]="pt.cx"
|
|
5226
|
+
[attr.cy]="pt.cy"
|
|
5227
|
+
[attr.r]="pt.r"
|
|
5228
|
+
[attr.fill]="pt.color"
|
|
5229
|
+
[attr.stroke]="'#ffffff'"
|
|
5230
|
+
stroke-width="1.5"
|
|
5231
|
+
class="scatter-point"
|
|
5232
|
+
[class.hovered]="hoveredPointIndex() === i"
|
|
5233
|
+
(mouseenter)="onPointHover($event, pt.raw, i)"
|
|
5234
|
+
/>
|
|
5235
|
+
}
|
|
5236
|
+
|
|
5237
|
+
<!-- Base axes borders -->
|
|
5238
|
+
<line x1="0" [attr.x2]="innerW()" [attr.y1]="innerH()" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
5239
|
+
<line x1="0" x2="0" y1="0" [attr.y2]="innerH()" stroke="var(--ngx-chart-axis, #ced4da)"/>
|
|
5240
|
+
</g>
|
|
5241
|
+
</svg>
|
|
5242
|
+
|
|
5243
|
+
<!-- Tooltip -->
|
|
5244
|
+
@if (tooltip(); as t) {
|
|
5245
|
+
<div class="chart-tooltip" [style.left.px]="t.x" [style.top.px]="t.y">
|
|
5246
|
+
@if (t.label) {
|
|
5247
|
+
<div class="tooltip-header">{{ t.label }}</div>
|
|
5248
|
+
}
|
|
5249
|
+
<div class="tooltip-body">
|
|
5250
|
+
@if (t.group) {
|
|
5251
|
+
<div class="tooltip-group">Group: <strong>{{ t.group }}</strong></div>
|
|
5252
|
+
}
|
|
5253
|
+
<div class="tooltip-val">{{ xTitle() }}: <strong>{{ fmtNum(ptX(t)) }}</strong></div>
|
|
5254
|
+
<div class="tooltip-val">{{ yTitle() }}: <strong>{{ fmtNum(ptY(t)) }}</strong></div>
|
|
5255
|
+
</div>
|
|
5256
|
+
</div>
|
|
5257
|
+
}
|
|
5258
|
+
</div>
|
|
5259
|
+
</div>
|
|
5260
|
+
`, 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"] }]
|
|
5261
|
+
}] });
|
|
5262
|
+
|
|
4443
5263
|
/*
|
|
4444
5264
|
* Public API Surface — secondary entry point: ngx-core-components/charts
|
|
4445
5265
|
*/
|
|
@@ -4449,5 +5269,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
4449
5269
|
* Generated bundle index. Do not edit.
|
|
4450
5270
|
*/
|
|
4451
5271
|
|
|
4452
|
-
export { AreaChartComponent, BarChartComponent, CHART_COLORS, DEFAULT_GANTT_CONFIG, DependencyType, FunnelChartComponent, GanttChartComponent, GanttItemType, GanttLinkLineType, GanttPrintService, GanttScaleService, GaugeChartComponent, HeatmapChartComponent, LineChartComponent, PieChartComponent, RadarChartComponent, SparklineComponent, TreemapChartComponent, ZoomLevel, addDays, addHours, addMonths, addQuarters, addWeeks, addYears, daysInMonth, diffDays, diffHours, getColumnDates, getDateRange, isWeekend, snapToDay, startOfDay, startOfHour, startOfMonth, startOfQuarter, startOfWeek, startOfYear };
|
|
5272
|
+
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 };
|
|
4453
5273
|
//# sourceMappingURL=ngx-core-components-charts.mjs.map
|