cx 24.8.1 → 24.8.3
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/dist/charts.js +15 -10
- package/dist/manifest.js +798 -798
- package/dist/widgets.js +2 -1
- package/package.json +1 -1
- package/src/charts/axis/Axis.d.ts +3 -0
- package/src/charts/helpers/PointReducer.js +43 -47
- package/src/charts/helpers/SnapPointFinder.js +69 -61
- package/src/widgets/overlay/Tooltip.js +295 -294
package/dist/widgets.js
CHANGED
|
@@ -4326,7 +4326,8 @@ function tooltipParentWillUnmount(parentInstance) {
|
|
|
4326
4326
|
}
|
|
4327
4327
|
function tooltipParentDidUpdate(element, parentInstance, tooltip) {
|
|
4328
4328
|
var instance = getTooltipInstance(element, parentInstance, tooltip);
|
|
4329
|
-
if (instance.
|
|
4329
|
+
if (instance && instance.visible && instance.data.alwaysVisible && instance.tooltipComponent)
|
|
4330
|
+
instance.widget.updateDropdownPosition(instance, instance.tooltipComponent);
|
|
4330
4331
|
}
|
|
4331
4332
|
function enableTooltips() {
|
|
4332
4333
|
wireTooltipOps({
|
package/package.json
CHANGED
|
@@ -95,6 +95,9 @@ export interface AxisProps extends BoundedObjectProps {
|
|
|
95
95
|
value: any,
|
|
96
96
|
{ tickIndex, serieIndex }: { tickIndex: number; serieIndex: number },
|
|
97
97
|
) => { text: string; style?: any; className?: string }[]);
|
|
98
|
+
|
|
99
|
+
/** Distance between the even labels and the axis. */
|
|
100
|
+
alternateLabelOffset?: number | string;
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
export class Axis extends BoundedObject {}
|
|
@@ -1,47 +1,43 @@
|
|
|
1
|
-
import { PureContainer } from "../../ui/PureContainer";
|
|
2
|
-
|
|
3
|
-
export class PointReducer extends PureContainer {
|
|
4
|
-
explore(context, instance) {
|
|
5
|
-
let parentPointReducer = context.pointReducer;
|
|
6
|
-
instance.parentPointTracker = parentPointReducer;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
accumulator
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
context.
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
context.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
context.pop("pointReducer");
|
|
45
|
-
instance.write();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
import { PureContainer } from "../../ui/PureContainer";
|
|
2
|
+
|
|
3
|
+
export class PointReducer extends PureContainer {
|
|
4
|
+
explore(context, instance) {
|
|
5
|
+
let parentPointReducer = context.pointReducer;
|
|
6
|
+
instance.parentPointTracker = parentPointReducer;
|
|
7
|
+
|
|
8
|
+
if (!instance.pointReducer) {
|
|
9
|
+
let onMap = this.onMap && instance.getCallback("onMap");
|
|
10
|
+
let accumulator = {};
|
|
11
|
+
instance.resetAccumulator = () => {
|
|
12
|
+
accumulator = {};
|
|
13
|
+
if (this.onInitAccumulator) instance.invoke("onInitAccumulator", accumulator, instance);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
instance.pointReducer = (x, y, name, data, array, index) => {
|
|
17
|
+
onMap(accumulator, x, y, name, data, array, index);
|
|
18
|
+
if (parentPointReducer) parentPointReducer(x, y, name, data, array, index);
|
|
19
|
+
};
|
|
20
|
+
instance.write = () => {
|
|
21
|
+
if (this.onReduce) instance.invoke("onReduce", accumulator, instance);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
instance.resetAccumulator();
|
|
26
|
+
context.push("pointReducer", instance.pointReducer);
|
|
27
|
+
|
|
28
|
+
super.explore(context, instance);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exploreCleanup(context, instance) {
|
|
32
|
+
context.pop("pointReducer");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
prepare(context, instance) {
|
|
36
|
+
context.push("pointReducer", instance.pointReducer);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
prepareCleanup(context, instance) {
|
|
40
|
+
context.pop("pointReducer");
|
|
41
|
+
instance.write();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,61 +1,69 @@
|
|
|
1
|
-
import { PointReducer } from "./PointReducer";
|
|
2
|
-
|
|
3
|
-
export class SnapPointFinder extends PointReducer {
|
|
4
|
-
declareData() {
|
|
5
|
-
return super.declareData(...arguments, {
|
|
6
|
-
cursorX: undefined,
|
|
7
|
-
cursorY: undefined,
|
|
8
|
-
snapX: undefined,
|
|
9
|
-
snapY: undefined,
|
|
10
|
-
snapRecord: undefined,
|
|
11
|
-
maxDistance: undefined,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
explore(context, instance) {
|
|
16
|
-
instance.xAxis = context.axes[this.xAxis];
|
|
17
|
-
instance.yAxis = context.axes[this.yAxis];
|
|
18
|
-
super.explore(context, instance);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
onInitAccumulator(acc, { data, xAxis, yAxis }) {
|
|
22
|
-
acc.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
acc.
|
|
28
|
-
acc.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
1
|
+
import { PointReducer } from "./PointReducer";
|
|
2
|
+
|
|
3
|
+
export class SnapPointFinder extends PointReducer {
|
|
4
|
+
declareData() {
|
|
5
|
+
return super.declareData(...arguments, {
|
|
6
|
+
cursorX: undefined,
|
|
7
|
+
cursorY: undefined,
|
|
8
|
+
snapX: undefined,
|
|
9
|
+
snapY: undefined,
|
|
10
|
+
snapRecord: undefined,
|
|
11
|
+
maxDistance: undefined,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
explore(context, instance) {
|
|
16
|
+
instance.xAxis = context.axes[this.xAxis];
|
|
17
|
+
instance.yAxis = context.axes[this.yAxis];
|
|
18
|
+
super.explore(context, instance);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
onInitAccumulator(acc, { data, xAxis, yAxis }) {
|
|
22
|
+
acc.cursor = {
|
|
23
|
+
x: data.cursorX,
|
|
24
|
+
y: data.cursorY,
|
|
25
|
+
mapped: false,
|
|
26
|
+
};
|
|
27
|
+
acc.dist = data.maxDistance > 0 ? Math.pow(data.maxDistance, 2) : Number.POSITIVE_INFINITY;
|
|
28
|
+
acc.snapX = null;
|
|
29
|
+
acc.snapY = null;
|
|
30
|
+
acc.xAxis = xAxis;
|
|
31
|
+
acc.yAxis = yAxis;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
onMap(acc, x, y, name, p) {
|
|
35
|
+
let { xAxis, yAxis, cursor } = acc;
|
|
36
|
+
|
|
37
|
+
if (!cursor.mapped) {
|
|
38
|
+
cursor.mappedX = cursor.x != null ? xAxis?.map(this.convertX(cursor.x)) : null;
|
|
39
|
+
cursor.mappedY = cursor.y != null ? yAxis?.map(this.convertY(cursor.y)) : null;
|
|
40
|
+
cursor.mapped = true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let d = null;
|
|
44
|
+
let cx = x != null ? xAxis?.map(this.convertX(x)) : null;
|
|
45
|
+
let cy = y != null ? yAxis?.map(this.convertY(y)) : null;
|
|
46
|
+
|
|
47
|
+
if (cursor.mappedX != null && cx != null) d = (d || 0) + Math.pow(Math.abs(cx - cursor.mappedX), 2);
|
|
48
|
+
if (cursor.mappedY != null && cy != null) d = (d || 0) + Math.pow(Math.abs(cy - cursor.mappedY), 2);
|
|
49
|
+
|
|
50
|
+
if (d != null && d < acc.dist) {
|
|
51
|
+
acc.dist = d;
|
|
52
|
+
acc.snapX = x;
|
|
53
|
+
acc.snapY = y;
|
|
54
|
+
acc.snapRecord = p;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
onReduce(acc, instance) {
|
|
59
|
+
instance.set("snapX", acc.snapX);
|
|
60
|
+
instance.set("snapY", acc.snapY);
|
|
61
|
+
instance.set("snapRecord", acc.snapRecord);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
SnapPointFinder.prototype.maxDistance = 50;
|
|
66
|
+
SnapPointFinder.prototype.convertX = (x) => x;
|
|
67
|
+
SnapPointFinder.prototype.convertY = (y) => y;
|
|
68
|
+
SnapPointFinder.prototype.xAxis = "x";
|
|
69
|
+
SnapPointFinder.prototype.yAxis = "y";
|