@antv/gpt-vis 1.3.1 → 1.4.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 +261 -137
- package/README.zh-CN.md +263 -116
- package/dist/cjs/annotation/components/bottom-n.d.ts +2 -0
- package/dist/cjs/annotation/components/bottom-n.js +57 -0
- package/dist/cjs/annotation/components/centroid.d.ts +2 -0
- package/dist/cjs/annotation/components/centroid.js +75 -0
- package/dist/cjs/annotation/components/connector.d.ts +25 -0
- package/dist/cjs/annotation/components/connector.js +298 -0
- package/dist/cjs/annotation/components/contribution.d.ts +3 -0
- package/dist/cjs/annotation/components/contribution.js +136 -0
- package/dist/cjs/annotation/components/crossing.d.ts +3 -0
- package/dist/cjs/annotation/components/crossing.js +504 -0
- package/dist/cjs/annotation/components/event.d.ts +2 -0
- package/dist/cjs/annotation/components/event.js +62 -0
- package/dist/cjs/annotation/components/first.d.ts +2 -0
- package/dist/cjs/annotation/components/first.js +42 -0
- package/dist/cjs/annotation/components/group.d.ts +3 -0
- package/dist/cjs/annotation/components/group.js +73 -0
- package/dist/cjs/annotation/components/highlight.d.ts +14 -0
- package/dist/cjs/annotation/components/highlight.js +552 -0
- package/dist/cjs/annotation/components/index.d.ts +34 -0
- package/dist/cjs/annotation/components/index.js +128 -0
- package/dist/cjs/annotation/components/last.d.ts +2 -0
- package/dist/cjs/annotation/components/last.js +42 -0
- package/dist/cjs/annotation/components/max-x.d.ts +2 -0
- package/dist/cjs/annotation/components/max-x.js +41 -0
- package/dist/cjs/annotation/components/max-y.d.ts +2 -0
- package/dist/cjs/annotation/components/max-y.js +41 -0
- package/dist/cjs/annotation/components/mean.d.ts +2 -0
- package/dist/cjs/annotation/components/mean.js +50 -0
- package/dist/cjs/annotation/components/median.d.ts +2 -0
- package/dist/cjs/annotation/components/median.js +49 -0
- package/dist/cjs/annotation/components/min-x.d.ts +2 -0
- package/dist/cjs/annotation/components/min-x.js +41 -0
- package/dist/cjs/annotation/components/min-y.d.ts +2 -0
- package/dist/cjs/annotation/components/min-y.js +41 -0
- package/dist/cjs/annotation/components/outlier.d.ts +3 -0
- package/dist/cjs/annotation/components/outlier.js +83 -0
- package/dist/cjs/annotation/components/path.d.ts +20 -0
- package/dist/cjs/annotation/components/path.js +147 -0
- package/dist/cjs/annotation/components/peak.d.ts +2 -0
- package/dist/cjs/annotation/components/peak.js +42 -0
- package/dist/cjs/annotation/components/point.d.ts +26 -0
- package/dist/cjs/annotation/components/point.js +241 -0
- package/dist/cjs/annotation/components/quadrant.d.ts +3 -0
- package/dist/cjs/annotation/components/quadrant.js +97 -0
- package/dist/cjs/annotation/components/quantile.d.ts +2 -0
- package/dist/cjs/annotation/components/quantile.js +49 -0
- package/dist/cjs/annotation/components/range-inside.d.ts +2 -0
- package/dist/cjs/annotation/components/range-inside.js +65 -0
- package/dist/cjs/annotation/components/range-outside.d.ts +2 -0
- package/dist/cjs/annotation/components/range-outside.js +65 -0
- package/dist/cjs/annotation/components/range-x.d.ts +2 -0
- package/dist/cjs/annotation/components/range-x.js +39 -0
- package/dist/cjs/annotation/components/range-y.d.ts +2 -0
- package/dist/cjs/annotation/components/range-y.js +39 -0
- package/dist/cjs/annotation/components/range.d.ts +15 -0
- package/dist/cjs/annotation/components/range.js +87 -0
- package/dist/cjs/annotation/components/target.d.ts +2 -0
- package/dist/cjs/annotation/components/target.js +51 -0
- package/dist/cjs/annotation/components/text.d.ts +15 -0
- package/dist/cjs/annotation/components/text.js +74 -0
- package/dist/cjs/annotation/components/threshold-highlight.d.ts +3 -0
- package/dist/cjs/annotation/components/threshold-highlight.js +223 -0
- package/dist/cjs/annotation/components/threshold-x.d.ts +2 -0
- package/dist/cjs/annotation/components/threshold-x.js +39 -0
- package/dist/cjs/annotation/components/threshold-y.d.ts +2 -0
- package/dist/cjs/annotation/components/threshold-y.js +40 -0
- package/dist/cjs/annotation/components/top-n.d.ts +2 -0
- package/dist/cjs/annotation/components/top-n.js +57 -0
- package/dist/cjs/annotation/components/valley.d.ts +2 -0
- package/dist/cjs/annotation/components/valley.js +42 -0
- package/dist/cjs/annotation/index.d.ts +1 -0
- package/dist/cjs/annotation/index.js +29 -0
- package/dist/cjs/annotation/label.d.ts +38 -0
- package/dist/cjs/annotation/label.js +347 -0
- package/dist/cjs/annotation/layout.d.ts +12 -0
- package/dist/cjs/annotation/layout.js +142 -0
- package/dist/cjs/annotation/merge.d.ts +19 -0
- package/dist/cjs/annotation/merge.js +60 -0
- package/dist/cjs/annotation/registry.d.ts +190 -0
- package/dist/cjs/annotation/registry.js +134 -0
- package/dist/cjs/annotation/runtime/g2.d.ts +90 -0
- package/dist/cjs/annotation/runtime/g2.js +521 -0
- package/dist/cjs/annotation/runtime/g6.d.ts +40 -0
- package/dist/cjs/annotation/runtime/g6.js +310 -0
- package/dist/cjs/annotation/runtime/index.d.ts +11 -0
- package/dist/cjs/annotation/runtime/index.js +41 -0
- package/dist/cjs/annotation/runtime/summary.d.ts +17 -0
- package/dist/cjs/annotation/runtime/summary.js +39 -0
- package/dist/cjs/annotation/runtime/table.d.ts +16 -0
- package/dist/cjs/annotation/runtime/table.js +39 -0
- package/dist/cjs/annotation/utils.d.ts +40 -0
- package/dist/cjs/annotation/utils.js +275 -0
- package/dist/cjs/theme/annotation.d.ts +236 -0
- package/dist/cjs/theme/annotation.js +167 -0
- package/dist/cjs/theme/g2.js +13 -15
- package/dist/cjs/theme/g6.js +2 -2
- package/dist/cjs/theme/summary.js +2 -2
- package/dist/cjs/types/annotation.d.ts +310 -0
- package/dist/cjs/types/annotation.js +17 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/util/axis.d.ts +28 -0
- package/dist/cjs/util/axis.js +184 -0
- package/dist/cjs/util/components.d.ts +0 -10
- package/dist/cjs/util/components.js +9 -64
- package/dist/cjs/util/index.d.ts +7 -4
- package/dist/cjs/util/index.js +53 -9
- package/dist/cjs/vis/area/index.d.ts +2 -0
- package/dist/cjs/vis/area/index.js +30 -13
- package/dist/cjs/vis/bar/index.d.ts +2 -0
- package/dist/cjs/vis/bar/index.js +37 -7
- package/dist/cjs/vis/boxplot/index.js +14 -3
- package/dist/cjs/vis/column/index.d.ts +2 -0
- package/dist/cjs/vis/column/index.js +28 -9
- package/dist/cjs/vis/dual-axes/index.js +9 -9
- package/dist/cjs/vis/fishbone-diagram/index.js +2 -2
- package/dist/cjs/vis/flow-diagram/index.js +2 -2
- package/dist/cjs/vis/funnel/index.js +10 -13
- package/dist/cjs/vis/histogram/index.js +2 -2
- package/dist/cjs/vis/indented-tree/index.js +2 -2
- package/dist/cjs/vis/line/index.d.ts +2 -0
- package/dist/cjs/vis/line/index.js +26 -10
- package/dist/cjs/vis/liquid/index.js +2 -2
- package/dist/cjs/vis/mindmap/index.js +2 -2
- package/dist/cjs/vis/network-graph/index.d.ts +2 -0
- package/dist/cjs/vis/network-graph/index.js +24 -3
- package/dist/cjs/vis/organization-chart/index.js +2 -2
- package/dist/cjs/vis/pie/index.d.ts +2 -0
- package/dist/cjs/vis/pie/index.js +21 -10
- package/dist/cjs/vis/radar/index.js +4 -6
- package/dist/cjs/vis/sankey/index.js +14 -1
- package/dist/cjs/vis/scatter/index.d.ts +10 -3
- package/dist/cjs/vis/scatter/index.js +18 -7
- package/dist/cjs/vis/summary/index.d.ts +9 -2
- package/dist/cjs/vis/summary/index.js +25 -8
- package/dist/cjs/vis/table/index.d.ts +2 -0
- package/dist/cjs/vis/table/index.js +48 -30
- package/dist/cjs/vis/venn/index.js +2 -2
- package/dist/cjs/vis/violin/index.js +14 -3
- package/dist/cjs/vis/waterfall/index.js +17 -9
- package/dist/cjs/vis/word-cloud/index.js +4 -6
- package/dist/cjs/vis-wrapper/index.js +2 -1
- package/dist/esm/annotation/components/bottom-n.d.ts +2 -0
- package/dist/esm/annotation/components/bottom-n.js +42 -0
- package/dist/esm/annotation/components/centroid.d.ts +2 -0
- package/dist/esm/annotation/components/centroid.js +73 -0
- package/dist/esm/annotation/components/connector.d.ts +25 -0
- package/dist/esm/annotation/components/connector.js +332 -0
- package/dist/esm/annotation/components/contribution.d.ts +3 -0
- package/dist/esm/annotation/components/contribution.js +174 -0
- package/dist/esm/annotation/components/crossing.d.ts +3 -0
- package/dist/esm/annotation/components/crossing.js +665 -0
- package/dist/esm/annotation/components/event.d.ts +2 -0
- package/dist/esm/annotation/components/event.js +46 -0
- package/dist/esm/annotation/components/first.d.ts +2 -0
- package/dist/esm/annotation/components/first.js +18 -0
- package/dist/esm/annotation/components/group.d.ts +3 -0
- package/dist/esm/annotation/components/group.js +64 -0
- package/dist/esm/annotation/components/highlight.d.ts +14 -0
- package/dist/esm/annotation/components/highlight.js +838 -0
- package/dist/esm/annotation/components/index.d.ts +34 -0
- package/dist/esm/annotation/components/index.js +34 -0
- package/dist/esm/annotation/components/last.d.ts +2 -0
- package/dist/esm/annotation/components/last.js +18 -0
- package/dist/esm/annotation/components/max-x.d.ts +2 -0
- package/dist/esm/annotation/components/max-x.js +17 -0
- package/dist/esm/annotation/components/max-y.d.ts +2 -0
- package/dist/esm/annotation/components/max-y.js +17 -0
- package/dist/esm/annotation/components/mean.d.ts +2 -0
- package/dist/esm/annotation/components/mean.js +40 -0
- package/dist/esm/annotation/components/median.d.ts +2 -0
- package/dist/esm/annotation/components/median.js +32 -0
- package/dist/esm/annotation/components/min-x.d.ts +2 -0
- package/dist/esm/annotation/components/min-x.js +17 -0
- package/dist/esm/annotation/components/min-y.d.ts +2 -0
- package/dist/esm/annotation/components/min-y.js +17 -0
- package/dist/esm/annotation/components/outlier.d.ts +3 -0
- package/dist/esm/annotation/components/outlier.js +98 -0
- package/dist/esm/annotation/components/path.d.ts +20 -0
- package/dist/esm/annotation/components/path.js +165 -0
- package/dist/esm/annotation/components/peak.d.ts +2 -0
- package/dist/esm/annotation/components/peak.js +20 -0
- package/dist/esm/annotation/components/point.d.ts +26 -0
- package/dist/esm/annotation/components/point.js +277 -0
- package/dist/esm/annotation/components/quadrant.d.ts +3 -0
- package/dist/esm/annotation/components/quadrant.js +83 -0
- package/dist/esm/annotation/components/quantile.d.ts +2 -0
- package/dist/esm/annotation/components/quantile.js +32 -0
- package/dist/esm/annotation/components/range-inside.d.ts +2 -0
- package/dist/esm/annotation/components/range-inside.js +55 -0
- package/dist/esm/annotation/components/range-outside.d.ts +2 -0
- package/dist/esm/annotation/components/range-outside.js +55 -0
- package/dist/esm/annotation/components/range-x.d.ts +2 -0
- package/dist/esm/annotation/components/range-x.js +15 -0
- package/dist/esm/annotation/components/range-y.d.ts +2 -0
- package/dist/esm/annotation/components/range-y.js +15 -0
- package/dist/esm/annotation/components/range.d.ts +15 -0
- package/dist/esm/annotation/components/range.js +92 -0
- package/dist/esm/annotation/components/target.d.ts +2 -0
- package/dist/esm/annotation/components/target.js +44 -0
- package/dist/esm/annotation/components/text.d.ts +15 -0
- package/dist/esm/annotation/components/text.js +78 -0
- package/dist/esm/annotation/components/threshold-highlight.d.ts +3 -0
- package/dist/esm/annotation/components/threshold-highlight.js +297 -0
- package/dist/esm/annotation/components/threshold-x.d.ts +2 -0
- package/dist/esm/annotation/components/threshold-x.js +23 -0
- package/dist/esm/annotation/components/threshold-y.d.ts +2 -0
- package/dist/esm/annotation/components/threshold-y.js +24 -0
- package/dist/esm/annotation/components/top-n.d.ts +2 -0
- package/dist/esm/annotation/components/top-n.js +42 -0
- package/dist/esm/annotation/components/valley.d.ts +2 -0
- package/dist/esm/annotation/components/valley.js +20 -0
- package/dist/esm/annotation/index.d.ts +1 -0
- package/dist/esm/annotation/index.js +1 -0
- package/dist/esm/annotation/label.d.ts +38 -0
- package/dist/esm/annotation/label.js +449 -0
- package/dist/esm/annotation/layout.d.ts +12 -0
- package/dist/esm/annotation/layout.js +182 -0
- package/dist/esm/annotation/merge.d.ts +19 -0
- package/dist/esm/annotation/merge.js +67 -0
- package/dist/esm/annotation/registry.d.ts +190 -0
- package/dist/esm/annotation/registry.js +220 -0
- package/dist/esm/annotation/runtime/g2.d.ts +90 -0
- package/dist/esm/annotation/runtime/g2.js +754 -0
- package/dist/esm/annotation/runtime/g6.d.ts +40 -0
- package/dist/esm/annotation/runtime/g6.js +447 -0
- package/dist/esm/annotation/runtime/index.d.ts +11 -0
- package/dist/esm/annotation/runtime/index.js +26 -0
- package/dist/esm/annotation/runtime/summary.d.ts +17 -0
- package/dist/esm/annotation/runtime/summary.js +21 -0
- package/dist/esm/annotation/runtime/table.d.ts +16 -0
- package/dist/esm/annotation/runtime/table.js +21 -0
- package/dist/esm/annotation/utils.d.ts +40 -0
- package/dist/esm/annotation/utils.js +370 -0
- package/dist/esm/theme/annotation.d.ts +236 -0
- package/dist/esm/theme/annotation.js +186 -0
- package/dist/esm/theme/g2.js +2 -10
- package/dist/esm/theme/g6.js +1 -1
- package/dist/esm/theme/summary.js +1 -1
- package/dist/esm/types/annotation.d.ts +310 -0
- package/dist/esm/types/annotation.js +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/util/axis.d.ts +28 -0
- package/dist/esm/util/axis.js +222 -0
- package/dist/esm/util/components.d.ts +0 -10
- package/dist/esm/util/components.js +24 -69
- package/dist/esm/util/index.d.ts +7 -4
- package/dist/esm/util/index.js +7 -4
- package/dist/esm/vis/area/index.d.ts +2 -0
- package/dist/esm/vis/area/index.js +32 -9
- package/dist/esm/vis/bar/index.d.ts +2 -0
- package/dist/esm/vis/bar/index.js +37 -6
- package/dist/esm/vis/boxplot/index.js +10 -2
- package/dist/esm/vis/column/index.d.ts +2 -0
- package/dist/esm/vis/column/index.js +33 -12
- package/dist/esm/vis/dual-axes/index.js +10 -10
- package/dist/esm/vis/fishbone-diagram/index.js +1 -1
- package/dist/esm/vis/flow-diagram/index.js +1 -1
- package/dist/esm/vis/funnel/index.js +2 -7
- package/dist/esm/vis/histogram/index.js +4 -3
- package/dist/esm/vis/indented-tree/index.js +1 -1
- package/dist/esm/vis/line/index.d.ts +2 -0
- package/dist/esm/vis/line/index.js +31 -9
- package/dist/esm/vis/liquid/index.js +1 -1
- package/dist/esm/vis/mindmap/index.js +1 -1
- package/dist/esm/vis/network-graph/index.d.ts +2 -0
- package/dist/esm/vis/network-graph/index.js +29 -2
- package/dist/esm/vis/organization-chart/index.js +1 -1
- package/dist/esm/vis/pie/index.d.ts +2 -0
- package/dist/esm/vis/pie/index.js +25 -8
- package/dist/esm/vis/radar/index.js +1 -3
- package/dist/esm/vis/sankey/index.js +15 -1
- package/dist/esm/vis/scatter/index.d.ts +10 -3
- package/dist/esm/vis/scatter/index.js +28 -5
- package/dist/esm/vis/summary/index.d.ts +9 -2
- package/dist/esm/vis/summary/index.js +31 -13
- package/dist/esm/vis/table/index.d.ts +2 -0
- package/dist/esm/vis/table/index.js +50 -33
- package/dist/esm/vis/venn/index.js +1 -1
- package/dist/esm/vis/violin/index.js +10 -2
- package/dist/esm/vis/waterfall/index.js +16 -13
- package/dist/esm/vis/word-cloud/index.js +1 -3
- package/dist/esm/vis-wrapper/index.js +2 -1
- package/dist/umd/index.min.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/annotation/runtime/g6.ts
|
|
20
|
+
var g6_exports = {};
|
|
21
|
+
__export(g6_exports, {
|
|
22
|
+
bindAnnotations: () => bindAnnotations
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(g6_exports);
|
|
25
|
+
var import_g6 = require("@antv/g6");
|
|
26
|
+
var import_layout = require("../layout");
|
|
27
|
+
var import_merge = require("../merge");
|
|
28
|
+
var import_registry = require("../registry");
|
|
29
|
+
var import_utils = require("../utils");
|
|
30
|
+
function bindAnnotations(options) {
|
|
31
|
+
var _a;
|
|
32
|
+
if (options.renderer !== "g6")
|
|
33
|
+
return;
|
|
34
|
+
const { graph, data, edgeIds, defaults } = options;
|
|
35
|
+
if (!((_a = options.annotations) == null ? void 0 : _a.length))
|
|
36
|
+
return () => {
|
|
37
|
+
};
|
|
38
|
+
const rows = [...data.nodes, ...data.edges];
|
|
39
|
+
const prepared = (0, import_registry.prepareAnnotations)("g6", options.annotations, {
|
|
40
|
+
chartType: "network-graph",
|
|
41
|
+
data: rows
|
|
42
|
+
});
|
|
43
|
+
const annotations = prepared.map(({ annotation }) => annotation);
|
|
44
|
+
const groups = (0, import_merge.mergeAnnotations)(prepared);
|
|
45
|
+
const cleanupHighlights = bindHighlights(options, annotations);
|
|
46
|
+
const position = (selector) => {
|
|
47
|
+
const row = rows.find((row2) => row2 === selector) ?? selectDatum(rows, selector);
|
|
48
|
+
const id = "source" in row ? edgeIds[data.edges.indexOf(row)] : row.name;
|
|
49
|
+
if (graph.getElementVisibility(id) === "hidden")
|
|
50
|
+
return void 0;
|
|
51
|
+
const anchor = "source" in row ? graph.getElementRenderBounds(id).center : graph.getElementPosition(id);
|
|
52
|
+
const center = graph.getViewportByCanvas(anchor);
|
|
53
|
+
return [center[0], center[1]];
|
|
54
|
+
};
|
|
55
|
+
let layer;
|
|
56
|
+
const events = ["afterlayout", "afterdraw", "aftertransform", "aftersizechange"];
|
|
57
|
+
const draw = () => layer == null ? void 0 : layer.draw();
|
|
58
|
+
const render = () => {
|
|
59
|
+
layer ?? (layer = createLayer(graph, groups, position, defaults, data));
|
|
60
|
+
draw();
|
|
61
|
+
};
|
|
62
|
+
graph.on("afterrender", render);
|
|
63
|
+
for (const event of events)
|
|
64
|
+
graph.on(event, draw);
|
|
65
|
+
const cleanup = () => {
|
|
66
|
+
graph.off("afterrender", render);
|
|
67
|
+
for (const event of events)
|
|
68
|
+
graph.off(event, draw);
|
|
69
|
+
graph.off("beforedestroy", cleanup);
|
|
70
|
+
layer == null ? void 0 : layer.destroy();
|
|
71
|
+
cleanupHighlights();
|
|
72
|
+
};
|
|
73
|
+
graph.on("beforedestroy", cleanup);
|
|
74
|
+
return cleanup;
|
|
75
|
+
}
|
|
76
|
+
function bindHighlights({ graph, data, edgeIds, defaults }, annotations) {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
const highlights = annotations.filter(
|
|
79
|
+
(annotation) => annotation.type === "highlight"
|
|
80
|
+
);
|
|
81
|
+
if (!highlights.length)
|
|
82
|
+
return () => {
|
|
83
|
+
};
|
|
84
|
+
const rows = [...data.nodes, ...data.edges];
|
|
85
|
+
const selections = highlights.map((annotation) => {
|
|
86
|
+
const selected = (0, import_utils.selectedRows)(rows, annotation.data);
|
|
87
|
+
if (!selected.length)
|
|
88
|
+
throw new Error("Invalid annotation: highlight matches no data.");
|
|
89
|
+
return { annotation, rows: selected };
|
|
90
|
+
});
|
|
91
|
+
const dim = (0, import_utils.getDimOpacity)(highlights, defaults.highlight.dimOpacity);
|
|
92
|
+
const restore = [];
|
|
93
|
+
for (const [index, row] of rows.entries()) {
|
|
94
|
+
const edge = index >= data.nodes.length;
|
|
95
|
+
const id = edge ? edgeIds[index - data.nodes.length] : data.nodes[index].name;
|
|
96
|
+
const original = edge ? graph.getEdgeData(id) : graph.getNodeData(id);
|
|
97
|
+
const matches = selections.filter(({ rows: rows2 }) => rows2.includes(row));
|
|
98
|
+
const style = matches.length ? {} : { opacity: Number(((_a = original.style) == null ? void 0 : _a.opacity) ?? 1) * dim };
|
|
99
|
+
for (const { annotation } of matches)
|
|
100
|
+
for (const key of ["fill", "stroke", "lineWidth", "fillOpacity"])
|
|
101
|
+
if (((_b = annotation.style) == null ? void 0 : _b[key]) !== void 0)
|
|
102
|
+
style[key] = annotation.style[key];
|
|
103
|
+
const previous = Object.fromEntries(
|
|
104
|
+
Object.keys(style).map((key) => {
|
|
105
|
+
var _a2;
|
|
106
|
+
return [key, (_a2 = original.style) == null ? void 0 : _a2[key]];
|
|
107
|
+
})
|
|
108
|
+
);
|
|
109
|
+
if (edge) {
|
|
110
|
+
graph.updateEdgeData([{ id, style }]);
|
|
111
|
+
restore.push(() => graph.updateEdgeData([{ id, style: previous }]));
|
|
112
|
+
} else {
|
|
113
|
+
graph.updateNodeData([{ id, style }]);
|
|
114
|
+
restore.push(() => graph.updateNodeData([{ id, style: previous }]));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
let disposed = false;
|
|
118
|
+
return () => {
|
|
119
|
+
if (disposed)
|
|
120
|
+
return;
|
|
121
|
+
disposed = true;
|
|
122
|
+
restore.forEach((reset) => reset());
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function selectDatum(data, selector) {
|
|
126
|
+
const entries = Object.entries(selector);
|
|
127
|
+
const matches = data.filter(
|
|
128
|
+
(row) => entries.every(([key, value]) => row[key] === value)
|
|
129
|
+
);
|
|
130
|
+
if (matches.length !== 1)
|
|
131
|
+
throw new Error(
|
|
132
|
+
`Invalid annotation: selector matches ${matches.length} objects; expected one.`
|
|
133
|
+
);
|
|
134
|
+
return matches[0];
|
|
135
|
+
}
|
|
136
|
+
function createLayer(graph, groups, position, defaults, data) {
|
|
137
|
+
const canvas = graph.getCanvas();
|
|
138
|
+
const scene = canvas.document;
|
|
139
|
+
const root = scene.createElement("g", {
|
|
140
|
+
className: "annotations",
|
|
141
|
+
style: { pointerEvents: "none", zIndex: 1e3 }
|
|
142
|
+
});
|
|
143
|
+
canvas.appendChild(root);
|
|
144
|
+
let disposed = false;
|
|
145
|
+
let cleanupAnnotations;
|
|
146
|
+
let pulse;
|
|
147
|
+
const draw = () => {
|
|
148
|
+
var _a;
|
|
149
|
+
if (disposed)
|
|
150
|
+
return;
|
|
151
|
+
const [width, height] = canvas.getSize();
|
|
152
|
+
root.setLocalPosition(graph.getCanvasByViewport([0, 0]));
|
|
153
|
+
root.setLocalScale(1 / graph.getZoom());
|
|
154
|
+
cleanupAnnotations == null ? void 0 : cleanupAnnotations();
|
|
155
|
+
pulse == null ? void 0 : pulse.clear();
|
|
156
|
+
root.destroyChildren();
|
|
157
|
+
const boxes = [];
|
|
158
|
+
const segments = [];
|
|
159
|
+
const centers = [];
|
|
160
|
+
for (const node of data.nodes) {
|
|
161
|
+
if (graph.getElementVisibility(node.name) === "hidden")
|
|
162
|
+
continue;
|
|
163
|
+
const [x, y] = graph.getViewportByCanvas(graph.getElementPosition(node.name));
|
|
164
|
+
centers.push([x, y]);
|
|
165
|
+
const { min, max } = graph.getElementRenderBounds(node.name);
|
|
166
|
+
const a = graph.getViewportByCanvas(min);
|
|
167
|
+
const b = graph.getViewportByCanvas(max);
|
|
168
|
+
boxes.push({ x: a[0], y: a[1], width: b[0] - a[0], height: b[1] - a[1] });
|
|
169
|
+
}
|
|
170
|
+
for (const edge of data.edges) {
|
|
171
|
+
if ([edge.source, edge.target].some((id) => graph.getElementVisibility(id) === "hidden"))
|
|
172
|
+
continue;
|
|
173
|
+
const points = [edge.source, edge.target].map(
|
|
174
|
+
(id) => graph.getViewportByCanvas(graph.getElementPosition(id))
|
|
175
|
+
);
|
|
176
|
+
segments.push([
|
|
177
|
+
[points[0][0], points[0][1]],
|
|
178
|
+
[points[1][0], points[1][1]]
|
|
179
|
+
]);
|
|
180
|
+
}
|
|
181
|
+
const cards = [];
|
|
182
|
+
const add = (tag, style, className = "annotation-mark") => {
|
|
183
|
+
const shape = scene.createElement(tag, {
|
|
184
|
+
className,
|
|
185
|
+
style: { ...style, pointerEvents: "none" }
|
|
186
|
+
});
|
|
187
|
+
root.appendChild(shape);
|
|
188
|
+
};
|
|
189
|
+
const label = (annotation, [x, y], options = {}) => {
|
|
190
|
+
var _a2, _b;
|
|
191
|
+
if (!annotation.label)
|
|
192
|
+
return;
|
|
193
|
+
const standalone = options.standalone ?? false;
|
|
194
|
+
const style = defaults.labels[annotation.type];
|
|
195
|
+
const fontSize = ((_a2 = annotation.style) == null ? void 0 : _a2.labelFontSize) ?? defaults.labelFontSize;
|
|
196
|
+
const [, px] = style.padding;
|
|
197
|
+
const card = new import_g6.Label({
|
|
198
|
+
className: `annotation-label annotation-${annotation.type}`,
|
|
199
|
+
style: {
|
|
200
|
+
text: annotation.label,
|
|
201
|
+
fill: ((_b = annotation.style) == null ? void 0 : _b.labelFill) ?? options.fill ?? style.fill,
|
|
202
|
+
fontFamily: defaults.fontFamily,
|
|
203
|
+
fontSize,
|
|
204
|
+
fontWeight: style.fontWeight,
|
|
205
|
+
lineHeight: Math.ceil(fontSize * 1.5),
|
|
206
|
+
textAlign: standalone ? "center" : "left",
|
|
207
|
+
wordWrapWidth: Math.max(fontSize, Math.min(style.maxWidth, width) - px * 2),
|
|
208
|
+
maxLines: Infinity,
|
|
209
|
+
textOverflow: "clip",
|
|
210
|
+
padding: style.padding,
|
|
211
|
+
background: !standalone,
|
|
212
|
+
backgroundFill: style.background,
|
|
213
|
+
backgroundFillOpacity: style.backgroundOpacity,
|
|
214
|
+
backgroundOpacity: 1,
|
|
215
|
+
backgroundStroke: style.border,
|
|
216
|
+
backgroundStrokeOpacity: style.borderOpacity,
|
|
217
|
+
backgroundLineWidth: 1,
|
|
218
|
+
backgroundRadius: style.radius,
|
|
219
|
+
pointerEvents: "none",
|
|
220
|
+
zIndex: 2
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
root.appendChild(card);
|
|
224
|
+
const bounds = card.getGeometryBounds();
|
|
225
|
+
const [labelWidth, labelHeight] = bounds.halfExtents.map((size) => size * 2);
|
|
226
|
+
if (standalone) {
|
|
227
|
+
card.setLocalPosition([x - bounds.center[0], y - bounds.center[1]]);
|
|
228
|
+
boxes.push({
|
|
229
|
+
x: x - labelWidth / 2,
|
|
230
|
+
y: y - labelHeight / 2,
|
|
231
|
+
width: labelWidth,
|
|
232
|
+
height: labelHeight
|
|
233
|
+
});
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
cards.push({
|
|
237
|
+
card,
|
|
238
|
+
annotation,
|
|
239
|
+
anchor: [x, y],
|
|
240
|
+
extraGap: options.gap ?? 0,
|
|
241
|
+
min: [bounds.min[0], bounds.min[1]],
|
|
242
|
+
bounds: { x: 0, y: 0, width: labelWidth, height: labelHeight }
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
const context = {
|
|
246
|
+
chartType: "network-graph",
|
|
247
|
+
data: [...data.nodes, ...data.edges],
|
|
248
|
+
scene,
|
|
249
|
+
root,
|
|
250
|
+
defaults,
|
|
251
|
+
size: [width, height],
|
|
252
|
+
centers,
|
|
253
|
+
boxes,
|
|
254
|
+
segments,
|
|
255
|
+
position,
|
|
256
|
+
add,
|
|
257
|
+
label,
|
|
258
|
+
pulse: () => pulse ?? (pulse = (0, import_utils.createPointPulse)(scene, defaults.pulse, draw))
|
|
259
|
+
};
|
|
260
|
+
const result = (0, import_registry.drawAnnotations)(groups, context);
|
|
261
|
+
cleanupAnnotations = result.cleanup;
|
|
262
|
+
for (const item of cards) {
|
|
263
|
+
const { annotation, anchor, card, min } = item;
|
|
264
|
+
const gap = defaults.labels[annotation.type].gap + item.extraGap;
|
|
265
|
+
item.bounds = (0, import_layout.placeLabel)(
|
|
266
|
+
anchor,
|
|
267
|
+
[item.bounds.width, item.bounds.height],
|
|
268
|
+
[width, height],
|
|
269
|
+
gap,
|
|
270
|
+
boxes,
|
|
271
|
+
segments
|
|
272
|
+
);
|
|
273
|
+
boxes.push(item.bounds);
|
|
274
|
+
card.setLocalPosition([item.bounds.x - min[0], item.bounds.y - min[1]]);
|
|
275
|
+
}
|
|
276
|
+
for (const { annotation, anchor, bounds } of cards) {
|
|
277
|
+
const route = (0, import_layout.routeLeader)(anchor, bounds, boxes, segments);
|
|
278
|
+
if (!route.length)
|
|
279
|
+
continue;
|
|
280
|
+
add(
|
|
281
|
+
"path",
|
|
282
|
+
{
|
|
283
|
+
d: route.map(([x, y], index) => [index ? "L" : "M", x, y]),
|
|
284
|
+
stroke: annotation.type === "text" ? defaults.stroke : ((_a = annotation.style) == null ? void 0 : _a.stroke) ?? defaults.stroke,
|
|
285
|
+
lineWidth: 1,
|
|
286
|
+
strokeOpacity: 0.5,
|
|
287
|
+
zIndex: 1
|
|
288
|
+
},
|
|
289
|
+
"annotation-leader"
|
|
290
|
+
);
|
|
291
|
+
route.slice(1).forEach((point, index) => segments.push([route[index], point]));
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
document.fonts.ready.then(draw);
|
|
295
|
+
document.fonts.addEventListener("loadingdone", draw);
|
|
296
|
+
return {
|
|
297
|
+
draw,
|
|
298
|
+
destroy() {
|
|
299
|
+
disposed = true;
|
|
300
|
+
document.fonts.removeEventListener("loadingdone", draw);
|
|
301
|
+
cleanupAnnotations == null ? void 0 : cleanupAnnotations();
|
|
302
|
+
pulse == null ? void 0 : pulse.destroy();
|
|
303
|
+
root.destroy();
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
308
|
+
0 && (module.exports = {
|
|
309
|
+
bindAnnotations
|
|
310
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type G2AnnotationOptions } from './g2';
|
|
2
|
+
import { type G6AnnotationOptions } from './g6';
|
|
3
|
+
import { type SummaryAnnotationOptions } from './summary';
|
|
4
|
+
import { type TableAnnotationOptions } from './table';
|
|
5
|
+
export type { G2AnnotationContext, MarkElement, MarkOptions, Scene } from './g2';
|
|
6
|
+
export type { G6AnnotationContext } from './g6';
|
|
7
|
+
export type { SummaryContext } from './summary';
|
|
8
|
+
export type { TableContext } from './table';
|
|
9
|
+
export type AnnotationBindingOptions<T extends object> = G2AnnotationOptions<T> | G6AnnotationOptions | TableAnnotationOptions<T> | SummaryAnnotationOptions;
|
|
10
|
+
/** Each runtime checks the explicit renderer and returns its cleanup when applicable. */
|
|
11
|
+
export declare function bindAnnotations<T extends object>(options: AnnotationBindingOptions<T>): () => void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/annotation/runtime/index.ts
|
|
20
|
+
var runtime_exports = {};
|
|
21
|
+
__export(runtime_exports, {
|
|
22
|
+
bindAnnotations: () => bindAnnotations
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(runtime_exports);
|
|
25
|
+
var import_g2 = require("./g2");
|
|
26
|
+
var import_g6 = require("./g6");
|
|
27
|
+
var import_summary = require("./summary");
|
|
28
|
+
var import_table = require("./table");
|
|
29
|
+
var binders = [import_g2.bindAnnotations, import_g6.bindAnnotations, import_table.bindAnnotations, import_summary.bindAnnotations];
|
|
30
|
+
function bindAnnotations(options) {
|
|
31
|
+
for (const bind of binders) {
|
|
32
|
+
const cleanup = bind(options);
|
|
33
|
+
if (cleanup)
|
|
34
|
+
return cleanup;
|
|
35
|
+
}
|
|
36
|
+
throw new Error("Unsupported annotation runtime.");
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
bindAnnotations
|
|
41
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { getAnnotationDefaults } from '../../theme/annotation';
|
|
2
|
+
import type { RendererAnnotation } from '../registry';
|
|
3
|
+
import type { AnnotationBindingOptions } from './index';
|
|
4
|
+
export interface SummaryContext {
|
|
5
|
+
chartType: 'summary';
|
|
6
|
+
container: HTMLElement;
|
|
7
|
+
content: HTMLElement;
|
|
8
|
+
defaults: ReturnType<typeof getAnnotationDefaults>;
|
|
9
|
+
}
|
|
10
|
+
export interface SummaryAnnotationOptions extends Omit<SummaryContext, 'chartType'> {
|
|
11
|
+
renderer: 'summary';
|
|
12
|
+
annotations?: RendererAnnotation<{
|
|
13
|
+
text: string;
|
|
14
|
+
}, 'summary'>[];
|
|
15
|
+
}
|
|
16
|
+
/** Bind summary annotations and return the resources to clean up on the next render. */
|
|
17
|
+
export declare function bindAnnotations<T extends object>(options: AnnotationBindingOptions<T>): (() => void) | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/annotation/runtime/summary.ts
|
|
20
|
+
var summary_exports = {};
|
|
21
|
+
__export(summary_exports, {
|
|
22
|
+
bindAnnotations: () => bindAnnotations
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(summary_exports);
|
|
25
|
+
var import_registry = require("../registry");
|
|
26
|
+
function bindAnnotations(options) {
|
|
27
|
+
if (options.renderer !== "summary")
|
|
28
|
+
return;
|
|
29
|
+
const { annotations, ...context } = options;
|
|
30
|
+
if (!(annotations == null ? void 0 : annotations.length))
|
|
31
|
+
return () => {
|
|
32
|
+
};
|
|
33
|
+
return (0, import_registry.renderAnnotations)("summary", annotations, { ...context, chartType: "summary" }).cleanup ?? (() => {
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
bindAnnotations
|
|
39
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { getAnnotationDefaults } from '../../theme/annotation';
|
|
2
|
+
import type { RendererAnnotation } from '../registry';
|
|
3
|
+
import type { AnnotationBindingOptions } from './index';
|
|
4
|
+
export interface TableContext<T extends object> {
|
|
5
|
+
chartType: 'table';
|
|
6
|
+
container: HTMLElement;
|
|
7
|
+
content: HTMLElement;
|
|
8
|
+
data: T[];
|
|
9
|
+
defaults: ReturnType<typeof getAnnotationDefaults>;
|
|
10
|
+
}
|
|
11
|
+
export interface TableAnnotationOptions<T extends object> extends Omit<TableContext<T>, 'chartType'> {
|
|
12
|
+
renderer: 'table';
|
|
13
|
+
annotations?: RendererAnnotation<T, 'table'>[];
|
|
14
|
+
}
|
|
15
|
+
/** Bind table annotations and return the resources to clean up on the next render. */
|
|
16
|
+
export declare function bindAnnotations<T extends object>(options: AnnotationBindingOptions<T>): (() => void) | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/annotation/runtime/table.ts
|
|
20
|
+
var table_exports = {};
|
|
21
|
+
__export(table_exports, {
|
|
22
|
+
bindAnnotations: () => bindAnnotations
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(table_exports);
|
|
25
|
+
var import_registry = require("../registry");
|
|
26
|
+
function bindAnnotations(options) {
|
|
27
|
+
if (options.renderer !== "table")
|
|
28
|
+
return;
|
|
29
|
+
const { annotations, ...context } = options;
|
|
30
|
+
if (!(annotations == null ? void 0 : annotations.length))
|
|
31
|
+
return () => {
|
|
32
|
+
};
|
|
33
|
+
return (0, import_registry.renderAnnotations)("table", annotations, { ...context, chartType: "table" }).cleanup ?? (() => {
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
bindAnnotations
|
|
39
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ShapeComponent } from '@antv/g2';
|
|
2
|
+
import type { getAnnotationDefaults } from '../theme/annotation';
|
|
3
|
+
import type { Annotation, AnnotationData } from '../types/annotation';
|
|
4
|
+
import type { Point } from './layout';
|
|
5
|
+
import type { G2AnnotationContext } from './runtime/g2';
|
|
6
|
+
/** Resolve original-field selectors without reordering or modifying business data. */
|
|
7
|
+
export declare function selectRows<T extends object>(data: T[], selectors?: AnnotationData<T> | AnnotationData<T>[]): T[];
|
|
8
|
+
/** Missing and nonfinite values do not participate. Numeric strings are never coerced. */
|
|
9
|
+
export declare function numericRows<T extends object>(data: T[], field: keyof T & string, temporal?: boolean): {
|
|
10
|
+
row: T;
|
|
11
|
+
value: number | (T[keyof T & string] & number);
|
|
12
|
+
}[];
|
|
13
|
+
export declare function selectExtreme<T extends object>(data: T[], field: keyof T & string, maximum: boolean, temporal?: boolean): T[];
|
|
14
|
+
export declare function selectRank<T extends object>(data: T[], field: keyof T & string, n: number, descending: boolean): T[];
|
|
15
|
+
export declare function selectRange<T extends object>(data: T[], field: keyof T & string, range: [number, number], outside: boolean): T[];
|
|
16
|
+
export declare function selectedRows<T extends object>(data: T[], selectors: AnnotationData<T> | AnnotationData<T>[]): T[];
|
|
17
|
+
/** Compare neighbours within each series in business order. Missing values break sequences. */
|
|
18
|
+
export declare function selectLocalExtrema<T extends object>(data: T[], field: keyof T & string, maximum: boolean, series?: keyof T & string, { minProminence, minDistance }?: {
|
|
19
|
+
minProminence?: number;
|
|
20
|
+
minDistance?: number;
|
|
21
|
+
}): T[];
|
|
22
|
+
/** All renderers share the same dimming rule and reject invalid opacity before painting. */
|
|
23
|
+
export declare function getDimOpacity(annotations: Pick<Extract<Annotation, {
|
|
24
|
+
type: 'highlight';
|
|
25
|
+
}>, 'style'>[], fallback: number): number;
|
|
26
|
+
/** R-7 quantile of an ascending array; callers decide how to handle empty observations. */
|
|
27
|
+
export declare function quantileValue(values: number[], p: number): number;
|
|
28
|
+
export declare function finiteValue(value: unknown, name: string): number;
|
|
29
|
+
export declare function annotationField<T extends object>(mapping: G2AnnotationContext<T>['mapping'], axis?: 'x' | 'y'): keyof T & string;
|
|
30
|
+
/** Construct mapped coordinates; field names stay business-facing throughout composition. */
|
|
31
|
+
export declare function axisPosition<T extends object>(field: keyof T & string, value: unknown): Partial<T>;
|
|
32
|
+
/** Map a single-axis interval without imposing a business meaning on its bounds. */
|
|
33
|
+
export declare function axisRange<T extends object>(field: keyof T & string, bounds: unknown): { [K in keyof T]?: [T[K], T[K]] | undefined; };
|
|
34
|
+
export declare function formatNumber(value: number): string;
|
|
35
|
+
/** G2 and G6 share the native AntV scene and animation API. */
|
|
36
|
+
export declare function createPointPulse(scene: NonNullable<Parameters<ShapeComponent>[1]>['document'], defaults: ReturnType<typeof getAnnotationDefaults>['pulse'], redraw: () => void): {
|
|
37
|
+
add(parent: Pick<import("@antv/component/lib/shapes").DisplayObject<any, any>, "appendChild">, [x, y]: Point, size: number, color: string, animated?: boolean): void;
|
|
38
|
+
clear: () => void;
|
|
39
|
+
destroy(): void;
|
|
40
|
+
};
|