@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,65 @@
|
|
|
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/components/range-inside.ts
|
|
20
|
+
var range_inside_exports = {};
|
|
21
|
+
__export(range_inside_exports, {
|
|
22
|
+
rangeInside: () => rangeInside
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(range_inside_exports);
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
var import_highlight = require("./highlight");
|
|
27
|
+
var import_range = require("./range");
|
|
28
|
+
var rangeInside = {
|
|
29
|
+
g2: (annotations, { mapping }) => annotations.flatMap((annotation) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
const rows = (0, import_utils.selectRows)(mapping.data, annotation.data);
|
|
32
|
+
const field = mapping.y;
|
|
33
|
+
const selected = (0, import_utils.selectRange)(rows, field, annotation.range, false);
|
|
34
|
+
return [
|
|
35
|
+
...import_range.range.create({
|
|
36
|
+
data: { [field]: annotation.range },
|
|
37
|
+
style: {
|
|
38
|
+
fill: ((_a = annotation.style) == null ? void 0 : _a.fill) ?? ((_b = annotation.style) == null ? void 0 : _b.stroke)
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
...selected.flatMap(
|
|
42
|
+
(row) => import_highlight.highlight.create({
|
|
43
|
+
data: [row],
|
|
44
|
+
label: annotation.label ?? `Inside range: ${row[field]}`,
|
|
45
|
+
style: annotation.style
|
|
46
|
+
})
|
|
47
|
+
)
|
|
48
|
+
];
|
|
49
|
+
}),
|
|
50
|
+
table: (annotations, { data }) => annotations.flatMap((annotation) => {
|
|
51
|
+
const rows = (0, import_utils.selectRows)(data, annotation.data.row);
|
|
52
|
+
const field = annotation.data.field;
|
|
53
|
+
return (0, import_utils.selectRange)(rows, field, annotation.range, false).flatMap(
|
|
54
|
+
(row) => import_highlight.highlight.create({
|
|
55
|
+
data: [{ row, column: annotation.data.column }],
|
|
56
|
+
label: annotation.label ?? `Inside range: ${row[field]}`,
|
|
57
|
+
style: annotation.style
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
rangeInside
|
|
65
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
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/components/range-outside.ts
|
|
20
|
+
var range_outside_exports = {};
|
|
21
|
+
__export(range_outside_exports, {
|
|
22
|
+
rangeOutside: () => rangeOutside
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(range_outside_exports);
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
var import_highlight = require("./highlight");
|
|
27
|
+
var import_range = require("./range");
|
|
28
|
+
var rangeOutside = {
|
|
29
|
+
g2: (annotations, { mapping }) => annotations.flatMap((annotation) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
const rows = (0, import_utils.selectRows)(mapping.data, annotation.data);
|
|
32
|
+
const field = mapping.y;
|
|
33
|
+
const selected = (0, import_utils.selectRange)(rows, field, annotation.range, true);
|
|
34
|
+
return [
|
|
35
|
+
...import_range.range.create({
|
|
36
|
+
data: { [field]: annotation.range },
|
|
37
|
+
style: {
|
|
38
|
+
fill: ((_a = annotation.style) == null ? void 0 : _a.fill) ?? ((_b = annotation.style) == null ? void 0 : _b.stroke)
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
...selected.flatMap(
|
|
42
|
+
(row) => import_highlight.highlight.create({
|
|
43
|
+
data: [row],
|
|
44
|
+
label: annotation.label ?? `Outside range: ${row[field]}`,
|
|
45
|
+
style: annotation.style
|
|
46
|
+
})
|
|
47
|
+
)
|
|
48
|
+
];
|
|
49
|
+
}),
|
|
50
|
+
table: (annotations, { data }) => annotations.flatMap((annotation) => {
|
|
51
|
+
const rows = (0, import_utils.selectRows)(data, annotation.data.row);
|
|
52
|
+
const field = annotation.data.field;
|
|
53
|
+
return (0, import_utils.selectRange)(rows, field, annotation.range, true).flatMap(
|
|
54
|
+
(row) => import_highlight.highlight.create({
|
|
55
|
+
data: [{ row, column: annotation.data.column }],
|
|
56
|
+
label: annotation.label ?? `Outside range: ${row[field]}`,
|
|
57
|
+
style: annotation.style
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
rangeOutside
|
|
65
|
+
});
|
|
@@ -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/components/range-x.ts
|
|
20
|
+
var range_x_exports = {};
|
|
21
|
+
__export(range_x_exports, {
|
|
22
|
+
rangeX: () => rangeX
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(range_x_exports);
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
var import_range = require("./range");
|
|
27
|
+
var rangeX = {
|
|
28
|
+
g2: (annotations, { mapping }) => annotations.flatMap(
|
|
29
|
+
(annotation) => import_range.range.create({
|
|
30
|
+
data: (0, import_utils.axisRange)(mapping.x, annotation.range),
|
|
31
|
+
label: annotation.label ?? `X range: ${annotation.range.join("–")}`,
|
|
32
|
+
style: annotation.style
|
|
33
|
+
})
|
|
34
|
+
)
|
|
35
|
+
};
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
rangeX
|
|
39
|
+
});
|
|
@@ -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/components/range-y.ts
|
|
20
|
+
var range_y_exports = {};
|
|
21
|
+
__export(range_y_exports, {
|
|
22
|
+
rangeY: () => rangeY
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(range_y_exports);
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
var import_range = require("./range");
|
|
27
|
+
var rangeY = {
|
|
28
|
+
g2: (annotations, { mapping }) => annotations.flatMap(
|
|
29
|
+
(annotation) => import_range.range.create({
|
|
30
|
+
data: (0, import_utils.axisRange)(mapping.y, annotation.range),
|
|
31
|
+
label: annotation.label ?? `Y range: ${annotation.range.join("–")}`,
|
|
32
|
+
style: annotation.style
|
|
33
|
+
})
|
|
34
|
+
)
|
|
35
|
+
};
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
rangeY
|
|
39
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Annotation } from '../../types/annotation';
|
|
2
|
+
import type { Point } from '../layout';
|
|
3
|
+
import type { AnnotationComponent } from '../registry';
|
|
4
|
+
import type { G2AnnotationContext } from '../runtime';
|
|
5
|
+
/** Axis bounds, including the full band at either end; omitted axes span the plot. */
|
|
6
|
+
export declare const range: AnnotationComponent<'range', 'g2'> & {
|
|
7
|
+
create: typeof createRange;
|
|
8
|
+
};
|
|
9
|
+
type Bounds = (context: Pick<G2AnnotationContext<object>, 'axisValue'>) => [Point, Point];
|
|
10
|
+
declare function createRange<T extends object>(options: Omit<Extract<Annotation<T>, {
|
|
11
|
+
type: 'range';
|
|
12
|
+
}>, 'type'>, bounds?: Bounds): Extract<Annotation<T>, {
|
|
13
|
+
type: 'range';
|
|
14
|
+
}>[];
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
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/components/range.ts
|
|
20
|
+
var range_exports = {};
|
|
21
|
+
__export(range_exports, {
|
|
22
|
+
range: () => range
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(range_exports);
|
|
25
|
+
var range = {
|
|
26
|
+
create: createRange,
|
|
27
|
+
g2: () => drawG2
|
|
28
|
+
};
|
|
29
|
+
var positions = /* @__PURE__ */ new WeakMap();
|
|
30
|
+
function createRange(options, bounds) {
|
|
31
|
+
const annotation = { ...options, type: "range" };
|
|
32
|
+
if (bounds)
|
|
33
|
+
positions.set(annotation, bounds);
|
|
34
|
+
return [annotation];
|
|
35
|
+
}
|
|
36
|
+
var drawG2 = (annotations, context) => {
|
|
37
|
+
const { mapping, defaults } = context;
|
|
38
|
+
return {
|
|
39
|
+
marks: annotations.map((annotation) => {
|
|
40
|
+
var _a, _b, _c, _d, _e, _f;
|
|
41
|
+
const x = annotation.data[mapping.x];
|
|
42
|
+
const y = annotation.data[mapping.y];
|
|
43
|
+
return context.createMark(annotation, {
|
|
44
|
+
nativeType: x && y ? "range" : x !== void 0 ? "rangeX" : "rangeY",
|
|
45
|
+
zIndex: -1,
|
|
46
|
+
clip: true,
|
|
47
|
+
decorate: (element) => element.setAttribute("annotationIgnoreObstacle", true),
|
|
48
|
+
style: {
|
|
49
|
+
stroke: ((_a = annotation.style) == null ? void 0 : _a.stroke) ?? "none",
|
|
50
|
+
lineWidth: ((_b = annotation.style) == null ? void 0 : _b.lineWidth) ?? defaults.lineWidth.range,
|
|
51
|
+
lineDash: (_c = annotation.style) == null ? void 0 : _c.lineDash,
|
|
52
|
+
fill: ((_d = annotation.style) == null ? void 0 : _d.fill) ?? ((_e = annotation.style) == null ? void 0 : _e.stroke) ?? defaults.stroke,
|
|
53
|
+
fillOpacity: ((_f = annotation.style) == null ? void 0 : _f.fillOpacity) ?? defaults.fillOpacity
|
|
54
|
+
},
|
|
55
|
+
geometry: (native) => (_index, scale, value, coordinate) => {
|
|
56
|
+
const position = positions.get(annotation);
|
|
57
|
+
if (position) {
|
|
58
|
+
const [from, to] = position(context);
|
|
59
|
+
return native(
|
|
60
|
+
[0],
|
|
61
|
+
scale,
|
|
62
|
+
{ ...value, x: [from[0]], x1: [to[0]], y: [from[1]], y1: [to[1]] },
|
|
63
|
+
coordinate
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
if (!context.onlyAxisFields(annotation.data))
|
|
67
|
+
throw new Error("Invalid annotation: range only accepts axis fields.");
|
|
68
|
+
const bounds = (values, axis) => {
|
|
69
|
+
if (!values)
|
|
70
|
+
return [0, 1];
|
|
71
|
+
const a = context.axisValue(axis, values[0], false);
|
|
72
|
+
const b = context.axisValue(axis, values[1], false);
|
|
73
|
+
const end = context.bandWidth(axis, values[a < b ? 1 : 0]);
|
|
74
|
+
return [Math.min(a, b), Math.max(a, b) + end];
|
|
75
|
+
};
|
|
76
|
+
const [x0, x1] = bounds(x, "x");
|
|
77
|
+
const [y0, y1] = bounds(y, "y");
|
|
78
|
+
return native([0], scale, { ...value, x: [x0], x1: [x1], y: [y0], y1: [y1] }, coordinate);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
})
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
range
|
|
87
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target2, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target2, 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/components/target.ts
|
|
20
|
+
var target_exports = {};
|
|
21
|
+
__export(target_exports, {
|
|
22
|
+
target: () => target
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(target_exports);
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
var import_path = require("./path");
|
|
27
|
+
var target = {
|
|
28
|
+
g2: (annotations, { mapping }) => annotations.flatMap((annotation) => {
|
|
29
|
+
const field = (0, import_utils.annotationField)(mapping, annotation.axis);
|
|
30
|
+
if (annotation.target !== void 0 && annotation.data !== void 0)
|
|
31
|
+
throw new Error("Invalid annotation: target needs either a fixed target or a path.");
|
|
32
|
+
if (annotation.target === void 0) {
|
|
33
|
+
if (!Array.isArray(annotation.data) || annotation.data.length < 2)
|
|
34
|
+
throw new Error("Invalid annotation: target path needs at least two positions.");
|
|
35
|
+
for (const position of annotation.data) {
|
|
36
|
+
(0, import_utils.axisPosition)(mapping.x, position[mapping.x]);
|
|
37
|
+
(0, import_utils.finiteValue)(position[mapping.y], mapping.y);
|
|
38
|
+
}
|
|
39
|
+
} else
|
|
40
|
+
(0, import_utils.finiteValue)(annotation.target, "target");
|
|
41
|
+
return import_path.path.create({
|
|
42
|
+
data: annotation.target === void 0 ? annotation.data : (0, import_utils.axisPosition)(field, annotation.target),
|
|
43
|
+
label: annotation.label ?? (annotation.target === void 0 ? "Target" : `Target: ${(0, import_utils.formatNumber)(annotation.target)}`),
|
|
44
|
+
style: { lineDash: [4, 4], ...annotation.style }
|
|
45
|
+
});
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
target
|
|
51
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Annotation } from '../../types/annotation';
|
|
2
|
+
import type { Point } from '../layout';
|
|
3
|
+
import type { AnnotationComponent } from '../registry';
|
|
4
|
+
import type { G2AnnotationContext } from '../runtime';
|
|
5
|
+
/** Standalone text stays at the supplied anchor and participates as a fixed layout obstacle. */
|
|
6
|
+
export declare const text: AnnotationComponent<'text', 'g2' | 'g6'> & {
|
|
7
|
+
create: typeof createText;
|
|
8
|
+
};
|
|
9
|
+
type Position = (context: Pick<G2AnnotationContext<object>, 'axisValue'>, coordinate: Parameters<G2AnnotationContext<object>['position']>[1]) => Point | undefined;
|
|
10
|
+
declare function createText<T extends object>(options: Omit<Extract<Annotation<T>, {
|
|
11
|
+
type: 'text';
|
|
12
|
+
}>, 'type'>, position?: Position): Extract<Annotation<T>, {
|
|
13
|
+
type: 'text';
|
|
14
|
+
}>[];
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
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/components/text.ts
|
|
20
|
+
var text_exports = {};
|
|
21
|
+
__export(text_exports, {
|
|
22
|
+
text: () => text
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(text_exports);
|
|
25
|
+
var text = {
|
|
26
|
+
create: createText,
|
|
27
|
+
g2: () => drawG2,
|
|
28
|
+
g6: () => drawG6
|
|
29
|
+
};
|
|
30
|
+
var positions = /* @__PURE__ */ new WeakMap();
|
|
31
|
+
function createText(options, position) {
|
|
32
|
+
const annotation = { ...options, type: "text" };
|
|
33
|
+
if (position)
|
|
34
|
+
positions.set(annotation, position);
|
|
35
|
+
return [annotation];
|
|
36
|
+
}
|
|
37
|
+
var drawG2 = (annotations, context) => {
|
|
38
|
+
return {
|
|
39
|
+
marks: annotations.map(
|
|
40
|
+
(annotation) => context.createMark(annotation, {
|
|
41
|
+
nativeType: "text",
|
|
42
|
+
zIndex: 1,
|
|
43
|
+
encode: { text: () => annotation.label },
|
|
44
|
+
label: false,
|
|
45
|
+
style: {
|
|
46
|
+
...context.getTextStyle(annotation),
|
|
47
|
+
textAlign: "center",
|
|
48
|
+
textBaseline: "middle",
|
|
49
|
+
stroke: "none",
|
|
50
|
+
lineWidth: 0
|
|
51
|
+
},
|
|
52
|
+
geometry: (native) => (_index, scale, value, coordinate) => {
|
|
53
|
+
const position = positions.get(annotation);
|
|
54
|
+
const point = position ? position(context, coordinate) : context.position(annotation.data, coordinate);
|
|
55
|
+
if (!point)
|
|
56
|
+
return [[], []];
|
|
57
|
+
return native([0], scale, { ...value, x: [point[0]], y: [point[1]] }, coordinate);
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
)
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
var drawG6 = (annotations, context) => {
|
|
64
|
+
for (const annotation of annotations) {
|
|
65
|
+
const point = context.position(annotation.data);
|
|
66
|
+
if (point)
|
|
67
|
+
context.label(annotation, point, { standalone: true });
|
|
68
|
+
}
|
|
69
|
+
return {};
|
|
70
|
+
};
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
text
|
|
74
|
+
});
|