@memberjunction/ng-clustering 0.0.1 → 5.24.0
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/README.md +441 -27
- package/dist/__tests__/clustering-service.test.d.ts +2 -0
- package/dist/__tests__/clustering-service.test.d.ts.map +1 -0
- package/dist/__tests__/clustering-service.test.js +487 -0
- package/dist/__tests__/clustering-service.test.js.map +1 -0
- package/dist/__tests__/clustering-types.test.d.ts +2 -0
- package/dist/__tests__/clustering-types.test.d.ts.map +1 -0
- package/dist/__tests__/clustering-types.test.js +254 -0
- package/dist/__tests__/clustering-types.test.js.map +1 -0
- package/dist/__tests__/index.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts.map +1 -0
- package/dist/__tests__/index.test.js +7 -0
- package/dist/__tests__/index.test.js.map +1 -0
- package/dist/__tests__/scatter-component-logic.test.d.ts +2 -0
- package/dist/__tests__/scatter-component-logic.test.d.ts.map +1 -0
- package/dist/__tests__/scatter-component-logic.test.js +494 -0
- package/dist/__tests__/scatter-component-logic.test.js.map +1 -0
- package/dist/lib/cluster-config-panel.component.d.ts +274 -0
- package/dist/lib/cluster-config-panel.component.d.ts.map +1 -0
- package/dist/lib/cluster-config-panel.component.js +732 -0
- package/dist/lib/cluster-config-panel.component.js.map +1 -0
- package/dist/lib/cluster-scatter.component.d.ts +572 -0
- package/dist/lib/cluster-scatter.component.d.ts.map +1 -0
- package/dist/lib/cluster-scatter.component.js +1410 -0
- package/dist/lib/cluster-scatter.component.js.map +1 -0
- package/dist/lib/clustering.module.d.ts +12 -0
- package/dist/lib/clustering.module.d.ts.map +1 -0
- package/dist/lib/clustering.module.js +38 -0
- package/dist/lib/clustering.module.js.map +1 -0
- package/dist/lib/clustering.service.d.ts +43 -0
- package/dist/lib/clustering.service.d.ts.map +1 -0
- package/dist/lib/clustering.service.js +253 -0
- package/dist/lib/clustering.service.js.map +1 -0
- package/dist/lib/clustering.types.d.ts +271 -0
- package/dist/lib/clustering.types.d.ts.map +1 -0
- package/dist/lib/clustering.types.js +74 -0
- package/dist/lib/clustering.types.js.map +1 -0
- package/dist/public-api.d.ts +6 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +11 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +41 -6
|
@@ -0,0 +1,1410 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview SVG scatter plot component for cluster visualization.
|
|
3
|
+
*
|
|
4
|
+
* `ClusterScatterComponent` renders an interactive 2D scatter plot where each
|
|
5
|
+
* dot represents a clustered entity record. It supports:
|
|
6
|
+
*
|
|
7
|
+
* - **Zoom / pan** via mouse wheel and drag (SVG viewBox manipulation)
|
|
8
|
+
* - **Tooltips** on hover showing point metadata
|
|
9
|
+
* - **Legend** overlay in the bottom-left corner
|
|
10
|
+
* - **Radial gradient glow** per cluster centroid
|
|
11
|
+
* - **Cancelable `BeforeXXX` events** so consumers can intercept interactions
|
|
12
|
+
* - **Programmatic selection and zoom** via public methods
|
|
13
|
+
* - **Full customization** of dot radius, opacity, color palette, and more
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <mj-cluster-scatter
|
|
18
|
+
* [Points]="result.Points"
|
|
19
|
+
* [Clusters]="result.Clusters"
|
|
20
|
+
* [DotRadius]="6"
|
|
21
|
+
* [ShowTooltip]="true"
|
|
22
|
+
* [ColorPalette]="['#ff0000','#00ff00','#0000ff']"
|
|
23
|
+
* (BeforePointClick)="onBeforeClick($event)"
|
|
24
|
+
* (PointClicked)="onPointClicked($event)"
|
|
25
|
+
* (AfterClusteringComplete)="onClustered($event)"
|
|
26
|
+
* (SelectionChanged)="onSelectionChanged($event)">
|
|
27
|
+
* </mj-cluster-scatter>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
import { Component, Input, Output, EventEmitter, ElementRef, ChangeDetectorRef, ViewChild, ViewEncapsulation, inject, } from '@angular/core';
|
|
31
|
+
import { CLUSTER_COLORS, } from './clustering.types';
|
|
32
|
+
import * as i0 from "@angular/core";
|
|
33
|
+
import * as i1 from "@angular/forms";
|
|
34
|
+
import * as i2 from "@memberjunction/ng-entity-card";
|
|
35
|
+
const _c0 = ["svgElement"];
|
|
36
|
+
function ClusterScatterComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
37
|
+
i0.ɵɵelementStart(0, "div", 2)(1, "div", 8);
|
|
38
|
+
i0.ɵɵelement(2, "i", 9);
|
|
39
|
+
i0.ɵɵelementStart(3, "span");
|
|
40
|
+
i0.ɵɵtext(4, "Computing clusters...");
|
|
41
|
+
i0.ɵɵelementEnd()()();
|
|
42
|
+
} }
|
|
43
|
+
function ClusterScatterComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
44
|
+
i0.ɵɵelementStart(0, "div", 3);
|
|
45
|
+
i0.ɵɵelement(1, "i", 10);
|
|
46
|
+
i0.ɵɵelementStart(2, "p");
|
|
47
|
+
i0.ɵɵtext(3, "No data to display");
|
|
48
|
+
i0.ɵɵelementEnd();
|
|
49
|
+
i0.ɵɵelementStart(4, "p", 11);
|
|
50
|
+
i0.ɵɵtext(5, "Configure and run clustering to see results");
|
|
51
|
+
i0.ɵɵelementEnd()();
|
|
52
|
+
} }
|
|
53
|
+
function ClusterScatterComponent_Conditional_3_For_4_Template(rf, ctx) { if (rf & 1) {
|
|
54
|
+
i0.ɵɵnamespaceSVG();
|
|
55
|
+
i0.ɵɵelementStart(0, "radialGradient", 13);
|
|
56
|
+
i0.ɵɵelement(1, "stop", 16)(2, "stop", 17);
|
|
57
|
+
i0.ɵɵelementEnd();
|
|
58
|
+
} if (rf & 2) {
|
|
59
|
+
const centroid_r3 = ctx.$implicit;
|
|
60
|
+
i0.ɵɵattribute("id", "cluster-glow-" + centroid_r3.ClusterId);
|
|
61
|
+
i0.ɵɵadvance();
|
|
62
|
+
i0.ɵɵattribute("stop-color", centroid_r3.Color);
|
|
63
|
+
i0.ɵɵadvance();
|
|
64
|
+
i0.ɵɵattribute("stop-color", centroid_r3.Color);
|
|
65
|
+
} }
|
|
66
|
+
function ClusterScatterComponent_Conditional_3_For_7_Template(rf, ctx) { if (rf & 1) {
|
|
67
|
+
i0.ɵɵnamespaceSVG();
|
|
68
|
+
i0.ɵɵelement(0, "line");
|
|
69
|
+
} if (rf & 2) {
|
|
70
|
+
const y_r4 = ctx.$implicit;
|
|
71
|
+
i0.ɵɵattribute("x1", 0)("y1", y_r4)("x2", 1000)("y2", y_r4);
|
|
72
|
+
} }
|
|
73
|
+
function ClusterScatterComponent_Conditional_3_For_9_Template(rf, ctx) { if (rf & 1) {
|
|
74
|
+
i0.ɵɵnamespaceSVG();
|
|
75
|
+
i0.ɵɵelement(0, "line");
|
|
76
|
+
} if (rf & 2) {
|
|
77
|
+
const x_r5 = ctx.$implicit;
|
|
78
|
+
i0.ɵɵattribute("x1", x_r5)("y1", 0)("x2", x_r5)("y2", 700);
|
|
79
|
+
} }
|
|
80
|
+
function ClusterScatterComponent_Conditional_3_For_11_Template(rf, ctx) { if (rf & 1) {
|
|
81
|
+
i0.ɵɵnamespaceSVG();
|
|
82
|
+
i0.ɵɵelement(0, "circle");
|
|
83
|
+
} if (rf & 2) {
|
|
84
|
+
const centroid_r6 = ctx.$implicit;
|
|
85
|
+
i0.ɵɵattribute("cx", centroid_r6.Cx)("cy", centroid_r6.Cy)("r", centroid_r6.R)("fill", "url(#cluster-glow-" + centroid_r6.ClusterId + ")");
|
|
86
|
+
} }
|
|
87
|
+
function ClusterScatterComponent_Conditional_3_For_13_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
88
|
+
i0.ɵɵnamespaceSVG();
|
|
89
|
+
i0.ɵɵelementStart(0, "text", 18);
|
|
90
|
+
i0.ɵɵtext(1);
|
|
91
|
+
i0.ɵɵelementEnd();
|
|
92
|
+
} if (rf & 2) {
|
|
93
|
+
const centroid_r7 = i0.ɵɵnextContext().$implicit;
|
|
94
|
+
i0.ɵɵattribute("x", centroid_r7.Cx)("y", centroid_r7.Cy - centroid_r7.R - 8)("fill", centroid_r7.Color);
|
|
95
|
+
i0.ɵɵadvance();
|
|
96
|
+
i0.ɵɵtextInterpolate(ctx);
|
|
97
|
+
} }
|
|
98
|
+
function ClusterScatterComponent_Conditional_3_For_13_Template(rf, ctx) { if (rf & 1) {
|
|
99
|
+
i0.ɵɵconditionalCreate(0, ClusterScatterComponent_Conditional_3_For_13_Conditional_0_Template, 2, 4, ":svg:text", 18);
|
|
100
|
+
} if (rf & 2) {
|
|
101
|
+
let tmp_12_0;
|
|
102
|
+
const centroid_r7 = ctx.$implicit;
|
|
103
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
104
|
+
i0.ɵɵconditional((tmp_12_0 = ctx_r1.GetClusterLabelById(centroid_r7.ClusterId)) ? 0 : -1, tmp_12_0);
|
|
105
|
+
} }
|
|
106
|
+
function ClusterScatterComponent_Conditional_3_For_15_Template(rf, ctx) { if (rf & 1) {
|
|
107
|
+
const _r8 = i0.ɵɵgetCurrentView();
|
|
108
|
+
i0.ɵɵnamespaceSVG();
|
|
109
|
+
i0.ɵɵelementStart(0, "circle", 19);
|
|
110
|
+
i0.ɵɵlistener("mouseenter", function ClusterScatterComponent_Conditional_3_For_15_Template_circle_mouseenter_0_listener($event) { const point_r9 = i0.ɵɵrestoreView(_r8).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnPointMouseEnter(point_r9, $event)); })("mouseleave", function ClusterScatterComponent_Conditional_3_For_15_Template_circle_mouseleave_0_listener() { i0.ɵɵrestoreView(_r8); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnPointMouseLeave()); })("click", function ClusterScatterComponent_Conditional_3_For_15_Template_circle_click_0_listener($event) { const point_r9 = i0.ɵɵrestoreView(_r8).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); ctx_r1.OnPointClick(point_r9); return i0.ɵɵresetView($event.stopPropagation()); });
|
|
111
|
+
i0.ɵɵelementEnd();
|
|
112
|
+
} if (rf & 2) {
|
|
113
|
+
const point_r9 = ctx.$implicit;
|
|
114
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
115
|
+
i0.ɵɵattribute("cx", point_r9.X)("cy", point_r9.Y)("r", ctx_r1.GetPointRadius(point_r9))("fill", ctx_r1.GetPointColor(point_r9))("opacity", ctx_r1.GetPointOpacity(point_r9));
|
|
116
|
+
} }
|
|
117
|
+
function ClusterScatterComponent_Conditional_3_For_17_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
118
|
+
i0.ɵɵnamespaceSVG();
|
|
119
|
+
i0.ɵɵelement(0, "circle", 20);
|
|
120
|
+
} if (rf & 2) {
|
|
121
|
+
const point_r10 = i0.ɵɵnextContext().$implicit;
|
|
122
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
123
|
+
i0.ɵɵattribute("cx", point_r10.X)("cy", point_r10.Y)("r", ctx_r1.HighlightRadius + 2)("stroke", ctx_r1.GetPointColor(point_r10));
|
|
124
|
+
} }
|
|
125
|
+
function ClusterScatterComponent_Conditional_3_For_17_Template(rf, ctx) { if (rf & 1) {
|
|
126
|
+
i0.ɵɵconditionalCreate(0, ClusterScatterComponent_Conditional_3_For_17_Conditional_0_Template, 1, 4, ":svg:circle", 20);
|
|
127
|
+
} if (rf & 2) {
|
|
128
|
+
const point_r10 = ctx.$implicit;
|
|
129
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
130
|
+
i0.ɵɵconditional(ctx_r1.IsSelected(point_r10) ? 0 : -1);
|
|
131
|
+
} }
|
|
132
|
+
function ClusterScatterComponent_Conditional_3_Conditional_18_For_1_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
133
|
+
i0.ɵɵnamespaceSVG();
|
|
134
|
+
i0.ɵɵelement(0, "circle", 21);
|
|
135
|
+
} if (rf & 2) {
|
|
136
|
+
const point_r11 = i0.ɵɵnextContext().$implicit;
|
|
137
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
138
|
+
i0.ɵɵattribute("cx", point_r11.X)("cy", point_r11.Y)("r", ctx_r1.HighlightRadius + 4)("stroke", ctx_r1.GetPointColor(point_r11));
|
|
139
|
+
} }
|
|
140
|
+
function ClusterScatterComponent_Conditional_3_Conditional_18_For_1_Template(rf, ctx) { if (rf & 1) {
|
|
141
|
+
i0.ɵɵconditionalCreate(0, ClusterScatterComponent_Conditional_3_Conditional_18_For_1_Conditional_0_Template, 1, 4, ":svg:circle", 21);
|
|
142
|
+
} if (rf & 2) {
|
|
143
|
+
const point_r11 = ctx.$implicit;
|
|
144
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
145
|
+
i0.ɵɵconditional(ctx_r1.IsHighlighted(point_r11) ? 0 : -1);
|
|
146
|
+
} }
|
|
147
|
+
function ClusterScatterComponent_Conditional_3_Conditional_18_Template(rf, ctx) { if (rf & 1) {
|
|
148
|
+
i0.ɵɵrepeaterCreate(0, ClusterScatterComponent_Conditional_3_Conditional_18_For_1_Template, 1, 1, null, null, i0.ɵɵcomponentInstance().TrackPointBy, true);
|
|
149
|
+
} if (rf & 2) {
|
|
150
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
151
|
+
i0.ɵɵrepeater(ctx_r1.Points);
|
|
152
|
+
} }
|
|
153
|
+
function ClusterScatterComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
154
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
155
|
+
i0.ɵɵnamespaceSVG();
|
|
156
|
+
i0.ɵɵelementStart(0, "svg", 12, 0);
|
|
157
|
+
i0.ɵɵlistener("wheel", function ClusterScatterComponent_Conditional_3_Template_svg_wheel_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnWheel($event)); })("mousedown", function ClusterScatterComponent_Conditional_3_Template_svg_mousedown_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnMouseDown($event)); });
|
|
158
|
+
i0.ɵɵelementStart(2, "defs");
|
|
159
|
+
i0.ɵɵrepeaterCreate(3, ClusterScatterComponent_Conditional_3_For_4_Template, 3, 3, ":svg:radialGradient", 13, i0.ɵɵcomponentInstance().TrackCentroidBy, true);
|
|
160
|
+
i0.ɵɵelementEnd();
|
|
161
|
+
i0.ɵɵelementStart(5, "g", 14);
|
|
162
|
+
i0.ɵɵrepeaterCreate(6, ClusterScatterComponent_Conditional_3_For_7_Template, 1, 4, ":svg:line", null, i0.ɵɵrepeaterTrackByIdentity);
|
|
163
|
+
i0.ɵɵrepeaterCreate(8, ClusterScatterComponent_Conditional_3_For_9_Template, 1, 4, ":svg:line", null, i0.ɵɵrepeaterTrackByIdentity);
|
|
164
|
+
i0.ɵɵelementEnd();
|
|
165
|
+
i0.ɵɵrepeaterCreate(10, ClusterScatterComponent_Conditional_3_For_11_Template, 1, 4, ":svg:circle", null, i0.ɵɵcomponentInstance().TrackCentroidBy, true);
|
|
166
|
+
i0.ɵɵrepeaterCreate(12, ClusterScatterComponent_Conditional_3_For_13_Template, 1, 1, null, null, i0.ɵɵcomponentInstance().TrackCentroidBy, true);
|
|
167
|
+
i0.ɵɵrepeaterCreate(14, ClusterScatterComponent_Conditional_3_For_15_Template, 1, 5, ":svg:circle", 15, i0.ɵɵcomponentInstance().TrackPointBy, true);
|
|
168
|
+
i0.ɵɵrepeaterCreate(16, ClusterScatterComponent_Conditional_3_For_17_Template, 1, 1, null, null, i0.ɵɵcomponentInstance().TrackPointBy, true);
|
|
169
|
+
i0.ɵɵconditionalCreate(18, ClusterScatterComponent_Conditional_3_Conditional_18_Template, 2, 0);
|
|
170
|
+
i0.ɵɵelementEnd();
|
|
171
|
+
} if (rf & 2) {
|
|
172
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
173
|
+
i0.ɵɵclassProp("no-transitions", !ctx_r1.AnimateTransitions);
|
|
174
|
+
i0.ɵɵattribute("viewBox", ctx_r1.ViewBoxString);
|
|
175
|
+
i0.ɵɵadvance(3);
|
|
176
|
+
i0.ɵɵrepeater(ctx_r1.ClusterCentroids);
|
|
177
|
+
i0.ɵɵadvance(3);
|
|
178
|
+
i0.ɵɵrepeater(ctx_r1.HorizontalGridLines);
|
|
179
|
+
i0.ɵɵadvance(2);
|
|
180
|
+
i0.ɵɵrepeater(ctx_r1.VerticalGridLines);
|
|
181
|
+
i0.ɵɵadvance(2);
|
|
182
|
+
i0.ɵɵrepeater(ctx_r1.ClusterCentroids);
|
|
183
|
+
i0.ɵɵadvance(2);
|
|
184
|
+
i0.ɵɵrepeater(ctx_r1.ClusterCentroids);
|
|
185
|
+
i0.ɵɵadvance(2);
|
|
186
|
+
i0.ɵɵrepeater(ctx_r1.Points);
|
|
187
|
+
i0.ɵɵadvance(2);
|
|
188
|
+
i0.ɵɵrepeater(ctx_r1.Points);
|
|
189
|
+
i0.ɵɵadvance(2);
|
|
190
|
+
i0.ɵɵconditional(ctx_r1.HighlightedKey ? 18 : -1);
|
|
191
|
+
} }
|
|
192
|
+
function ClusterScatterComponent_Conditional_4_For_4_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
193
|
+
const _r14 = i0.ɵɵgetCurrentView();
|
|
194
|
+
i0.ɵɵelementStart(0, "input", 28);
|
|
195
|
+
i0.ɵɵtwoWayListener("ngModelChange", function ClusterScatterComponent_Conditional_4_For_4_Conditional_2_Template_input_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r14); const ctx_r1 = i0.ɵɵnextContext(3); i0.ɵɵtwoWayBindingSet(ctx_r1.EditingLabelDraft, $event) || (ctx_r1.EditingLabelDraft = $event); return i0.ɵɵresetView($event); });
|
|
196
|
+
i0.ɵɵlistener("keydown", function ClusterScatterComponent_Conditional_4_For_4_Conditional_2_Template_input_keydown_0_listener($event) { i0.ɵɵrestoreView(_r14); const cluster_r13 = i0.ɵɵnextContext().$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnLabelEditKeydown($event, cluster_r13)); })("blur", function ClusterScatterComponent_Conditional_4_For_4_Conditional_2_Template_input_blur_0_listener() { i0.ɵɵrestoreView(_r14); const cluster_r13 = i0.ɵɵnextContext().$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.CommitLabelEdit(cluster_r13)); })("click", function ClusterScatterComponent_Conditional_4_For_4_Conditional_2_Template_input_click_0_listener($event) { i0.ɵɵrestoreView(_r14); return i0.ɵɵresetView($event.stopPropagation()); });
|
|
197
|
+
i0.ɵɵelementEnd();
|
|
198
|
+
} if (rf & 2) {
|
|
199
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
200
|
+
i0.ɵɵtwoWayProperty("ngModel", ctx_r1.EditingLabelDraft);
|
|
201
|
+
} }
|
|
202
|
+
function ClusterScatterComponent_Conditional_4_For_4_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
203
|
+
const _r15 = i0.ɵɵgetCurrentView();
|
|
204
|
+
i0.ɵɵelementStart(0, "span", 29);
|
|
205
|
+
i0.ɵɵtext(1);
|
|
206
|
+
i0.ɵɵelementEnd();
|
|
207
|
+
i0.ɵɵelementStart(2, "button", 30);
|
|
208
|
+
i0.ɵɵlistener("click", function ClusterScatterComponent_Conditional_4_For_4_Conditional_3_Template_button_click_2_listener($event) { i0.ɵɵrestoreView(_r15); const cluster_r13 = i0.ɵɵnextContext().$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.StartLabelEdit(cluster_r13, $event)); });
|
|
209
|
+
i0.ɵɵelement(3, "i", 31);
|
|
210
|
+
i0.ɵɵelementEnd();
|
|
211
|
+
} if (rf & 2) {
|
|
212
|
+
const cluster_r13 = i0.ɵɵnextContext().$implicit;
|
|
213
|
+
i0.ɵɵadvance();
|
|
214
|
+
i0.ɵɵtextInterpolate(cluster_r13.Label);
|
|
215
|
+
} }
|
|
216
|
+
function ClusterScatterComponent_Conditional_4_For_4_Template(rf, ctx) { if (rf & 1) {
|
|
217
|
+
const _r12 = i0.ɵɵgetCurrentView();
|
|
218
|
+
i0.ɵɵelementStart(0, "div", 24);
|
|
219
|
+
i0.ɵɵlistener("click", function ClusterScatterComponent_Conditional_4_For_4_Template_div_click_0_listener() { const cluster_r13 = i0.ɵɵrestoreView(_r12).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnClusterLegendClick(cluster_r13)); });
|
|
220
|
+
i0.ɵɵelement(1, "div", 25);
|
|
221
|
+
i0.ɵɵconditionalCreate(2, ClusterScatterComponent_Conditional_4_For_4_Conditional_2_Template, 1, 1, "input", 26)(3, ClusterScatterComponent_Conditional_4_For_4_Conditional_3_Template, 4, 1);
|
|
222
|
+
i0.ɵɵelementStart(4, "span", 27);
|
|
223
|
+
i0.ɵɵtext(5);
|
|
224
|
+
i0.ɵɵelementEnd()();
|
|
225
|
+
} if (rf & 2) {
|
|
226
|
+
const cluster_r13 = ctx.$implicit;
|
|
227
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
228
|
+
i0.ɵɵadvance();
|
|
229
|
+
i0.ɵɵstyleProp("background", cluster_r13.Color);
|
|
230
|
+
i0.ɵɵadvance();
|
|
231
|
+
i0.ɵɵconditional(ctx_r1.EditingClusterId === cluster_r13.Id ? 2 : 3);
|
|
232
|
+
i0.ɵɵadvance(3);
|
|
233
|
+
i0.ɵɵtextInterpolate(cluster_r13.MemberCount);
|
|
234
|
+
} }
|
|
235
|
+
function ClusterScatterComponent_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
236
|
+
i0.ɵɵelementStart(0, "div", 5)(1, "div", 22);
|
|
237
|
+
i0.ɵɵtext(2, "Clusters");
|
|
238
|
+
i0.ɵɵelementEnd();
|
|
239
|
+
i0.ɵɵrepeaterCreate(3, ClusterScatterComponent_Conditional_4_For_4_Template, 6, 4, "div", 23, i0.ɵɵcomponentInstance().TrackClusterBy, true);
|
|
240
|
+
i0.ɵɵelementEnd();
|
|
241
|
+
} if (rf & 2) {
|
|
242
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
243
|
+
i0.ɵɵadvance(3);
|
|
244
|
+
i0.ɵɵrepeater(ctx_r1.Clusters);
|
|
245
|
+
} }
|
|
246
|
+
function ClusterScatterComponent_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
247
|
+
i0.ɵɵelementStart(0, "div", 32);
|
|
248
|
+
i0.ɵɵelement(1, "mj-entity-card", 33);
|
|
249
|
+
i0.ɵɵelementStart(2, "div", 34);
|
|
250
|
+
i0.ɵɵelement(3, "i", 35);
|
|
251
|
+
i0.ɵɵtext(4);
|
|
252
|
+
i0.ɵɵelementEnd();
|
|
253
|
+
i0.ɵɵelementStart(5, "div", 36);
|
|
254
|
+
i0.ɵɵelement(6, "i", 37);
|
|
255
|
+
i0.ɵɵtext(7, " Click to view details ");
|
|
256
|
+
i0.ɵɵelementEnd()();
|
|
257
|
+
} if (rf & 2) {
|
|
258
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
259
|
+
i0.ɵɵstyleProp("left", ctx_r1.TooltipX, "px")("top", ctx_r1.TooltipY, "px");
|
|
260
|
+
i0.ɵɵadvance();
|
|
261
|
+
i0.ɵɵproperty("EntityName", ctx_r1.EntityName)("Record", ctx_r1.HoveredPoint.Metadata);
|
|
262
|
+
i0.ɵɵadvance(3);
|
|
263
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r1.GetClusterLabel(ctx_r1.HoveredPoint), " ");
|
|
264
|
+
} }
|
|
265
|
+
function ClusterScatterComponent_Conditional_7_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
266
|
+
i0.ɵɵelementStart(0, "div", 40);
|
|
267
|
+
i0.ɵɵelement(1, "i");
|
|
268
|
+
i0.ɵɵelementEnd();
|
|
269
|
+
} if (rf & 2) {
|
|
270
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
271
|
+
i0.ɵɵadvance();
|
|
272
|
+
i0.ɵɵclassMap(ctx_r1.SelectedPoint.Metadata["EntityIcon"]);
|
|
273
|
+
} }
|
|
274
|
+
function ClusterScatterComponent_Conditional_7_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
275
|
+
i0.ɵɵelementStart(0, "span", 43);
|
|
276
|
+
i0.ɵɵtext(1);
|
|
277
|
+
i0.ɵɵelementEnd();
|
|
278
|
+
} if (rf & 2) {
|
|
279
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
280
|
+
i0.ɵɵadvance();
|
|
281
|
+
i0.ɵɵtextInterpolate(ctx_r1.SelectedPoint.Metadata["Entity"]);
|
|
282
|
+
} }
|
|
283
|
+
function ClusterScatterComponent_Conditional_7_Conditional_20_For_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
284
|
+
i0.ɵɵelement(0, "i", 60);
|
|
285
|
+
} if (rf & 2) {
|
|
286
|
+
const member_r18 = i0.ɵɵnextContext().$implicit;
|
|
287
|
+
i0.ɵɵclassMap(member_r18.Metadata["EntityIcon"]);
|
|
288
|
+
} }
|
|
289
|
+
function ClusterScatterComponent_Conditional_7_Conditional_20_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
290
|
+
const _r17 = i0.ɵɵgetCurrentView();
|
|
291
|
+
i0.ɵɵelementStart(0, "div", 57);
|
|
292
|
+
i0.ɵɵlistener("click", function ClusterScatterComponent_Conditional_7_Conditional_20_For_2_Template_div_click_0_listener() { const member_r18 = i0.ɵɵrestoreView(_r17).$implicit; const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.OnClusterMemberClick(member_r18)); });
|
|
293
|
+
i0.ɵɵconditionalCreate(1, ClusterScatterComponent_Conditional_7_Conditional_20_For_2_Conditional_1_Template, 1, 2, "i", 58);
|
|
294
|
+
i0.ɵɵelementStart(2, "span", 59);
|
|
295
|
+
i0.ɵɵtext(3);
|
|
296
|
+
i0.ɵɵelementEnd()();
|
|
297
|
+
} if (rf & 2) {
|
|
298
|
+
const member_r18 = ctx.$implicit;
|
|
299
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
300
|
+
i0.ɵɵclassProp("active", member_r18.VectorKey === ctx_r1.SelectedPoint.VectorKey);
|
|
301
|
+
i0.ɵɵadvance();
|
|
302
|
+
i0.ɵɵconditional((member_r18.Metadata == null ? null : member_r18.Metadata["EntityIcon"]) ? 1 : -1);
|
|
303
|
+
i0.ɵɵadvance(2);
|
|
304
|
+
i0.ɵɵtextInterpolate(member_r18.Label);
|
|
305
|
+
} }
|
|
306
|
+
function ClusterScatterComponent_Conditional_7_Conditional_20_Template(rf, ctx) { if (rf & 1) {
|
|
307
|
+
i0.ɵɵelementStart(0, "div", 53);
|
|
308
|
+
i0.ɵɵrepeaterCreate(1, ClusterScatterComponent_Conditional_7_Conditional_20_For_2_Template, 4, 4, "div", 56, i0.ɵɵcomponentInstance().TrackMemberBy, true);
|
|
309
|
+
i0.ɵɵelementEnd();
|
|
310
|
+
} if (rf & 2) {
|
|
311
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
312
|
+
i0.ɵɵadvance();
|
|
313
|
+
i0.ɵɵrepeater(ctx_r1.ClusterMembers);
|
|
314
|
+
} }
|
|
315
|
+
function ClusterScatterComponent_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
316
|
+
const _r16 = i0.ɵɵgetCurrentView();
|
|
317
|
+
i0.ɵɵelementStart(0, "div", 38)(1, "div", 39);
|
|
318
|
+
i0.ɵɵconditionalCreate(2, ClusterScatterComponent_Conditional_7_Conditional_2_Template, 2, 2, "div", 40);
|
|
319
|
+
i0.ɵɵelementStart(3, "div", 41)(4, "div", 42);
|
|
320
|
+
i0.ɵɵtext(5);
|
|
321
|
+
i0.ɵɵelementEnd();
|
|
322
|
+
i0.ɵɵconditionalCreate(6, ClusterScatterComponent_Conditional_7_Conditional_6_Template, 2, 1, "span", 43);
|
|
323
|
+
i0.ɵɵelementEnd()();
|
|
324
|
+
i0.ɵɵelementStart(7, "button", 44);
|
|
325
|
+
i0.ɵɵlistener("click", function ClusterScatterComponent_Conditional_7_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r16); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.CloseDetailPanel()); });
|
|
326
|
+
i0.ɵɵelement(8, "i", 45);
|
|
327
|
+
i0.ɵɵelementEnd()();
|
|
328
|
+
i0.ɵɵelementStart(9, "div", 46);
|
|
329
|
+
i0.ɵɵelement(10, "span", 47);
|
|
330
|
+
i0.ɵɵtext(11);
|
|
331
|
+
i0.ɵɵelementEnd();
|
|
332
|
+
i0.ɵɵelement(12, "mj-entity-card", 48);
|
|
333
|
+
i0.ɵɵelementStart(13, "div", 49)(14, "button", 50);
|
|
334
|
+
i0.ɵɵlistener("click", function ClusterScatterComponent_Conditional_7_Template_button_click_14_listener() { i0.ɵɵrestoreView(_r16); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.ToggleClusterMembers()); });
|
|
335
|
+
i0.ɵɵelement(15, "i", 51);
|
|
336
|
+
i0.ɵɵelementStart(16, "span");
|
|
337
|
+
i0.ɵɵtext(17, "Cluster Members");
|
|
338
|
+
i0.ɵɵelementEnd();
|
|
339
|
+
i0.ɵɵelementStart(18, "span", 52);
|
|
340
|
+
i0.ɵɵtext(19);
|
|
341
|
+
i0.ɵɵelementEnd()();
|
|
342
|
+
i0.ɵɵconditionalCreate(20, ClusterScatterComponent_Conditional_7_Conditional_20_Template, 3, 0, "div", 53);
|
|
343
|
+
i0.ɵɵelementEnd();
|
|
344
|
+
i0.ɵɵelementStart(21, "div", 54)(22, "button", 55);
|
|
345
|
+
i0.ɵɵlistener("click", function ClusterScatterComponent_Conditional_7_Template_button_click_22_listener() { i0.ɵɵrestoreView(_r16); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnOpenRecordClick()); });
|
|
346
|
+
i0.ɵɵelement(23, "i", 37);
|
|
347
|
+
i0.ɵɵtext(24, " Open Record ");
|
|
348
|
+
i0.ɵɵelementEnd()();
|
|
349
|
+
} if (rf & 2) {
|
|
350
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
351
|
+
i0.ɵɵadvance(2);
|
|
352
|
+
i0.ɵɵconditional((ctx_r1.SelectedPoint.Metadata == null ? null : ctx_r1.SelectedPoint.Metadata["EntityIcon"]) ? 2 : -1);
|
|
353
|
+
i0.ɵɵadvance(3);
|
|
354
|
+
i0.ɵɵtextInterpolate(ctx_r1.SelectedPoint.Label);
|
|
355
|
+
i0.ɵɵadvance();
|
|
356
|
+
i0.ɵɵconditional((ctx_r1.SelectedPoint.Metadata == null ? null : ctx_r1.SelectedPoint.Metadata["Entity"]) ? 6 : -1);
|
|
357
|
+
i0.ɵɵadvance(4);
|
|
358
|
+
i0.ɵɵstyleProp("background", ctx_r1.GetClusterColor(ctx_r1.SelectedPoint.ClusterId));
|
|
359
|
+
i0.ɵɵadvance();
|
|
360
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r1.GetClusterLabel(ctx_r1.SelectedPoint), " ");
|
|
361
|
+
i0.ɵɵadvance();
|
|
362
|
+
i0.ɵɵproperty("EntityName", ctx_r1.EntityName)("Record", ctx_r1.SelectedPoint.Metadata);
|
|
363
|
+
i0.ɵɵadvance(3);
|
|
364
|
+
i0.ɵɵclassProp("fa-chevron-down", ctx_r1.ClusterMembersExpanded)("fa-chevron-right", !ctx_r1.ClusterMembersExpanded);
|
|
365
|
+
i0.ɵɵadvance(4);
|
|
366
|
+
i0.ɵɵtextInterpolate(ctx_r1.ClusterMembers.length);
|
|
367
|
+
i0.ɵɵadvance();
|
|
368
|
+
i0.ɵɵconditional(ctx_r1.ClusterMembersExpanded ? 20 : -1);
|
|
369
|
+
} }
|
|
370
|
+
export class ClusterScatterComponent {
|
|
371
|
+
constructor() {
|
|
372
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
373
|
+
// ================================================================
|
|
374
|
+
// Data Inputs
|
|
375
|
+
// ================================================================
|
|
376
|
+
/**
|
|
377
|
+
* Array of 2D-projected points to render.
|
|
378
|
+
*
|
|
379
|
+
* Each point carries its cluster assignment, label, and metadata.
|
|
380
|
+
* Typically produced by `ClusteringService.RunPipeline()`.
|
|
381
|
+
*/
|
|
382
|
+
this.Points = [];
|
|
383
|
+
/**
|
|
384
|
+
* Cluster summary information used for the legend and color mapping.
|
|
385
|
+
*/
|
|
386
|
+
this.Clusters = [];
|
|
387
|
+
/**
|
|
388
|
+
* When `true`, a semi-transparent loading overlay is displayed
|
|
389
|
+
* on top of the scatter plot.
|
|
390
|
+
*/
|
|
391
|
+
this.IsLoading = false;
|
|
392
|
+
// ================================================================
|
|
393
|
+
// Customization Inputs
|
|
394
|
+
// ================================================================
|
|
395
|
+
/**
|
|
396
|
+
* Base radius (in SVG units) for each data point dot.
|
|
397
|
+
*
|
|
398
|
+
* @default 5
|
|
399
|
+
*/
|
|
400
|
+
this.DotRadius = 5;
|
|
401
|
+
/**
|
|
402
|
+
* Base opacity for data point dots (0 to 1).
|
|
403
|
+
*
|
|
404
|
+
* When a point is hovered, non-hovered points are dimmed below this value.
|
|
405
|
+
*
|
|
406
|
+
* @default 0.75
|
|
407
|
+
*/
|
|
408
|
+
this.DotOpacity = 0.75;
|
|
409
|
+
/**
|
|
410
|
+
* Radius used for the highlight ring on hovered or selected points.
|
|
411
|
+
*
|
|
412
|
+
* @default 8
|
|
413
|
+
*/
|
|
414
|
+
this.HighlightRadius = 8;
|
|
415
|
+
/**
|
|
416
|
+
* Whether to show the color-coded cluster legend overlay.
|
|
417
|
+
*
|
|
418
|
+
* @default true
|
|
419
|
+
*/
|
|
420
|
+
this.ShowLegend = true;
|
|
421
|
+
/**
|
|
422
|
+
* Whether to show the tooltip popup on point hover.
|
|
423
|
+
*
|
|
424
|
+
* When `false`, `BeforePointHover` and `PointHovered` still fire but
|
|
425
|
+
* the built-in tooltip DOM is not rendered.
|
|
426
|
+
*
|
|
427
|
+
* @default true
|
|
428
|
+
*/
|
|
429
|
+
this.ShowTooltip = true;
|
|
430
|
+
/**
|
|
431
|
+
* Which metadata keys to display inside the tooltip.
|
|
432
|
+
*
|
|
433
|
+
* When empty (the default), **all** metadata keys are shown.
|
|
434
|
+
*
|
|
435
|
+
* @default []
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* ```html
|
|
439
|
+
* <mj-cluster-scatter [TooltipFields]="['EntityRecordID', 'Score']">
|
|
440
|
+
* </mj-cluster-scatter>
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
this.TooltipFields = [];
|
|
444
|
+
/**
|
|
445
|
+
* Ordered list of metadata field keys for prioritized display in tooltips
|
|
446
|
+
* and the detail panel. When set, fields are displayed in this order instead
|
|
447
|
+
* of raw metadata key order. Fields not in this list appear after the
|
|
448
|
+
* prioritized fields.
|
|
449
|
+
*
|
|
450
|
+
* Typically computed from entity metadata (DefaultInView, Sequence) by the
|
|
451
|
+
* consuming component and passed in.
|
|
452
|
+
*
|
|
453
|
+
* @default [] (no prioritization — original key order)
|
|
454
|
+
*/
|
|
455
|
+
this.FieldPriority = [];
|
|
456
|
+
/**
|
|
457
|
+
* Map of field names to human-readable display names.
|
|
458
|
+
* Used to show "First Name" instead of "FirstName" in tooltips and detail panels.
|
|
459
|
+
* If a field is not in this map, the raw key is shown.
|
|
460
|
+
*
|
|
461
|
+
* @default {} (use raw key names)
|
|
462
|
+
*/
|
|
463
|
+
this.FieldDisplayNames = {};
|
|
464
|
+
/**
|
|
465
|
+
* The entity name for metadata-driven field display in tooltips and
|
|
466
|
+
* detail panels. When set, the mj-entity-card component uses EntityInfo
|
|
467
|
+
* to prioritize fields by IsNameField and DefaultInView.
|
|
468
|
+
*/
|
|
469
|
+
this.EntityName = null;
|
|
470
|
+
/**
|
|
471
|
+
* Override the default cluster color palette.
|
|
472
|
+
*
|
|
473
|
+
* Colors are assigned to clusters by index: cluster 0 gets
|
|
474
|
+
* `ColorPalette[0]`, cluster 1 gets `ColorPalette[1]`, etc.
|
|
475
|
+
* Wraps around when there are more clusters than colors.
|
|
476
|
+
*
|
|
477
|
+
* @default CLUSTER_COLORS (10 accessible colors)
|
|
478
|
+
*/
|
|
479
|
+
this.ColorPalette = [];
|
|
480
|
+
/**
|
|
481
|
+
* Enable or disable zoom via mouse wheel.
|
|
482
|
+
*
|
|
483
|
+
* @default true
|
|
484
|
+
*/
|
|
485
|
+
this.EnableZoom = true;
|
|
486
|
+
/**
|
|
487
|
+
* Enable or disable panning via click-and-drag.
|
|
488
|
+
*
|
|
489
|
+
* @default true
|
|
490
|
+
*/
|
|
491
|
+
this.EnablePan = true;
|
|
492
|
+
/**
|
|
493
|
+
* Whether scatter plot transitions (zoom, highlight) should be animated.
|
|
494
|
+
*
|
|
495
|
+
* @default true
|
|
496
|
+
*/
|
|
497
|
+
this.AnimateTransitions = true;
|
|
498
|
+
/**
|
|
499
|
+
* Externally controlled set of selected point IDs (by `VectorKey`).
|
|
500
|
+
*
|
|
501
|
+
* When provided, the component renders selection rings for matching
|
|
502
|
+
* points and emits `SelectionChanged` when the user modifies the set
|
|
503
|
+
* interactively.
|
|
504
|
+
*
|
|
505
|
+
* @default (empty Set)
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```html
|
|
509
|
+
* <mj-cluster-scatter
|
|
510
|
+
* [SelectedPointIds]="mySelectedIds"
|
|
511
|
+
* (SelectionChanged)="mySelectedIds = $event">
|
|
512
|
+
* </mj-cluster-scatter>
|
|
513
|
+
* ```
|
|
514
|
+
*/
|
|
515
|
+
this.SelectedPointIds = new Set();
|
|
516
|
+
/**
|
|
517
|
+
* Minimum zoom level (smallest allowed viewBox multiplier).
|
|
518
|
+
*
|
|
519
|
+
* A value of `0.5` means the user can zoom in until the viewBox is
|
|
520
|
+
* half of the default 1000x700 size.
|
|
521
|
+
*
|
|
522
|
+
* @default 0.5
|
|
523
|
+
*/
|
|
524
|
+
this.MinZoom = 0.5;
|
|
525
|
+
/**
|
|
526
|
+
* Maximum zoom level (largest allowed viewBox multiplier).
|
|
527
|
+
*
|
|
528
|
+
* A value of `10` means the user can zoom out until the viewBox is
|
|
529
|
+
* 10x the default 1000x700 size.
|
|
530
|
+
*
|
|
531
|
+
* @default 10
|
|
532
|
+
*/
|
|
533
|
+
this.MaxZoom = 10;
|
|
534
|
+
// ================================================================
|
|
535
|
+
// Outputs (standard events)
|
|
536
|
+
// ================================================================
|
|
537
|
+
/**
|
|
538
|
+
* Emitted when a point is clicked (after `BeforePointClick` completes
|
|
539
|
+
* without cancellation).
|
|
540
|
+
*/
|
|
541
|
+
this.PointClicked = new EventEmitter();
|
|
542
|
+
/**
|
|
543
|
+
* Emitted when the user clicks "Open Record" in the detail panel.
|
|
544
|
+
* The parent should wire this to `NavigationService.OpenEntityRecord()`.
|
|
545
|
+
*/
|
|
546
|
+
this.OpenRecordRequested = new EventEmitter();
|
|
547
|
+
/**
|
|
548
|
+
* Emitted when the mouse enters or leaves a data point.
|
|
549
|
+
* Emits `null` on mouse-leave.
|
|
550
|
+
*/
|
|
551
|
+
this.PointHovered = new EventEmitter();
|
|
552
|
+
// ================================================================
|
|
553
|
+
// Outputs (cancelable "Before" events)
|
|
554
|
+
// ================================================================
|
|
555
|
+
/**
|
|
556
|
+
* Fires **before** `PointClicked`. Set `event.Cancel = true` to
|
|
557
|
+
* suppress the click entirely.
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```typescript
|
|
561
|
+
* onBeforeClick(event: CancelableEvent<ClusterPoint>): void {
|
|
562
|
+
* if (event.Data.ClusterId === -1) {
|
|
563
|
+
* event.Cancel = true; // ignore outlier clicks
|
|
564
|
+
* }
|
|
565
|
+
* }
|
|
566
|
+
* ```
|
|
567
|
+
*/
|
|
568
|
+
this.BeforePointClick = new EventEmitter();
|
|
569
|
+
/**
|
|
570
|
+
* Fires **before** the tooltip is shown on hover. Set
|
|
571
|
+
* `event.Cancel = true` to suppress the tooltip for this point.
|
|
572
|
+
*/
|
|
573
|
+
this.BeforePointHover = new EventEmitter();
|
|
574
|
+
/**
|
|
575
|
+
* Fires **before** a zoom or pan operation is applied. Set
|
|
576
|
+
* `event.Cancel = true` to reject the viewport change.
|
|
577
|
+
*
|
|
578
|
+
* The payload contains the **proposed** viewport rectangle.
|
|
579
|
+
*/
|
|
580
|
+
this.BeforeZoom = new EventEmitter();
|
|
581
|
+
// ================================================================
|
|
582
|
+
// Outputs (informational events)
|
|
583
|
+
// ================================================================
|
|
584
|
+
/**
|
|
585
|
+
* Fires after new `Points` and `Clusters` are received and centroids
|
|
586
|
+
* have been computed, delivering the full visualization result.
|
|
587
|
+
*/
|
|
588
|
+
this.AfterClusteringComplete = new EventEmitter();
|
|
589
|
+
/**
|
|
590
|
+
* Fires when the user clicks a cluster label or legend swatch.
|
|
591
|
+
*/
|
|
592
|
+
this.ClusterSelected = new EventEmitter();
|
|
593
|
+
/**
|
|
594
|
+
* Fires whenever the set of selected point IDs changes
|
|
595
|
+
* (via user click or programmatic `SelectPoints` / `ClearSelection`).
|
|
596
|
+
*/
|
|
597
|
+
this.SelectionChanged = new EventEmitter();
|
|
598
|
+
/**
|
|
599
|
+
* Fires after every zoom or pan that changes the visible viewport.
|
|
600
|
+
*/
|
|
601
|
+
this.ViewportChanged = new EventEmitter();
|
|
602
|
+
/**
|
|
603
|
+
* Fires when the user edits a cluster label inline.
|
|
604
|
+
* Payload: `{ ClusterId, OldLabel, NewLabel }`.
|
|
605
|
+
*/
|
|
606
|
+
this.LabelEdited = new EventEmitter();
|
|
607
|
+
// ================================================================
|
|
608
|
+
// Label Editing State
|
|
609
|
+
// ================================================================
|
|
610
|
+
/** The cluster ID currently being edited, or null if none. */
|
|
611
|
+
this.EditingClusterId = null;
|
|
612
|
+
/** The draft label text during editing. */
|
|
613
|
+
this.EditingLabelDraft = '';
|
|
614
|
+
// ================================================================
|
|
615
|
+
// Internal State
|
|
616
|
+
// ================================================================
|
|
617
|
+
/** SVG viewBox parameters: [minX, minY, width, height]. */
|
|
618
|
+
this._viewBox = [0, 0, 1000, 700];
|
|
619
|
+
/** Cached viewBox string for template binding (avoids NG0100 on recalc). */
|
|
620
|
+
this.ViewBoxString = '0 0 1000 700';
|
|
621
|
+
/** Currently hovered point (null when idle). */
|
|
622
|
+
this.HoveredPoint = null;
|
|
623
|
+
/** Screen-space tooltip X position. */
|
|
624
|
+
this.TooltipX = 0;
|
|
625
|
+
/** Screen-space tooltip Y position. */
|
|
626
|
+
this.TooltipY = 0;
|
|
627
|
+
/** Currently highlighted (single-clicked) point key. */
|
|
628
|
+
this.HighlightedKey = null;
|
|
629
|
+
/** Background grid lines for visual orientation. */
|
|
630
|
+
this.HorizontalGridLines = [175, 350, 525];
|
|
631
|
+
/** Background vertical grid lines. */
|
|
632
|
+
this.VerticalGridLines = [250, 500, 750];
|
|
633
|
+
/** Computed cluster centroids used for radial glow effects. */
|
|
634
|
+
this.ClusterCentroids = [];
|
|
635
|
+
/** Filtered metadata entries for the tooltip (computed on hover). */
|
|
636
|
+
this.TooltipEntries = [];
|
|
637
|
+
// ================================================================
|
|
638
|
+
// Detail Panel State
|
|
639
|
+
// ================================================================
|
|
640
|
+
/** The currently selected point shown in the detail panel. */
|
|
641
|
+
this.SelectedPoint = null;
|
|
642
|
+
/** Whether the detail panel is visible. */
|
|
643
|
+
this.ShowDetailPanel = false;
|
|
644
|
+
/** Metadata entries for the detail panel (computed on selection). */
|
|
645
|
+
this.DetailEntries = [];
|
|
646
|
+
/** Cluster members for the selected point's cluster. */
|
|
647
|
+
this.ClusterMembers = [];
|
|
648
|
+
/** Whether the cluster members list is expanded. */
|
|
649
|
+
this.ClusterMembersExpanded = true;
|
|
650
|
+
// Pan/zoom state
|
|
651
|
+
this.isPanning = false;
|
|
652
|
+
this.panStartX = 0;
|
|
653
|
+
this.panStartY = 0;
|
|
654
|
+
this.panStartViewBox = [0, 0, 1000, 700];
|
|
655
|
+
this.boundOnMouseMove = null;
|
|
656
|
+
this.boundOnMouseUp = null;
|
|
657
|
+
/** Default viewBox dimensions used for zoom-limit calculations. */
|
|
658
|
+
this.defaultWidth = 1000;
|
|
659
|
+
this.defaultHeight = 700;
|
|
660
|
+
}
|
|
661
|
+
/** Start inline editing for a cluster label. */
|
|
662
|
+
StartLabelEdit(cluster, event) {
|
|
663
|
+
event.stopPropagation();
|
|
664
|
+
this.EditingClusterId = cluster.Id;
|
|
665
|
+
this.EditingLabelDraft = cluster.Label;
|
|
666
|
+
this.cdr.detectChanges();
|
|
667
|
+
}
|
|
668
|
+
/** Commit the edited label. */
|
|
669
|
+
CommitLabelEdit(cluster) {
|
|
670
|
+
const oldLabel = cluster.Label;
|
|
671
|
+
const newLabel = this.EditingLabelDraft.trim();
|
|
672
|
+
if (newLabel.length > 0 && newLabel !== oldLabel) {
|
|
673
|
+
cluster.Label = newLabel;
|
|
674
|
+
this.LabelEdited.emit({ ClusterId: cluster.Id, OldLabel: oldLabel, NewLabel: newLabel });
|
|
675
|
+
}
|
|
676
|
+
this.EditingClusterId = null;
|
|
677
|
+
this.cdr.detectChanges();
|
|
678
|
+
}
|
|
679
|
+
/** Cancel editing. */
|
|
680
|
+
CancelLabelEdit() {
|
|
681
|
+
this.EditingClusterId = null;
|
|
682
|
+
this.cdr.detectChanges();
|
|
683
|
+
}
|
|
684
|
+
/** Handle keydown in the edit input. */
|
|
685
|
+
OnLabelEditKeydown(event, cluster) {
|
|
686
|
+
if (event.key === 'Enter') {
|
|
687
|
+
this.CommitLabelEdit(cluster);
|
|
688
|
+
}
|
|
689
|
+
else if (event.key === 'Escape') {
|
|
690
|
+
this.CancelLabelEdit();
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
get ViewBox() {
|
|
694
|
+
return this._viewBox;
|
|
695
|
+
}
|
|
696
|
+
set ViewBox(value) {
|
|
697
|
+
this._viewBox = value;
|
|
698
|
+
this.ViewBoxString = value.join(' ');
|
|
699
|
+
}
|
|
700
|
+
/** Get the current viewport transform for saving/restoring. */
|
|
701
|
+
GetViewportTransform() {
|
|
702
|
+
return {
|
|
703
|
+
TranslateX: this.ViewBox[0],
|
|
704
|
+
TranslateY: this.ViewBox[1],
|
|
705
|
+
Scale: this.defaultWidth / this.ViewBox[2],
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
/** Restore a previously saved viewport transform. */
|
|
709
|
+
SetViewportTransform(vt) {
|
|
710
|
+
const width = this.defaultWidth / vt.Scale;
|
|
711
|
+
const height = this.defaultHeight / vt.Scale;
|
|
712
|
+
this.ViewBox = [vt.TranslateX, vt.TranslateY, width, height];
|
|
713
|
+
}
|
|
714
|
+
// ================================================================
|
|
715
|
+
// Lifecycle
|
|
716
|
+
// ================================================================
|
|
717
|
+
ngAfterViewInit() {
|
|
718
|
+
this.boundOnMouseMove = this.onMouseMove.bind(this);
|
|
719
|
+
this.boundOnMouseUp = this.onMouseUp.bind(this);
|
|
720
|
+
document.addEventListener('mousemove', this.boundOnMouseMove);
|
|
721
|
+
document.addEventListener('mouseup', this.boundOnMouseUp);
|
|
722
|
+
}
|
|
723
|
+
ngOnDestroy() {
|
|
724
|
+
if (this.boundOnMouseMove)
|
|
725
|
+
document.removeEventListener('mousemove', this.boundOnMouseMove);
|
|
726
|
+
if (this.boundOnMouseUp)
|
|
727
|
+
document.removeEventListener('mouseup', this.boundOnMouseUp);
|
|
728
|
+
}
|
|
729
|
+
ngOnChanges(changes) {
|
|
730
|
+
this.computeCentroids();
|
|
731
|
+
// Emit AfterClusteringComplete when new data arrives
|
|
732
|
+
if ((changes['Points'] || changes['Clusters']) && this.Points.length > 0 && this.Clusters.length > 0) {
|
|
733
|
+
this.AfterClusteringComplete.emit({
|
|
734
|
+
Points: this.Points,
|
|
735
|
+
Clusters: this.Clusters,
|
|
736
|
+
Metrics: {
|
|
737
|
+
SilhouetteScore: 0,
|
|
738
|
+
ClusterCount: this.Clusters.length,
|
|
739
|
+
ComputationTimeMs: 0,
|
|
740
|
+
RecordCount: this.Points.length,
|
|
741
|
+
OutlierCount: this.Points.filter(p => p.ClusterId < 0).length,
|
|
742
|
+
},
|
|
743
|
+
Config: {
|
|
744
|
+
EntityName: '',
|
|
745
|
+
EntityDocumentID: '',
|
|
746
|
+
Algorithm: 'kmeans',
|
|
747
|
+
K: this.Clusters.length,
|
|
748
|
+
Epsilon: 0,
|
|
749
|
+
MinPoints: 0,
|
|
750
|
+
DistanceMetric: 'cosine',
|
|
751
|
+
MaxRecords: this.Points.length,
|
|
752
|
+
Filter: '',
|
|
753
|
+
},
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
// ================================================================
|
|
758
|
+
// Template Helpers
|
|
759
|
+
// ================================================================
|
|
760
|
+
/**
|
|
761
|
+
* Returns the current SVG `viewBox` as a space-separated string.
|
|
762
|
+
*
|
|
763
|
+
* @returns e.g. `"0 0 1000 700"`
|
|
764
|
+
*/
|
|
765
|
+
GetViewBoxString() {
|
|
766
|
+
return this.ViewBox.join(' ');
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Resolve the display color for a given point based on its cluster
|
|
770
|
+
* assignment and the active `ColorPalette`.
|
|
771
|
+
*
|
|
772
|
+
* @param point The point to colorize.
|
|
773
|
+
* @returns CSS color string.
|
|
774
|
+
*/
|
|
775
|
+
GetPointColor(point) {
|
|
776
|
+
if (point.ClusterId < 0)
|
|
777
|
+
return '#64748b'; // outlier gray
|
|
778
|
+
const palette = this.getActivePalette();
|
|
779
|
+
const cluster = this.Clusters.find(c => c.Id === point.ClusterId);
|
|
780
|
+
return cluster?.Color ?? palette[point.ClusterId % palette.length];
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Compute the SVG radius for a data point.
|
|
784
|
+
*
|
|
785
|
+
* Selected points use the larger `HighlightRadius`; all others use `DotRadius`.
|
|
786
|
+
*
|
|
787
|
+
* @param point The point to size.
|
|
788
|
+
* @returns Radius in SVG units.
|
|
789
|
+
*/
|
|
790
|
+
GetPointRadius(point) {
|
|
791
|
+
if (this.SelectedPointIds.has(point.VectorKey)) {
|
|
792
|
+
return this.HighlightRadius;
|
|
793
|
+
}
|
|
794
|
+
return this.DotRadius;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Compute the fill opacity for a data point.
|
|
798
|
+
*
|
|
799
|
+
* Non-hovered points are dimmed when another point is hovered.
|
|
800
|
+
*
|
|
801
|
+
* @param point The point to evaluate.
|
|
802
|
+
* @returns Opacity value between 0 and 1.
|
|
803
|
+
*/
|
|
804
|
+
GetPointOpacity(point) {
|
|
805
|
+
if (this.HoveredPoint && this.HoveredPoint.VectorKey !== point.VectorKey) {
|
|
806
|
+
return this.DotOpacity * 0.5;
|
|
807
|
+
}
|
|
808
|
+
return this.DotOpacity;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Handle mouseenter on a data point: show tooltip, fire hover events.
|
|
812
|
+
*
|
|
813
|
+
* @param point The hovered point.
|
|
814
|
+
* @param event The native mouse event (used for tooltip positioning).
|
|
815
|
+
*/
|
|
816
|
+
OnPointMouseEnter(point, event) {
|
|
817
|
+
const cancelable = { Data: point, Cancel: false };
|
|
818
|
+
this.BeforePointHover.emit(cancelable);
|
|
819
|
+
if (cancelable.Cancel)
|
|
820
|
+
return;
|
|
821
|
+
this.HoveredPoint = point;
|
|
822
|
+
this.TooltipX = event.clientX + 16;
|
|
823
|
+
this.TooltipY = event.clientY - 10;
|
|
824
|
+
this.computeTooltipEntries(point);
|
|
825
|
+
this.PointHovered.emit(point);
|
|
826
|
+
this.cdr.detectChanges();
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Handle mouseleave on a data point: hide tooltip, emit null hover.
|
|
830
|
+
*/
|
|
831
|
+
OnPointMouseLeave() {
|
|
832
|
+
this.HoveredPoint = null;
|
|
833
|
+
this.TooltipEntries = [];
|
|
834
|
+
this.PointHovered.emit(null);
|
|
835
|
+
this.cdr.detectChanges();
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Handle click on a data point: fires `BeforePointClick`, toggles
|
|
839
|
+
* selection, opens the detail panel, then fires `PointClicked` and
|
|
840
|
+
* `SelectionChanged`.
|
|
841
|
+
*
|
|
842
|
+
* @param point The clicked point.
|
|
843
|
+
*/
|
|
844
|
+
OnPointClick(point) {
|
|
845
|
+
const cancelable = { Data: point, Cancel: false };
|
|
846
|
+
this.BeforePointClick.emit(cancelable);
|
|
847
|
+
if (cancelable.Cancel)
|
|
848
|
+
return;
|
|
849
|
+
this.HighlightedKey = point.VectorKey;
|
|
850
|
+
// Toggle selection
|
|
851
|
+
const newSelection = new Set(this.SelectedPointIds);
|
|
852
|
+
if (newSelection.has(point.VectorKey)) {
|
|
853
|
+
newSelection.delete(point.VectorKey);
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
newSelection.add(point.VectorKey);
|
|
857
|
+
}
|
|
858
|
+
this.SelectedPointIds = newSelection;
|
|
859
|
+
this.SelectionChanged.emit(newSelection);
|
|
860
|
+
// Open detail panel for the clicked point
|
|
861
|
+
this.selectPointForDetail(point);
|
|
862
|
+
this.PointClicked.emit(point);
|
|
863
|
+
this.cdr.detectChanges();
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Whether the given point is the currently highlighted (last-clicked) point.
|
|
867
|
+
*
|
|
868
|
+
* @param point The point to check.
|
|
869
|
+
* @returns `true` if highlighted.
|
|
870
|
+
*/
|
|
871
|
+
IsHighlighted(point) {
|
|
872
|
+
return this.HighlightedKey === point.VectorKey;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Whether the given point is in the current selection set.
|
|
876
|
+
*
|
|
877
|
+
* @param point The point to check.
|
|
878
|
+
* @returns `true` if selected.
|
|
879
|
+
*/
|
|
880
|
+
IsSelected(point) {
|
|
881
|
+
return this.SelectedPointIds.has(point.VectorKey);
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Handle mouse wheel events for zooming.
|
|
885
|
+
*
|
|
886
|
+
* Fires `BeforeZoom` and `ViewportChanged`. Respects `EnableZoom`,
|
|
887
|
+
* `MinZoom`, and `MaxZoom` constraints.
|
|
888
|
+
*
|
|
889
|
+
* @param event The native wheel event.
|
|
890
|
+
*/
|
|
891
|
+
OnWheel(event) {
|
|
892
|
+
event.preventDefault();
|
|
893
|
+
if (!this.EnableZoom)
|
|
894
|
+
return;
|
|
895
|
+
const zoomFactor = event.deltaY > 0 ? 1.1 : 0.9;
|
|
896
|
+
const [minX, minY, width, height] = this.ViewBox;
|
|
897
|
+
const minWidth = this.defaultWidth * this.MinZoom;
|
|
898
|
+
const maxWidth = this.defaultWidth * this.MaxZoom;
|
|
899
|
+
const minHeight = this.defaultHeight * this.MinZoom;
|
|
900
|
+
const maxHeight = this.defaultHeight * this.MaxZoom;
|
|
901
|
+
const newWidth = Math.max(minWidth, Math.min(maxWidth, width * zoomFactor));
|
|
902
|
+
const newHeight = Math.max(minHeight, Math.min(maxHeight, height * zoomFactor));
|
|
903
|
+
const centerX = minX + width / 2;
|
|
904
|
+
const centerY = minY + height / 2;
|
|
905
|
+
const proposed = {
|
|
906
|
+
MinX: centerX - newWidth / 2,
|
|
907
|
+
MinY: centerY - newHeight / 2,
|
|
908
|
+
Width: newWidth,
|
|
909
|
+
Height: newHeight,
|
|
910
|
+
};
|
|
911
|
+
const cancelable = { Data: proposed, Cancel: false };
|
|
912
|
+
this.BeforeZoom.emit(cancelable);
|
|
913
|
+
if (cancelable.Cancel)
|
|
914
|
+
return;
|
|
915
|
+
this.ViewBox = [proposed.MinX, proposed.MinY, proposed.Width, proposed.Height];
|
|
916
|
+
this.ViewportChanged.emit(proposed);
|
|
917
|
+
this.cdr.detectChanges();
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Start panning on left-mousedown.
|
|
921
|
+
*
|
|
922
|
+
* @param event The native mouse event.
|
|
923
|
+
*/
|
|
924
|
+
OnMouseDown(event) {
|
|
925
|
+
if (event.button !== 0 || !this.EnablePan)
|
|
926
|
+
return;
|
|
927
|
+
this.isPanning = true;
|
|
928
|
+
this.panStartX = event.clientX;
|
|
929
|
+
this.panStartY = event.clientY;
|
|
930
|
+
this.panStartViewBox = [...this.ViewBox];
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Handle a click on a cluster legend item.
|
|
934
|
+
*
|
|
935
|
+
* @param cluster The cluster that was clicked.
|
|
936
|
+
*/
|
|
937
|
+
OnClusterLegendClick(cluster) {
|
|
938
|
+
this.ClusterSelected.emit({
|
|
939
|
+
ClusterId: cluster.Id,
|
|
940
|
+
Label: cluster.Label,
|
|
941
|
+
Color: cluster.Color,
|
|
942
|
+
MemberCount: cluster.MemberCount,
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Resolve the human-readable label for a point's cluster.
|
|
947
|
+
*
|
|
948
|
+
* @param point The point to look up.
|
|
949
|
+
* @returns Cluster label string, or `"Outlier"` for noise points.
|
|
950
|
+
*/
|
|
951
|
+
GetClusterLabel(point) {
|
|
952
|
+
if (point.ClusterId < 0)
|
|
953
|
+
return 'Outlier';
|
|
954
|
+
const cluster = this.Clusters.find(c => c.Id === point.ClusterId);
|
|
955
|
+
return cluster?.Label ?? `Cluster ${point.ClusterId + 1}`;
|
|
956
|
+
}
|
|
957
|
+
/** Get the label for a cluster by ID (used for SVG text labels on the chart). */
|
|
958
|
+
GetClusterLabelById(clusterId) {
|
|
959
|
+
const cluster = this.Clusters.find(c => c.Id === clusterId);
|
|
960
|
+
return cluster?.Label ?? '';
|
|
961
|
+
}
|
|
962
|
+
/** @internal TrackBy function for point loops. */
|
|
963
|
+
TrackPointBy(_index, point) {
|
|
964
|
+
return point.VectorKey;
|
|
965
|
+
}
|
|
966
|
+
/** @internal TrackBy function for cluster loops. */
|
|
967
|
+
TrackClusterBy(_index, cluster) {
|
|
968
|
+
return cluster.Id;
|
|
969
|
+
}
|
|
970
|
+
/** @internal TrackBy function for centroid loops. */
|
|
971
|
+
TrackCentroidBy(_index, centroid) {
|
|
972
|
+
return centroid.ClusterId;
|
|
973
|
+
}
|
|
974
|
+
// ================================================================
|
|
975
|
+
// Public API Methods
|
|
976
|
+
// ================================================================
|
|
977
|
+
/**
|
|
978
|
+
* Animate the viewport to center on a specific cluster's centroid.
|
|
979
|
+
*
|
|
980
|
+
* The zoom level is adjusted so that all cluster members are visible
|
|
981
|
+
* with some padding.
|
|
982
|
+
*
|
|
983
|
+
* @param clusterId The numeric ID of the cluster to zoom into.
|
|
984
|
+
*
|
|
985
|
+
* @example
|
|
986
|
+
* ```typescript
|
|
987
|
+
* @ViewChild(ClusterScatterComponent) scatter!: ClusterScatterComponent;
|
|
988
|
+
* this.scatter.ZoomToCluster(2);
|
|
989
|
+
* ```
|
|
990
|
+
*/
|
|
991
|
+
ZoomToCluster(clusterId) {
|
|
992
|
+
const members = this.Points.filter(p => p.ClusterId === clusterId);
|
|
993
|
+
if (members.length === 0)
|
|
994
|
+
return;
|
|
995
|
+
const bounds = this.computeBounds(members);
|
|
996
|
+
const padding = 80;
|
|
997
|
+
const proposed = {
|
|
998
|
+
MinX: bounds.minX - padding,
|
|
999
|
+
MinY: bounds.minY - padding,
|
|
1000
|
+
Width: (bounds.maxX - bounds.minX) + padding * 2,
|
|
1001
|
+
Height: (bounds.maxY - bounds.minY) + padding * 2,
|
|
1002
|
+
};
|
|
1003
|
+
// Ensure minimum dimensions
|
|
1004
|
+
if (proposed.Width < 200) {
|
|
1005
|
+
const cx = proposed.MinX + proposed.Width / 2;
|
|
1006
|
+
proposed.Width = 200;
|
|
1007
|
+
proposed.MinX = cx - 100;
|
|
1008
|
+
}
|
|
1009
|
+
if (proposed.Height < 140) {
|
|
1010
|
+
const cy = proposed.MinY + proposed.Height / 2;
|
|
1011
|
+
proposed.Height = 140;
|
|
1012
|
+
proposed.MinY = cy - 70;
|
|
1013
|
+
}
|
|
1014
|
+
this.ViewBox = [proposed.MinX, proposed.MinY, proposed.Width, proposed.Height];
|
|
1015
|
+
this.ViewportChanged.emit(proposed);
|
|
1016
|
+
this.cdr.detectChanges();
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Reset the viewport to the default zoom level (full view).
|
|
1020
|
+
*
|
|
1021
|
+
* @example
|
|
1022
|
+
* ```typescript
|
|
1023
|
+
* this.scatter.ResetZoom();
|
|
1024
|
+
* ```
|
|
1025
|
+
*/
|
|
1026
|
+
ResetZoom() {
|
|
1027
|
+
const proposed = {
|
|
1028
|
+
MinX: 0,
|
|
1029
|
+
MinY: 0,
|
|
1030
|
+
Width: this.defaultWidth,
|
|
1031
|
+
Height: this.defaultHeight,
|
|
1032
|
+
};
|
|
1033
|
+
this.ViewBox = [0, 0, this.defaultWidth, this.defaultHeight];
|
|
1034
|
+
this.ViewportChanged.emit(proposed);
|
|
1035
|
+
this.cdr.detectChanges();
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Return all points currently visible within the viewport bounds.
|
|
1039
|
+
*
|
|
1040
|
+
* @returns Array of `ClusterPoint` objects whose X/Y fall inside the
|
|
1041
|
+
* current viewBox.
|
|
1042
|
+
*/
|
|
1043
|
+
GetVisiblePoints() {
|
|
1044
|
+
const [minX, minY, width, height] = this.ViewBox;
|
|
1045
|
+
const maxX = minX + width;
|
|
1046
|
+
const maxY = minY + height;
|
|
1047
|
+
return this.Points.filter(p => p.X >= minX && p.X <= maxX && p.Y >= minY && p.Y <= maxY);
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Programmatically select points by their `VectorKey` IDs.
|
|
1051
|
+
*
|
|
1052
|
+
* Merges with the existing selection. Use `ClearSelection()` first
|
|
1053
|
+
* to replace the selection entirely.
|
|
1054
|
+
*
|
|
1055
|
+
* @param ids Array of `VectorKey` strings to select.
|
|
1056
|
+
*
|
|
1057
|
+
* @example
|
|
1058
|
+
* ```typescript
|
|
1059
|
+
* this.scatter.SelectPoints(['abc-123', 'def-456']);
|
|
1060
|
+
* ```
|
|
1061
|
+
*/
|
|
1062
|
+
SelectPoints(ids) {
|
|
1063
|
+
const newSelection = new Set(this.SelectedPointIds);
|
|
1064
|
+
for (const id of ids) {
|
|
1065
|
+
newSelection.add(id);
|
|
1066
|
+
}
|
|
1067
|
+
this.SelectedPointIds = newSelection;
|
|
1068
|
+
this.SelectionChanged.emit(newSelection);
|
|
1069
|
+
this.cdr.detectChanges();
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Clear all selected points.
|
|
1073
|
+
*/
|
|
1074
|
+
ClearSelection() {
|
|
1075
|
+
this.SelectedPointIds = new Set();
|
|
1076
|
+
this.HighlightedKey = null;
|
|
1077
|
+
this.SelectionChanged.emit(this.SelectedPointIds);
|
|
1078
|
+
this.cdr.detectChanges();
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Export the current scatter plot as an SVG string.
|
|
1082
|
+
*
|
|
1083
|
+
* The returned string is a self-contained `<svg>` element that can be
|
|
1084
|
+
* saved to a file or embedded in HTML.
|
|
1085
|
+
*
|
|
1086
|
+
* @returns SVG markup string, or empty string if the SVG element is
|
|
1087
|
+
* not yet rendered.
|
|
1088
|
+
*/
|
|
1089
|
+
ExportSVG() {
|
|
1090
|
+
if (!this.svgRef?.nativeElement)
|
|
1091
|
+
return '';
|
|
1092
|
+
const svgElement = this.svgRef.nativeElement;
|
|
1093
|
+
const serializer = new XMLSerializer();
|
|
1094
|
+
return serializer.serializeToString(svgElement);
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Visually emphasize all points belonging to a cluster by increasing
|
|
1098
|
+
* their radius and dimming non-members.
|
|
1099
|
+
*
|
|
1100
|
+
* Call `ResetZoom()` or re-assign `Points` to clear the highlight.
|
|
1101
|
+
*
|
|
1102
|
+
* @param clusterId The numeric cluster ID to emphasize.
|
|
1103
|
+
*/
|
|
1104
|
+
HighlightCluster(clusterId) {
|
|
1105
|
+
const memberKeys = this.Points
|
|
1106
|
+
.filter(p => p.ClusterId === clusterId)
|
|
1107
|
+
.map(p => p.VectorKey);
|
|
1108
|
+
this.SelectedPointIds = new Set(memberKeys);
|
|
1109
|
+
this.SelectionChanged.emit(this.SelectedPointIds);
|
|
1110
|
+
this.cdr.detectChanges();
|
|
1111
|
+
}
|
|
1112
|
+
// ================================================================
|
|
1113
|
+
// Detail Panel Methods
|
|
1114
|
+
// ================================================================
|
|
1115
|
+
/**
|
|
1116
|
+
* Close the detail panel.
|
|
1117
|
+
*/
|
|
1118
|
+
CloseDetailPanel() {
|
|
1119
|
+
this.ShowDetailPanel = false;
|
|
1120
|
+
this.SelectedPoint = null;
|
|
1121
|
+
this.DetailEntries = [];
|
|
1122
|
+
this.ClusterMembers = [];
|
|
1123
|
+
this.cdr.detectChanges();
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Emit the `OpenRecordRequested` event for the currently selected point
|
|
1127
|
+
* (triggered by the "Open Record" button in the detail panel).
|
|
1128
|
+
*/
|
|
1129
|
+
OnOpenRecordClick() {
|
|
1130
|
+
if (this.SelectedPoint) {
|
|
1131
|
+
this.OpenRecordRequested.emit(this.SelectedPoint);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Select a point from the cluster members list, updating the detail
|
|
1136
|
+
* panel and highlighting the point on the chart.
|
|
1137
|
+
*
|
|
1138
|
+
* @param point The cluster member point to select.
|
|
1139
|
+
*/
|
|
1140
|
+
OnClusterMemberClick(point) {
|
|
1141
|
+
this.HighlightedKey = point.VectorKey;
|
|
1142
|
+
this.selectPointForDetail(point);
|
|
1143
|
+
this.cdr.detectChanges();
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Toggle the cluster members list expansion state.
|
|
1147
|
+
*/
|
|
1148
|
+
ToggleClusterMembers() {
|
|
1149
|
+
this.ClusterMembersExpanded = !this.ClusterMembersExpanded;
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* Get the color for a cluster by its ID, used in the detail panel.
|
|
1153
|
+
*
|
|
1154
|
+
* @param clusterId The cluster ID.
|
|
1155
|
+
* @returns CSS color string.
|
|
1156
|
+
*/
|
|
1157
|
+
GetClusterColor(clusterId) {
|
|
1158
|
+
if (clusterId < 0)
|
|
1159
|
+
return '#64748b';
|
|
1160
|
+
const cluster = this.Clusters.find(c => c.Id === clusterId);
|
|
1161
|
+
if (cluster?.Color)
|
|
1162
|
+
return cluster.Color;
|
|
1163
|
+
const palette = this.getActivePalette();
|
|
1164
|
+
return palette[clusterId % palette.length];
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Return the metadata keys that should be hidden in the detail panel.
|
|
1168
|
+
*/
|
|
1169
|
+
get internalMetadataKeys() {
|
|
1170
|
+
return new Set([
|
|
1171
|
+
'Name', 'Entity', 'EntityIcon', 'RecordID',
|
|
1172
|
+
'TemplateID', '__mj_UpdatedAt', '__mj_CreatedAt',
|
|
1173
|
+
]);
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Select a point and populate the detail panel state.
|
|
1177
|
+
*/
|
|
1178
|
+
selectPointForDetail(point) {
|
|
1179
|
+
this.SelectedPoint = point;
|
|
1180
|
+
this.ShowDetailPanel = true;
|
|
1181
|
+
this.computeDetailEntries(point);
|
|
1182
|
+
this.computeClusterMembers(point);
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Compute the metadata entries for the detail panel, excluding internal fields.
|
|
1186
|
+
* Uses FieldPriority for ordering when available.
|
|
1187
|
+
*/
|
|
1188
|
+
computeDetailEntries(point) {
|
|
1189
|
+
const hidden = this.internalMetadataKeys;
|
|
1190
|
+
const raw = Object.entries(point.Metadata)
|
|
1191
|
+
.filter(([key]) => !hidden.has(key))
|
|
1192
|
+
.filter(([, value]) => value != null && String(value).trim() !== '')
|
|
1193
|
+
.map(([Key, Value]) => ({ Key, Value }));
|
|
1194
|
+
this.DetailEntries = this.sortEntriesByPriority(raw);
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Compute the list of cluster members for the selected point's cluster.
|
|
1198
|
+
*/
|
|
1199
|
+
computeClusterMembers(point) {
|
|
1200
|
+
this.ClusterMembers = this.Points
|
|
1201
|
+
.filter(p => p.ClusterId === point.ClusterId)
|
|
1202
|
+
.sort((a, b) => a.Label.localeCompare(b.Label));
|
|
1203
|
+
}
|
|
1204
|
+
/** @internal TrackBy function for cluster member loops. */
|
|
1205
|
+
TrackMemberBy(_index, point) {
|
|
1206
|
+
return point.VectorKey;
|
|
1207
|
+
}
|
|
1208
|
+
// ================================================================
|
|
1209
|
+
// Private Methods
|
|
1210
|
+
// ================================================================
|
|
1211
|
+
onMouseMove(event) {
|
|
1212
|
+
if (!this.isPanning || !this.svgRef)
|
|
1213
|
+
return;
|
|
1214
|
+
const svg = this.svgRef.nativeElement;
|
|
1215
|
+
const rect = svg.getBoundingClientRect();
|
|
1216
|
+
const scaleX = this.panStartViewBox[2] / rect.width;
|
|
1217
|
+
const scaleY = this.panStartViewBox[3] / rect.height;
|
|
1218
|
+
const dx = (event.clientX - this.panStartX) * scaleX;
|
|
1219
|
+
const dy = (event.clientY - this.panStartY) * scaleY;
|
|
1220
|
+
const proposed = {
|
|
1221
|
+
MinX: this.panStartViewBox[0] - dx,
|
|
1222
|
+
MinY: this.panStartViewBox[1] - dy,
|
|
1223
|
+
Width: this.panStartViewBox[2],
|
|
1224
|
+
Height: this.panStartViewBox[3],
|
|
1225
|
+
};
|
|
1226
|
+
this.ViewBox = [proposed.MinX, proposed.MinY, proposed.Width, proposed.Height];
|
|
1227
|
+
this.ViewportChanged.emit(proposed);
|
|
1228
|
+
this.cdr.detectChanges();
|
|
1229
|
+
}
|
|
1230
|
+
onMouseUp(_event) {
|
|
1231
|
+
this.isPanning = false;
|
|
1232
|
+
}
|
|
1233
|
+
computeCentroids() {
|
|
1234
|
+
if (!this.Points.length || !this.Clusters.length) {
|
|
1235
|
+
this.ClusterCentroids = [];
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
this.ClusterCentroids = this.Clusters.map(cluster => {
|
|
1239
|
+
const members = this.Points.filter(p => p.ClusterId === cluster.Id);
|
|
1240
|
+
if (members.length === 0) {
|
|
1241
|
+
return { ClusterId: cluster.Id, Cx: 500, Cy: 350, R: 80, Color: cluster.Color };
|
|
1242
|
+
}
|
|
1243
|
+
const cx = members.reduce((s, p) => s + p.X, 0) / members.length;
|
|
1244
|
+
const cy = members.reduce((s, p) => s + p.Y, 0) / members.length;
|
|
1245
|
+
const maxDist = Math.max(...members.map(p => Math.sqrt((p.X - cx) ** 2 + (p.Y - cy) ** 2)), 40);
|
|
1246
|
+
return {
|
|
1247
|
+
ClusterId: cluster.Id,
|
|
1248
|
+
Cx: cx,
|
|
1249
|
+
Cy: cy,
|
|
1250
|
+
R: Math.min(maxDist + 30, 200),
|
|
1251
|
+
Color: cluster.Color,
|
|
1252
|
+
};
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Compute the bounding box for a set of points.
|
|
1257
|
+
*/
|
|
1258
|
+
computeBounds(points) {
|
|
1259
|
+
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
1260
|
+
for (const p of points) {
|
|
1261
|
+
if (p.X < minX)
|
|
1262
|
+
minX = p.X;
|
|
1263
|
+
if (p.X > maxX)
|
|
1264
|
+
maxX = p.X;
|
|
1265
|
+
if (p.Y < minY)
|
|
1266
|
+
minY = p.Y;
|
|
1267
|
+
if (p.Y > maxY)
|
|
1268
|
+
maxY = p.Y;
|
|
1269
|
+
}
|
|
1270
|
+
return { minX, minY, maxX, maxY };
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Resolve the effective color palette (custom override or default).
|
|
1274
|
+
*/
|
|
1275
|
+
getActivePalette() {
|
|
1276
|
+
return this.ColorPalette.length > 0 ? this.ColorPalette : CLUSTER_COLORS;
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Compute the tooltip entries based on TooltipFields filter.
|
|
1280
|
+
* Uses FieldPriority for ordering when available.
|
|
1281
|
+
*/
|
|
1282
|
+
computeTooltipEntries(point) {
|
|
1283
|
+
const entries = Object.entries(point.Metadata);
|
|
1284
|
+
let mapped;
|
|
1285
|
+
if (this.TooltipFields.length > 0) {
|
|
1286
|
+
mapped = entries
|
|
1287
|
+
.filter(([key]) => this.TooltipFields.includes(key))
|
|
1288
|
+
.map(([Key, Value]) => ({ Key, Value }));
|
|
1289
|
+
}
|
|
1290
|
+
else {
|
|
1291
|
+
mapped = entries.map(([Key, Value]) => ({ Key, Value }));
|
|
1292
|
+
}
|
|
1293
|
+
this.TooltipEntries = this.sortEntriesByPriority(mapped);
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Sort entries using the FieldPriority ordering.
|
|
1297
|
+
* Fields in FieldPriority come first (in priority order), then remaining fields.
|
|
1298
|
+
*/
|
|
1299
|
+
sortEntriesByPriority(entries) {
|
|
1300
|
+
if (this.FieldPriority.length === 0)
|
|
1301
|
+
return entries;
|
|
1302
|
+
const priorityIndex = new Map(this.FieldPriority.map((key, idx) => [key, idx]));
|
|
1303
|
+
return [...entries].sort((a, b) => {
|
|
1304
|
+
const aIdx = priorityIndex.get(a.Key) ?? 99999;
|
|
1305
|
+
const bIdx = priorityIndex.get(b.Key) ?? 99999;
|
|
1306
|
+
return aIdx - bIdx;
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
static { this.ɵfac = function ClusterScatterComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ClusterScatterComponent)(); }; }
|
|
1310
|
+
static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ClusterScatterComponent, selectors: [["mj-cluster-scatter"]], viewQuery: function ClusterScatterComponent_Query(rf, ctx) { if (rf & 1) {
|
|
1311
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
1312
|
+
} if (rf & 2) {
|
|
1313
|
+
let _t;
|
|
1314
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.svgRef = _t.first);
|
|
1315
|
+
} }, inputs: { Points: "Points", Clusters: "Clusters", IsLoading: "IsLoading", DotRadius: "DotRadius", DotOpacity: "DotOpacity", HighlightRadius: "HighlightRadius", ShowLegend: "ShowLegend", ShowTooltip: "ShowTooltip", TooltipFields: "TooltipFields", FieldPriority: "FieldPriority", FieldDisplayNames: "FieldDisplayNames", EntityName: "EntityName", ColorPalette: "ColorPalette", EnableZoom: "EnableZoom", EnablePan: "EnablePan", AnimateTransitions: "AnimateTransitions", SelectedPointIds: "SelectedPointIds", MinZoom: "MinZoom", MaxZoom: "MaxZoom" }, outputs: { PointClicked: "PointClicked", OpenRecordRequested: "OpenRecordRequested", PointHovered: "PointHovered", BeforePointClick: "BeforePointClick", BeforePointHover: "BeforePointHover", BeforeZoom: "BeforeZoom", AfterClusteringComplete: "AfterClusteringComplete", ClusterSelected: "ClusterSelected", SelectionChanged: "SelectionChanged", ViewportChanged: "ViewportChanged", LabelEdited: "LabelEdited" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 8, vars: 8, consts: [["svgElement", ""], [1, "scatter-container"], [1, "loading-overlay"], [1, "empty-state"], ["preserveAspectRatio", "xMidYMid meet", 1, "scatter-svg", 3, "no-transitions"], [1, "legend"], [1, "tooltip", 3, "left", "top"], [1, "detail-panel"], [1, "loading-spinner"], [1, "fa-solid", "fa-circle-nodes", "fa-spin"], [1, "fa-solid", "fa-chart-scatter"], [1, "empty-hint"], ["preserveAspectRatio", "xMidYMid meet", 1, "scatter-svg", 3, "wheel", "mousedown"], ["cx", "50%", "cy", "50%", "r", "50%"], [1, "grid-lines"], [1, "data-point"], ["offset", "0%", "stop-opacity", "0.12"], ["offset", "100%", "stop-opacity", "0"], ["text-anchor", "middle", 1, "cluster-label"], [1, "data-point", 3, "mouseenter", "mouseleave", "click"], ["fill", "none", "stroke-width", "2", "opacity", "0.8", 1, "selection-ring"], ["fill", "none", "stroke-width", "2.5", "opacity", "0.9"], [1, "legend-title"], [1, "legend-item"], [1, "legend-item", 3, "click"], [1, "legend-dot"], ["autofocus", "", 1, "legend-label-input", 3, "ngModel"], [1, "legend-count"], ["autofocus", "", 1, "legend-label-input", 3, "ngModelChange", "keydown", "blur", "click", "ngModel"], [1, "legend-label"], ["title", "Edit label", 1, "legend-edit-btn", 3, "click"], [1, "fa-solid", "fa-pencil"], [1, "tooltip"], ["Variant", "compact", 3, "EntityName", "Record"], [1, "tt-cluster"], [1, "fa-solid", "fa-circle", 2, "font-size", "7px", "vertical-align", "middle"], [1, "tt-action"], [1, "fa-solid", "fa-arrow-up-right-from-square"], [1, "detail-header"], [1, "detail-header-content"], [1, "detail-icon"], [1, "detail-header-text"], [1, "detail-name"], [1, "detail-entity-badge"], ["title", "Close", 1, "detail-close", 3, "click"], [1, "fa-solid", "fa-times"], [1, "detail-cluster"], [1, "detail-cluster-dot"], ["Variant", "detail", "CssClass", "detail-entity-card", 3, "EntityName", "Record"], [1, "detail-members-section"], [1, "detail-members-toggle", 3, "click"], [1, "fa-solid"], [1, "detail-members-count"], [1, "detail-members-list"], [1, "detail-footer"], [1, "detail-open-btn", 3, "click"], [1, "detail-member-row", 3, "active"], [1, "detail-member-row", 3, "click"], [1, "member-icon", 3, "class"], [1, "member-label"], [1, "member-icon"]], template: function ClusterScatterComponent_Template(rf, ctx) { if (rf & 1) {
|
|
1316
|
+
i0.ɵɵelementStart(0, "div", 1);
|
|
1317
|
+
i0.ɵɵconditionalCreate(1, ClusterScatterComponent_Conditional_1_Template, 5, 0, "div", 2);
|
|
1318
|
+
i0.ɵɵconditionalCreate(2, ClusterScatterComponent_Conditional_2_Template, 6, 0, "div", 3);
|
|
1319
|
+
i0.ɵɵconditionalCreate(3, ClusterScatterComponent_Conditional_3_Template, 19, 4, ":svg:svg", 4);
|
|
1320
|
+
i0.ɵɵconditionalCreate(4, ClusterScatterComponent_Conditional_4_Template, 5, 0, "div", 5);
|
|
1321
|
+
i0.ɵɵconditionalCreate(5, ClusterScatterComponent_Conditional_5_Template, 8, 7, "div", 6);
|
|
1322
|
+
i0.ɵɵelementStart(6, "div", 7);
|
|
1323
|
+
i0.ɵɵconditionalCreate(7, ClusterScatterComponent_Conditional_7_Template, 25, 14);
|
|
1324
|
+
i0.ɵɵelementEnd()();
|
|
1325
|
+
} if (rf & 2) {
|
|
1326
|
+
i0.ɵɵadvance();
|
|
1327
|
+
i0.ɵɵconditional(ctx.IsLoading ? 1 : -1);
|
|
1328
|
+
i0.ɵɵadvance();
|
|
1329
|
+
i0.ɵɵconditional(!ctx.IsLoading && ctx.Points.length === 0 ? 2 : -1);
|
|
1330
|
+
i0.ɵɵadvance();
|
|
1331
|
+
i0.ɵɵconditional(ctx.Points.length > 0 ? 3 : -1);
|
|
1332
|
+
i0.ɵɵadvance();
|
|
1333
|
+
i0.ɵɵconditional(ctx.ShowLegend && ctx.Clusters.length > 0 ? 4 : -1);
|
|
1334
|
+
i0.ɵɵadvance();
|
|
1335
|
+
i0.ɵɵconditional(ctx.ShowTooltip && ctx.HoveredPoint ? 5 : -1);
|
|
1336
|
+
i0.ɵɵadvance();
|
|
1337
|
+
i0.ɵɵclassProp("detail-panel-open", ctx.ShowDetailPanel && ctx.SelectedPoint);
|
|
1338
|
+
i0.ɵɵadvance();
|
|
1339
|
+
i0.ɵɵconditional(ctx.SelectedPoint ? 7 : -1);
|
|
1340
|
+
} }, dependencies: [i1.DefaultValueAccessor, i1.NgControlStatus, i1.NgModel, i2.MJEntityCardComponent], styles: [":host {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n}\n\n.scatter-container {\n width: 100%;\n height: 100%;\n position: relative;\n overflow: hidden;\n background: var(--mj-bg-page);\n}\n\n/* SVG */\n.scatter-svg {\n width: 100%;\n height: 100%;\n cursor: grab;\n user-select: none;\n}\n\n.scatter-svg:active {\n cursor: grabbing;\n}\n\n/* Grid lines */\n.grid-lines line {\n stroke: var(--mj-border-subtle);\n stroke-width: 0.5;\n}\n\n/* Data points */\n.data-point {\n cursor: pointer;\n transition: opacity 0.15s ease, r 0.15s ease;\n}\n\n.data-point:hover {\n filter: brightness(1.2);\n}\n\n/* Selection rings */\n.selection-ring {\n pointer-events: none;\n transition: r 0.15s ease;\n}\n\n/* Disable transitions when AnimateTransitions is false */\n.no-transitions .data-point,\n.no-transitions .selection-ring {\n transition: none;\n}\n\n/* Loading overlay */\n.loading-overlay {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: color-mix(in srgb, var(--mj-bg-page) 80%, transparent);\n z-index: 5;\n}\n\n.loading-spinner {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n color: var(--mj-text-secondary);\n font-size: 0.9rem;\n}\n\n.loading-spinner i {\n font-size: 2rem;\n color: var(--mj-brand-primary);\n}\n\n/* Empty state */\n.empty-state {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n color: var(--mj-text-muted);\n gap: 8px;\n}\n\n.empty-state i {\n font-size: 3rem;\n margin-bottom: 8px;\n opacity: 0.4;\n}\n\n.empty-state p {\n font-size: 1rem;\n margin: 0;\n}\n\n.empty-hint {\n font-size: 0.8rem !important;\n opacity: 0.7;\n}\n\n/* Legend */\n.legend {\n position: absolute;\n bottom: 20px;\n left: 20px;\n background: color-mix(in srgb, var(--mj-bg-surface) 92%, transparent);\n backdrop-filter: blur(12px);\n border: 1px solid var(--mj-border-default);\n border-radius: 10px;\n padding: 14px 18px;\n z-index: 3;\n}\n\n.legend-title {\n font-size: 0.7rem;\n color: var(--mj-text-muted);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin-bottom: 8px;\n}\n\n.legend-item {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 0.78rem;\n margin-bottom: 4px;\n color: var(--mj-text-primary);\n cursor: pointer;\n border-radius: 4px;\n padding: 2px 4px;\n margin-left: -4px;\n margin-right: -4px;\n transition: background 0.15s ease;\n}\n\n.legend-item:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.legend-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n\n.legend-label {\n flex: 1;\n}\n\n.legend-edit-btn {\n display: none;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n padding: 0;\n border: none;\n background: none;\n color: var(--mj-text-muted);\n cursor: pointer;\n font-size: 0.6rem;\n border-radius: 4px;\n transition: color 0.15s ease;\n}\n\n.legend-item:hover .legend-edit-btn {\n display: inline-flex;\n}\n\n.legend-edit-btn:hover {\n color: var(--mj-brand-primary);\n}\n\n.legend-label-input {\n flex: 1;\n padding: 2px 4px;\n border: 1px solid var(--mj-border-focus);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n color: var(--mj-text-primary);\n font-size: 0.75rem;\n outline: none;\n min-width: 60px;\n}\n\n.legend-count {\n color: var(--mj-text-muted);\n font-size: 0.7rem;\n margin-left: auto;\n padding-left: 16px;\n}\n\n/* Cluster labels on chart */\n.cluster-label {\n font-size: 14px;\n font-weight: 600;\n opacity: 0.85;\n pointer-events: none;\n text-shadow:\n 0 0 6px var(--mj-bg-page),\n 0 0 12px var(--mj-bg-page),\n 1px 1px 2px var(--mj-bg-page);\n}\n\n/* Tooltip */\n.tooltip {\n position: fixed;\n background: color-mix(in srgb, var(--mj-bg-surface-elevated) 96%, transparent);\n backdrop-filter: blur(16px);\n border: 1px solid var(--mj-border-strong);\n border-radius: 10px;\n padding: 14px 16px;\n width: 280px;\n box-shadow: 0 12px 40px color-mix(in srgb, var(--mj-bg-page) 40%, transparent);\n pointer-events: none;\n z-index: 50;\n}\n\n.tt-header {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n margin-bottom: 6px;\n}\n\n.tt-icon {\n width: 2rem;\n height: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 6px;\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n font-size: 0.85rem;\n flex-shrink: 0;\n}\n\n.tt-header-text {\n min-width: 0;\n flex: 1;\n}\n\n.tt-name {\n font-size: 0.85rem;\n font-weight: 600;\n color: var(--mj-text-primary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.tt-entity {\n font-size: 0.7rem;\n color: var(--mj-text-muted);\n margin-top: 1px;\n}\n\n.tt-cluster {\n font-size: 0.72rem;\n color: var(--mj-brand-primary);\n margin-bottom: 6px;\n}\n\n.tt-fields {\n font-size: 0.72rem;\n color: var(--mj-text-secondary);\n line-height: 1.6;\n}\n\n.tt-field-row {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.tt-action {\n margin-top: 8px;\n padding-top: 8px;\n border-top: 1px solid var(--mj-border-default);\n font-size: 0.7rem;\n color: var(--mj-text-muted);\n}\n\n.tt-action i {\n margin-right: 4px;\n}\n\n/* ================================================================\n Detail Panel (right slide-in)\n ================================================================ */\n\n.detail-panel {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: 320px;\n background: color-mix(in srgb, var(--mj-bg-surface) 92%, transparent);\n backdrop-filter: blur(16px);\n border-left: 1px solid var(--mj-border-default);\n z-index: 10;\n display: flex;\n flex-direction: column;\n transform: translateX(100%);\n transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: -4px 0 24px color-mix(in srgb, var(--mj-bg-page) 30%, transparent);\n overflow: hidden;\n}\n\n.detail-panel-open {\n transform: translateX(0);\n}\n\n/* Header */\n.detail-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n padding: 16px 16px 12px;\n border-bottom: 1px solid var(--mj-border-subtle);\n}\n\n.detail-header-content {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n min-width: 0;\n flex: 1;\n}\n\n.detail-icon {\n width: 2.25rem;\n height: 2.25rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n font-size: 0.95rem;\n flex-shrink: 0;\n}\n\n.detail-header-text {\n min-width: 0;\n flex: 1;\n}\n\n.detail-name {\n font-size: 0.95rem;\n font-weight: 600;\n color: var(--mj-text-primary);\n line-height: 1.3;\n word-wrap: break-word;\n}\n\n.detail-entity-badge {\n display: inline-block;\n margin-top: 4px;\n padding: 1px 8px;\n border-radius: 10px;\n font-size: 0.68rem;\n font-weight: 500;\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n}\n\n.detail-close {\n background: none;\n border: none;\n cursor: pointer;\n color: var(--mj-text-muted);\n font-size: 0.85rem;\n padding: 4px 6px;\n border-radius: 4px;\n transition: color 0.15s ease, background 0.15s ease;\n flex-shrink: 0;\n}\n\n.detail-close:hover {\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface-hover);\n}\n\n/* Cluster badge */\n.detail-cluster {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 16px;\n font-size: 0.78rem;\n font-weight: 500;\n color: var(--mj-text-secondary);\n}\n\n.detail-cluster-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n\n/* Metadata fields */\n.detail-fields {\n padding: 4px 16px 8px;\n overflow-y: auto;\n flex-shrink: 0;\n}\n\n.detail-field {\n padding: 6px 0;\n border-bottom: 1px solid var(--mj-border-subtle);\n}\n\n.detail-field:last-child {\n border-bottom: none;\n}\n\n.detail-field-key {\n font-size: 0.68rem;\n font-weight: 500;\n color: var(--mj-text-muted);\n text-transform: uppercase;\n letter-spacing: 0.3px;\n margin-bottom: 2px;\n}\n\n.detail-field-value {\n font-size: 0.8rem;\n color: var(--mj-text-primary);\n line-height: 1.4;\n word-wrap: break-word;\n}\n\n/* Cluster Members Section */\n.detail-members-section {\n flex: 1;\n min-height: 0;\n display: flex;\n flex-direction: column;\n border-top: 1px solid var(--mj-border-default);\n}\n\n.detail-members-toggle {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 10px 16px;\n background: none;\n border: none;\n cursor: pointer;\n font-size: 0.78rem;\n font-weight: 600;\n color: var(--mj-text-secondary);\n text-align: left;\n transition: background 0.15s ease;\n}\n\n.detail-members-toggle:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.detail-members-toggle i {\n font-size: 0.65rem;\n width: 12px;\n text-align: center;\n color: var(--mj-text-muted);\n}\n\n.detail-members-count {\n margin-left: auto;\n font-size: 0.7rem;\n font-weight: 400;\n color: var(--mj-text-muted);\n background: var(--mj-bg-surface-sunken);\n padding: 1px 7px;\n border-radius: 8px;\n}\n\n.detail-members-list {\n flex: 1;\n overflow-y: auto;\n padding: 0 8px 8px;\n}\n\n.detail-member-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 8px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 0.78rem;\n color: var(--mj-text-primary);\n transition: background 0.12s ease;\n}\n\n.detail-member-row:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.detail-member-row.active {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n font-weight: 500;\n}\n\n.detail-member-row .member-icon {\n font-size: 0.72rem;\n color: var(--mj-text-muted);\n width: 16px;\n text-align: center;\n flex-shrink: 0;\n}\n\n.detail-member-row.active .member-icon {\n color: var(--mj-brand-primary);\n}\n\n.member-label {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Footer */\n.detail-footer {\n padding: 12px 16px;\n border-top: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n}\n\n.detail-open-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n padding: 8px 16px;\n border: none;\n border-radius: 8px;\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n font-size: 0.82rem;\n font-weight: 500;\n cursor: pointer;\n transition: background 0.15s ease;\n}\n\n.detail-open-btn:hover {\n background: var(--mj-brand-primary-hover);\n}\n\n.detail-open-btn i {\n font-size: 0.75rem;\n}\n"], encapsulation: 2 }); }
|
|
1341
|
+
}
|
|
1342
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ClusterScatterComponent, [{
|
|
1343
|
+
type: Component,
|
|
1344
|
+
args: [{ standalone: false, selector: 'mj-cluster-scatter', encapsulation: ViewEncapsulation.None, template: "<div class=\"scatter-container\">\n <!-- Loading overlay -->\n @if (IsLoading) {\n <div class=\"loading-overlay\">\n <div class=\"loading-spinner\">\n <i class=\"fa-solid fa-circle-nodes fa-spin\"></i>\n <span>Computing clusters...</span>\n </div>\n </div>\n }\n\n <!-- Empty state -->\n @if (!IsLoading && Points.length === 0) {\n <div class=\"empty-state\">\n <i class=\"fa-solid fa-chart-scatter\"></i>\n <p>No data to display</p>\n <p class=\"empty-hint\">Configure and run clustering to see results</p>\n </div>\n }\n\n <!-- SVG scatter plot -->\n @if (Points.length > 0) {\n <svg #svgElement\n class=\"scatter-svg\"\n [class.no-transitions]=\"!AnimateTransitions\"\n [attr.viewBox]=\"ViewBoxString\"\n preserveAspectRatio=\"xMidYMid meet\"\n (wheel)=\"OnWheel($event)\"\n (mousedown)=\"OnMouseDown($event)\">\n\n <!-- Gradient definitions for cluster glow -->\n <defs>\n @for (centroid of ClusterCentroids; track TrackCentroidBy($index, centroid)) {\n <radialGradient [attr.id]=\"'cluster-glow-' + centroid.ClusterId\"\n cx=\"50%\" cy=\"50%\" r=\"50%\">\n <stop offset=\"0%\" [attr.stop-color]=\"centroid.Color\" stop-opacity=\"0.12\"/>\n <stop offset=\"100%\" [attr.stop-color]=\"centroid.Color\" stop-opacity=\"0\"/>\n </radialGradient>\n }\n </defs>\n\n <!-- Background grid lines -->\n <g class=\"grid-lines\">\n @for (y of HorizontalGridLines; track y) {\n <line [attr.x1]=\"0\" [attr.y1]=\"y\" [attr.x2]=\"1000\" [attr.y2]=\"y\"/>\n }\n @for (x of VerticalGridLines; track x) {\n <line [attr.x1]=\"x\" [attr.y1]=\"0\" [attr.x2]=\"x\" [attr.y2]=\"700\"/>\n }\n </g>\n\n <!-- Cluster glow circles -->\n @for (centroid of ClusterCentroids; track TrackCentroidBy($index, centroid)) {\n <circle [attr.cx]=\"centroid.Cx\"\n [attr.cy]=\"centroid.Cy\"\n [attr.r]=\"centroid.R\"\n [attr.fill]=\"'url(#cluster-glow-' + centroid.ClusterId + ')'\"/>\n }\n\n <!-- Cluster labels (positioned above centroids) -->\n @for (centroid of ClusterCentroids; track TrackCentroidBy($index, centroid)) {\n @if (GetClusterLabelById(centroid.ClusterId); as label) {\n <text class=\"cluster-label\"\n [attr.x]=\"centroid.Cx\"\n [attr.y]=\"centroid.Cy - centroid.R - 8\"\n text-anchor=\"middle\"\n [attr.fill]=\"centroid.Color\">{{ label }}</text>\n }\n }\n\n <!-- Data points -->\n @for (point of Points; track TrackPointBy($index, point)) {\n <circle class=\"data-point\"\n [attr.cx]=\"point.X\"\n [attr.cy]=\"point.Y\"\n [attr.r]=\"GetPointRadius(point)\"\n [attr.fill]=\"GetPointColor(point)\"\n [attr.opacity]=\"GetPointOpacity(point)\"\n (mouseenter)=\"OnPointMouseEnter(point, $event)\"\n (mouseleave)=\"OnPointMouseLeave()\"\n (click)=\"OnPointClick(point); $event.stopPropagation()\"/>\n }\n\n <!-- Selection rings for selected points -->\n @for (point of Points; track TrackPointBy($index, point)) {\n @if (IsSelected(point)) {\n <circle class=\"selection-ring\"\n [attr.cx]=\"point.X\"\n [attr.cy]=\"point.Y\"\n [attr.r]=\"HighlightRadius + 2\"\n fill=\"none\"\n [attr.stroke]=\"GetPointColor(point)\"\n stroke-width=\"2\"\n opacity=\"0.8\"/>\n }\n }\n\n <!-- Highlight ring for last-clicked point -->\n @if (HighlightedKey) {\n @for (point of Points; track TrackPointBy($index, point)) {\n @if (IsHighlighted(point)) {\n <circle [attr.cx]=\"point.X\"\n [attr.cy]=\"point.Y\"\n [attr.r]=\"HighlightRadius + 4\"\n fill=\"none\"\n [attr.stroke]=\"GetPointColor(point)\"\n stroke-width=\"2.5\"\n opacity=\"0.9\"/>\n }\n }\n }\n </svg>\n }\n\n <!-- Legend overlay -->\n @if (ShowLegend && Clusters.length > 0) {\n <div class=\"legend\">\n <div class=\"legend-title\">Clusters</div>\n @for (cluster of Clusters; track TrackClusterBy($index, cluster)) {\n <div class=\"legend-item\" (click)=\"OnClusterLegendClick(cluster)\">\n <div class=\"legend-dot\" [style.background]=\"cluster.Color\"></div>\n @if (EditingClusterId === cluster.Id) {\n <input class=\"legend-label-input\"\n [(ngModel)]=\"EditingLabelDraft\"\n (keydown)=\"OnLabelEditKeydown($event, cluster)\"\n (blur)=\"CommitLabelEdit(cluster)\"\n (click)=\"$event.stopPropagation()\"\n autofocus />\n } @else {\n <span class=\"legend-label\">{{ cluster.Label }}</span>\n <button class=\"legend-edit-btn\"\n title=\"Edit label\"\n (click)=\"StartLabelEdit(cluster, $event)\">\n <i class=\"fa-solid fa-pencil\"></i>\n </button>\n }\n <span class=\"legend-count\">{{ cluster.MemberCount }}</span>\n </div>\n }\n </div>\n }\n\n <!-- Tooltip -->\n @if (ShowTooltip && HoveredPoint) {\n <div class=\"tooltip\"\n [style.left.px]=\"TooltipX\"\n [style.top.px]=\"TooltipY\">\n <mj-entity-card\n [EntityName]=\"EntityName\"\n [Record]=\"HoveredPoint.Metadata\"\n Variant=\"compact\">\n </mj-entity-card>\n <div class=\"tt-cluster\">\n <i class=\"fa-solid fa-circle\" style=\"font-size: 7px; vertical-align: middle\"></i>\n {{ GetClusterLabel(HoveredPoint) }}\n </div>\n <div class=\"tt-action\">\n <i class=\"fa-solid fa-arrow-up-right-from-square\"></i> Click to view details\n </div>\n </div>\n }\n\n <!-- Detail Panel (slide-in from right) -->\n <div class=\"detail-panel\" [class.detail-panel-open]=\"ShowDetailPanel && SelectedPoint\">\n @if (SelectedPoint) {\n <!-- Panel Header -->\n <div class=\"detail-header\">\n <div class=\"detail-header-content\">\n @if (SelectedPoint.Metadata?.['EntityIcon']) {\n <div class=\"detail-icon\">\n <i [class]=\"SelectedPoint.Metadata['EntityIcon']\"></i>\n </div>\n }\n <div class=\"detail-header-text\">\n <div class=\"detail-name\">{{ SelectedPoint.Label }}</div>\n @if (SelectedPoint.Metadata?.['Entity']) {\n <span class=\"detail-entity-badge\">{{ SelectedPoint.Metadata['Entity'] }}</span>\n }\n </div>\n </div>\n <button class=\"detail-close\" (click)=\"CloseDetailPanel()\" title=\"Close\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n\n <!-- Cluster badge -->\n <div class=\"detail-cluster\">\n <span class=\"detail-cluster-dot\"\n [style.background]=\"GetClusterColor(SelectedPoint.ClusterId)\"></span>\n {{ GetClusterLabel(SelectedPoint) }}\n </div>\n\n <!-- Metadata fields via entity card -->\n <mj-entity-card\n [EntityName]=\"EntityName\"\n [Record]=\"SelectedPoint.Metadata\"\n Variant=\"detail\"\n CssClass=\"detail-entity-card\">\n </mj-entity-card>\n\n <!-- Cluster Members -->\n <div class=\"detail-members-section\">\n <button class=\"detail-members-toggle\" (click)=\"ToggleClusterMembers()\">\n <i class=\"fa-solid\"\n [class.fa-chevron-down]=\"ClusterMembersExpanded\"\n [class.fa-chevron-right]=\"!ClusterMembersExpanded\"></i>\n <span>Cluster Members</span>\n <span class=\"detail-members-count\">{{ ClusterMembers.length }}</span>\n </button>\n\n @if (ClusterMembersExpanded) {\n <div class=\"detail-members-list\">\n @for (member of ClusterMembers; track TrackMemberBy($index, member)) {\n <div class=\"detail-member-row\"\n [class.active]=\"member.VectorKey === SelectedPoint.VectorKey\"\n (click)=\"OnClusterMemberClick(member)\">\n @if (member.Metadata?.['EntityIcon']) {\n <i [class]=\"member.Metadata['EntityIcon']\" class=\"member-icon\"></i>\n }\n <span class=\"member-label\">{{ member.Label }}</span>\n </div>\n }\n </div>\n }\n </div>\n\n <!-- Open Record button -->\n <div class=\"detail-footer\">\n <button class=\"detail-open-btn\" (click)=\"OnOpenRecordClick()\">\n <i class=\"fa-solid fa-arrow-up-right-from-square\"></i>\n Open Record\n </button>\n </div>\n }\n </div>\n</div>\n", styles: [":host {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n}\n\n.scatter-container {\n width: 100%;\n height: 100%;\n position: relative;\n overflow: hidden;\n background: var(--mj-bg-page);\n}\n\n/* SVG */\n.scatter-svg {\n width: 100%;\n height: 100%;\n cursor: grab;\n user-select: none;\n}\n\n.scatter-svg:active {\n cursor: grabbing;\n}\n\n/* Grid lines */\n.grid-lines line {\n stroke: var(--mj-border-subtle);\n stroke-width: 0.5;\n}\n\n/* Data points */\n.data-point {\n cursor: pointer;\n transition: opacity 0.15s ease, r 0.15s ease;\n}\n\n.data-point:hover {\n filter: brightness(1.2);\n}\n\n/* Selection rings */\n.selection-ring {\n pointer-events: none;\n transition: r 0.15s ease;\n}\n\n/* Disable transitions when AnimateTransitions is false */\n.no-transitions .data-point,\n.no-transitions .selection-ring {\n transition: none;\n}\n\n/* Loading overlay */\n.loading-overlay {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: color-mix(in srgb, var(--mj-bg-page) 80%, transparent);\n z-index: 5;\n}\n\n.loading-spinner {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n color: var(--mj-text-secondary);\n font-size: 0.9rem;\n}\n\n.loading-spinner i {\n font-size: 2rem;\n color: var(--mj-brand-primary);\n}\n\n/* Empty state */\n.empty-state {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n color: var(--mj-text-muted);\n gap: 8px;\n}\n\n.empty-state i {\n font-size: 3rem;\n margin-bottom: 8px;\n opacity: 0.4;\n}\n\n.empty-state p {\n font-size: 1rem;\n margin: 0;\n}\n\n.empty-hint {\n font-size: 0.8rem !important;\n opacity: 0.7;\n}\n\n/* Legend */\n.legend {\n position: absolute;\n bottom: 20px;\n left: 20px;\n background: color-mix(in srgb, var(--mj-bg-surface) 92%, transparent);\n backdrop-filter: blur(12px);\n border: 1px solid var(--mj-border-default);\n border-radius: 10px;\n padding: 14px 18px;\n z-index: 3;\n}\n\n.legend-title {\n font-size: 0.7rem;\n color: var(--mj-text-muted);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin-bottom: 8px;\n}\n\n.legend-item {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 0.78rem;\n margin-bottom: 4px;\n color: var(--mj-text-primary);\n cursor: pointer;\n border-radius: 4px;\n padding: 2px 4px;\n margin-left: -4px;\n margin-right: -4px;\n transition: background 0.15s ease;\n}\n\n.legend-item:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.legend-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n\n.legend-label {\n flex: 1;\n}\n\n.legend-edit-btn {\n display: none;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n padding: 0;\n border: none;\n background: none;\n color: var(--mj-text-muted);\n cursor: pointer;\n font-size: 0.6rem;\n border-radius: 4px;\n transition: color 0.15s ease;\n}\n\n.legend-item:hover .legend-edit-btn {\n display: inline-flex;\n}\n\n.legend-edit-btn:hover {\n color: var(--mj-brand-primary);\n}\n\n.legend-label-input {\n flex: 1;\n padding: 2px 4px;\n border: 1px solid var(--mj-border-focus);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n color: var(--mj-text-primary);\n font-size: 0.75rem;\n outline: none;\n min-width: 60px;\n}\n\n.legend-count {\n color: var(--mj-text-muted);\n font-size: 0.7rem;\n margin-left: auto;\n padding-left: 16px;\n}\n\n/* Cluster labels on chart */\n.cluster-label {\n font-size: 14px;\n font-weight: 600;\n opacity: 0.85;\n pointer-events: none;\n text-shadow:\n 0 0 6px var(--mj-bg-page),\n 0 0 12px var(--mj-bg-page),\n 1px 1px 2px var(--mj-bg-page);\n}\n\n/* Tooltip */\n.tooltip {\n position: fixed;\n background: color-mix(in srgb, var(--mj-bg-surface-elevated) 96%, transparent);\n backdrop-filter: blur(16px);\n border: 1px solid var(--mj-border-strong);\n border-radius: 10px;\n padding: 14px 16px;\n width: 280px;\n box-shadow: 0 12px 40px color-mix(in srgb, var(--mj-bg-page) 40%, transparent);\n pointer-events: none;\n z-index: 50;\n}\n\n.tt-header {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n margin-bottom: 6px;\n}\n\n.tt-icon {\n width: 2rem;\n height: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 6px;\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n font-size: 0.85rem;\n flex-shrink: 0;\n}\n\n.tt-header-text {\n min-width: 0;\n flex: 1;\n}\n\n.tt-name {\n font-size: 0.85rem;\n font-weight: 600;\n color: var(--mj-text-primary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.tt-entity {\n font-size: 0.7rem;\n color: var(--mj-text-muted);\n margin-top: 1px;\n}\n\n.tt-cluster {\n font-size: 0.72rem;\n color: var(--mj-brand-primary);\n margin-bottom: 6px;\n}\n\n.tt-fields {\n font-size: 0.72rem;\n color: var(--mj-text-secondary);\n line-height: 1.6;\n}\n\n.tt-field-row {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.tt-action {\n margin-top: 8px;\n padding-top: 8px;\n border-top: 1px solid var(--mj-border-default);\n font-size: 0.7rem;\n color: var(--mj-text-muted);\n}\n\n.tt-action i {\n margin-right: 4px;\n}\n\n/* ================================================================\n Detail Panel (right slide-in)\n ================================================================ */\n\n.detail-panel {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: 320px;\n background: color-mix(in srgb, var(--mj-bg-surface) 92%, transparent);\n backdrop-filter: blur(16px);\n border-left: 1px solid var(--mj-border-default);\n z-index: 10;\n display: flex;\n flex-direction: column;\n transform: translateX(100%);\n transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: -4px 0 24px color-mix(in srgb, var(--mj-bg-page) 30%, transparent);\n overflow: hidden;\n}\n\n.detail-panel-open {\n transform: translateX(0);\n}\n\n/* Header */\n.detail-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n padding: 16px 16px 12px;\n border-bottom: 1px solid var(--mj-border-subtle);\n}\n\n.detail-header-content {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n min-width: 0;\n flex: 1;\n}\n\n.detail-icon {\n width: 2.25rem;\n height: 2.25rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n font-size: 0.95rem;\n flex-shrink: 0;\n}\n\n.detail-header-text {\n min-width: 0;\n flex: 1;\n}\n\n.detail-name {\n font-size: 0.95rem;\n font-weight: 600;\n color: var(--mj-text-primary);\n line-height: 1.3;\n word-wrap: break-word;\n}\n\n.detail-entity-badge {\n display: inline-block;\n margin-top: 4px;\n padding: 1px 8px;\n border-radius: 10px;\n font-size: 0.68rem;\n font-weight: 500;\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n}\n\n.detail-close {\n background: none;\n border: none;\n cursor: pointer;\n color: var(--mj-text-muted);\n font-size: 0.85rem;\n padding: 4px 6px;\n border-radius: 4px;\n transition: color 0.15s ease, background 0.15s ease;\n flex-shrink: 0;\n}\n\n.detail-close:hover {\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface-hover);\n}\n\n/* Cluster badge */\n.detail-cluster {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 16px;\n font-size: 0.78rem;\n font-weight: 500;\n color: var(--mj-text-secondary);\n}\n\n.detail-cluster-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n\n/* Metadata fields */\n.detail-fields {\n padding: 4px 16px 8px;\n overflow-y: auto;\n flex-shrink: 0;\n}\n\n.detail-field {\n padding: 6px 0;\n border-bottom: 1px solid var(--mj-border-subtle);\n}\n\n.detail-field:last-child {\n border-bottom: none;\n}\n\n.detail-field-key {\n font-size: 0.68rem;\n font-weight: 500;\n color: var(--mj-text-muted);\n text-transform: uppercase;\n letter-spacing: 0.3px;\n margin-bottom: 2px;\n}\n\n.detail-field-value {\n font-size: 0.8rem;\n color: var(--mj-text-primary);\n line-height: 1.4;\n word-wrap: break-word;\n}\n\n/* Cluster Members Section */\n.detail-members-section {\n flex: 1;\n min-height: 0;\n display: flex;\n flex-direction: column;\n border-top: 1px solid var(--mj-border-default);\n}\n\n.detail-members-toggle {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 10px 16px;\n background: none;\n border: none;\n cursor: pointer;\n font-size: 0.78rem;\n font-weight: 600;\n color: var(--mj-text-secondary);\n text-align: left;\n transition: background 0.15s ease;\n}\n\n.detail-members-toggle:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.detail-members-toggle i {\n font-size: 0.65rem;\n width: 12px;\n text-align: center;\n color: var(--mj-text-muted);\n}\n\n.detail-members-count {\n margin-left: auto;\n font-size: 0.7rem;\n font-weight: 400;\n color: var(--mj-text-muted);\n background: var(--mj-bg-surface-sunken);\n padding: 1px 7px;\n border-radius: 8px;\n}\n\n.detail-members-list {\n flex: 1;\n overflow-y: auto;\n padding: 0 8px 8px;\n}\n\n.detail-member-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 8px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 0.78rem;\n color: var(--mj-text-primary);\n transition: background 0.12s ease;\n}\n\n.detail-member-row:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.detail-member-row.active {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n font-weight: 500;\n}\n\n.detail-member-row .member-icon {\n font-size: 0.72rem;\n color: var(--mj-text-muted);\n width: 16px;\n text-align: center;\n flex-shrink: 0;\n}\n\n.detail-member-row.active .member-icon {\n color: var(--mj-brand-primary);\n}\n\n.member-label {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Footer */\n.detail-footer {\n padding: 12px 16px;\n border-top: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n}\n\n.detail-open-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n padding: 8px 16px;\n border: none;\n border-radius: 8px;\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n font-size: 0.82rem;\n font-weight: 500;\n cursor: pointer;\n transition: background 0.15s ease;\n}\n\n.detail-open-btn:hover {\n background: var(--mj-brand-primary-hover);\n}\n\n.detail-open-btn i {\n font-size: 0.75rem;\n}\n"] }]
|
|
1345
|
+
}], null, { Points: [{
|
|
1346
|
+
type: Input
|
|
1347
|
+
}], Clusters: [{
|
|
1348
|
+
type: Input
|
|
1349
|
+
}], IsLoading: [{
|
|
1350
|
+
type: Input
|
|
1351
|
+
}], DotRadius: [{
|
|
1352
|
+
type: Input
|
|
1353
|
+
}], DotOpacity: [{
|
|
1354
|
+
type: Input
|
|
1355
|
+
}], HighlightRadius: [{
|
|
1356
|
+
type: Input
|
|
1357
|
+
}], ShowLegend: [{
|
|
1358
|
+
type: Input
|
|
1359
|
+
}], ShowTooltip: [{
|
|
1360
|
+
type: Input
|
|
1361
|
+
}], TooltipFields: [{
|
|
1362
|
+
type: Input
|
|
1363
|
+
}], FieldPriority: [{
|
|
1364
|
+
type: Input
|
|
1365
|
+
}], FieldDisplayNames: [{
|
|
1366
|
+
type: Input
|
|
1367
|
+
}], EntityName: [{
|
|
1368
|
+
type: Input
|
|
1369
|
+
}], ColorPalette: [{
|
|
1370
|
+
type: Input
|
|
1371
|
+
}], EnableZoom: [{
|
|
1372
|
+
type: Input
|
|
1373
|
+
}], EnablePan: [{
|
|
1374
|
+
type: Input
|
|
1375
|
+
}], AnimateTransitions: [{
|
|
1376
|
+
type: Input
|
|
1377
|
+
}], SelectedPointIds: [{
|
|
1378
|
+
type: Input
|
|
1379
|
+
}], MinZoom: [{
|
|
1380
|
+
type: Input
|
|
1381
|
+
}], MaxZoom: [{
|
|
1382
|
+
type: Input
|
|
1383
|
+
}], PointClicked: [{
|
|
1384
|
+
type: Output
|
|
1385
|
+
}], OpenRecordRequested: [{
|
|
1386
|
+
type: Output
|
|
1387
|
+
}], PointHovered: [{
|
|
1388
|
+
type: Output
|
|
1389
|
+
}], BeforePointClick: [{
|
|
1390
|
+
type: Output
|
|
1391
|
+
}], BeforePointHover: [{
|
|
1392
|
+
type: Output
|
|
1393
|
+
}], BeforeZoom: [{
|
|
1394
|
+
type: Output
|
|
1395
|
+
}], AfterClusteringComplete: [{
|
|
1396
|
+
type: Output
|
|
1397
|
+
}], ClusterSelected: [{
|
|
1398
|
+
type: Output
|
|
1399
|
+
}], SelectionChanged: [{
|
|
1400
|
+
type: Output
|
|
1401
|
+
}], ViewportChanged: [{
|
|
1402
|
+
type: Output
|
|
1403
|
+
}], LabelEdited: [{
|
|
1404
|
+
type: Output
|
|
1405
|
+
}], svgRef: [{
|
|
1406
|
+
type: ViewChild,
|
|
1407
|
+
args: ['svgElement', { static: false }]
|
|
1408
|
+
}] }); })();
|
|
1409
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ClusterScatterComponent, { className: "ClusterScatterComponent", filePath: "src/lib/cluster-scatter.component.ts", lineNumber: 64 }); })();
|
|
1410
|
+
//# sourceMappingURL=cluster-scatter.component.js.map
|