cx 24.6.1 → 24.6.2
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 +12 -4
- package/dist/manifest.js +812 -812
- package/package.json +1 -1
- package/src/charts/ColumnGraph.js +112 -112
- package/src/charts/LineGraph.js +1 -1
- package/src/charts/helpers/SnapPointFinder.d.ts +30 -24
- package/src/charts/helpers/SnapPointFinder.js +49 -47
- package/src/charts/helpers/ValueAtFinder.d.ts +16 -17
- package/src/widgets/form/Calendar.js +527 -527
- package/src/widgets/form/Calendar.scss +164 -164
package/package.json
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
import { Widget, VDOM } from "../ui/Widget";
|
|
2
|
-
import { ColumnBarGraphBase } from "./ColumnBarGraphBase";
|
|
3
|
-
import { tooltipMouseMove, tooltipMouseLeave } from "../widgets/overlay/tooltip-ops";
|
|
4
|
-
import { isArray } from "../util/isArray";
|
|
5
|
-
|
|
6
|
-
export class ColumnGraph extends ColumnBarGraphBase {
|
|
7
|
-
explore(context, instance) {
|
|
8
|
-
super.explore(context, instance);
|
|
9
|
-
|
|
10
|
-
let { data, xAxis, yAxis } = instance;
|
|
11
|
-
|
|
12
|
-
if (isArray(data.data)) {
|
|
13
|
-
data.data.forEach((p, index) => {
|
|
14
|
-
var y0 = this.y0Field ? p[this.y0Field] : data.y0;
|
|
15
|
-
var x = p[this.xField];
|
|
16
|
-
var y = p[this.yField];
|
|
17
|
-
|
|
18
|
-
xAxis.acknowledge(x, data.size, data.offset);
|
|
19
|
-
|
|
20
|
-
if (data.autoSize) xAxis.book(x, data.stacked ? data.stack : data.name);
|
|
21
|
-
|
|
22
|
-
if (data.stacked) {
|
|
23
|
-
yAxis.stacknowledge(data.stack, x, y0);
|
|
24
|
-
yAxis.stacknowledge(data.stack, x, y);
|
|
25
|
-
} else {
|
|
26
|
-
if (!this.hiddenBase) yAxis.acknowledge(y0);
|
|
27
|
-
yAxis.acknowledge(y);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (context.pointReducer) context.pointReducer(x, y, data.name, p, data, index);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
renderGraph(context, instance) {
|
|
36
|
-
var { data, xAxis, yAxis, store } = instance;
|
|
37
|
-
if (!isArray(data.data)) return false;
|
|
38
|
-
|
|
39
|
-
var isSelected = this.selection.getIsSelectedDelegate(store);
|
|
40
|
-
|
|
41
|
-
return data.data.map((p, i) => {
|
|
42
|
-
var { offset, size } = data;
|
|
43
|
-
|
|
44
|
-
var y0 = this.y0Field ? p[this.y0Field] : data.y0;
|
|
45
|
-
var x = p[this.xField];
|
|
46
|
-
var y = p[this.yField];
|
|
47
|
-
|
|
48
|
-
if (data.autoSize) {
|
|
49
|
-
var [index, count] = instance.xAxis.locate(x, data.stacked ? data.stack : data.name);
|
|
50
|
-
offset = (size / count) * (index - count / 2 + 0.5);
|
|
51
|
-
size = size / count;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var x1 = xAxis.map(x, offset - size / 2);
|
|
55
|
-
var x2 = xAxis.map(x, offset + size / 2);
|
|
56
|
-
var y1 = data.stacked ? yAxis.stack(data.stack, x, y0) : yAxis.map(y0);
|
|
57
|
-
var y2 = data.stacked ? yAxis.stack(data.stack, x, y) : yAxis.map(y);
|
|
58
|
-
|
|
59
|
-
var color = this.colorIndexField ? p[this.colorIndexField] : data.colorIndex;
|
|
60
|
-
var state = {
|
|
61
|
-
selected: isSelected(p, i),
|
|
62
|
-
selectable: !this.selection.isDummy,
|
|
63
|
-
[`color-${color}`]: color != null,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
let mmove, mleave;
|
|
67
|
-
|
|
68
|
-
if (this.tooltip) {
|
|
69
|
-
mmove = (e) =>
|
|
70
|
-
tooltipMouseMove(e, instance, this.tooltip, {
|
|
71
|
-
target: e.target.parent,
|
|
72
|
-
data: {
|
|
73
|
-
$record: p,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
mleave = (e) =>
|
|
77
|
-
tooltipMouseLeave(e, instance, this.tooltip, {
|
|
78
|
-
target: e.target.parent,
|
|
79
|
-
data: {
|
|
80
|
-
$record: p,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<rect
|
|
87
|
-
key={i}
|
|
88
|
-
className={this.CSS.element(this.baseClass, "column", state)}
|
|
89
|
-
onClick={(e) => {
|
|
90
|
-
this.handleClick(e, instance, p, i);
|
|
91
|
-
}}
|
|
92
|
-
x={Math.min(x1, x2)}
|
|
93
|
-
y={Math.min(y1, y2)}
|
|
94
|
-
width={Math.abs(x2 - x1)}
|
|
95
|
-
height={Math.abs(y2 - y1)}
|
|
96
|
-
style={data.style}
|
|
97
|
-
onMouseMove={mmove}
|
|
98
|
-
onMouseLeave={mleave}
|
|
99
|
-
rx={data.borderRadius}
|
|
100
|
-
/>
|
|
101
|
-
);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
ColumnGraph.prototype.baseClass = "columngraph";
|
|
107
|
-
ColumnGraph.prototype.y0Field = false;
|
|
108
|
-
ColumnGraph.prototype.y0 = 0;
|
|
109
|
-
ColumnGraph.prototype.legendShape = "column";
|
|
110
|
-
ColumnGraph.prototype.hiddenBase = false;
|
|
111
|
-
|
|
112
|
-
Widget.alias("columngraph", ColumnGraph);
|
|
1
|
+
import { Widget, VDOM } from "../ui/Widget";
|
|
2
|
+
import { ColumnBarGraphBase } from "./ColumnBarGraphBase";
|
|
3
|
+
import { tooltipMouseMove, tooltipMouseLeave } from "../widgets/overlay/tooltip-ops";
|
|
4
|
+
import { isArray } from "../util/isArray";
|
|
5
|
+
|
|
6
|
+
export class ColumnGraph extends ColumnBarGraphBase {
|
|
7
|
+
explore(context, instance) {
|
|
8
|
+
super.explore(context, instance);
|
|
9
|
+
|
|
10
|
+
let { data, xAxis, yAxis } = instance;
|
|
11
|
+
|
|
12
|
+
if (isArray(data.data)) {
|
|
13
|
+
data.data.forEach((p, index) => {
|
|
14
|
+
var y0 = this.y0Field ? p[this.y0Field] : data.y0;
|
|
15
|
+
var x = p[this.xField];
|
|
16
|
+
var y = p[this.yField];
|
|
17
|
+
|
|
18
|
+
xAxis.acknowledge(x, data.size, data.offset);
|
|
19
|
+
|
|
20
|
+
if (data.autoSize) xAxis.book(x, data.stacked ? data.stack : data.name);
|
|
21
|
+
|
|
22
|
+
if (data.stacked) {
|
|
23
|
+
yAxis.stacknowledge(data.stack, x, y0);
|
|
24
|
+
yAxis.stacknowledge(data.stack, x, y);
|
|
25
|
+
} else {
|
|
26
|
+
if (!this.hiddenBase) yAxis.acknowledge(y0);
|
|
27
|
+
yAxis.acknowledge(y);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (context.pointReducer) context.pointReducer(x, y, data.name, p, data.data, index);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
renderGraph(context, instance) {
|
|
36
|
+
var { data, xAxis, yAxis, store } = instance;
|
|
37
|
+
if (!isArray(data.data)) return false;
|
|
38
|
+
|
|
39
|
+
var isSelected = this.selection.getIsSelectedDelegate(store);
|
|
40
|
+
|
|
41
|
+
return data.data.map((p, i) => {
|
|
42
|
+
var { offset, size } = data;
|
|
43
|
+
|
|
44
|
+
var y0 = this.y0Field ? p[this.y0Field] : data.y0;
|
|
45
|
+
var x = p[this.xField];
|
|
46
|
+
var y = p[this.yField];
|
|
47
|
+
|
|
48
|
+
if (data.autoSize) {
|
|
49
|
+
var [index, count] = instance.xAxis.locate(x, data.stacked ? data.stack : data.name);
|
|
50
|
+
offset = (size / count) * (index - count / 2 + 0.5);
|
|
51
|
+
size = size / count;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var x1 = xAxis.map(x, offset - size / 2);
|
|
55
|
+
var x2 = xAxis.map(x, offset + size / 2);
|
|
56
|
+
var y1 = data.stacked ? yAxis.stack(data.stack, x, y0) : yAxis.map(y0);
|
|
57
|
+
var y2 = data.stacked ? yAxis.stack(data.stack, x, y) : yAxis.map(y);
|
|
58
|
+
|
|
59
|
+
var color = this.colorIndexField ? p[this.colorIndexField] : data.colorIndex;
|
|
60
|
+
var state = {
|
|
61
|
+
selected: isSelected(p, i),
|
|
62
|
+
selectable: !this.selection.isDummy,
|
|
63
|
+
[`color-${color}`]: color != null,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
let mmove, mleave;
|
|
67
|
+
|
|
68
|
+
if (this.tooltip) {
|
|
69
|
+
mmove = (e) =>
|
|
70
|
+
tooltipMouseMove(e, instance, this.tooltip, {
|
|
71
|
+
target: e.target.parent,
|
|
72
|
+
data: {
|
|
73
|
+
$record: p,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
mleave = (e) =>
|
|
77
|
+
tooltipMouseLeave(e, instance, this.tooltip, {
|
|
78
|
+
target: e.target.parent,
|
|
79
|
+
data: {
|
|
80
|
+
$record: p,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<rect
|
|
87
|
+
key={i}
|
|
88
|
+
className={this.CSS.element(this.baseClass, "column", state)}
|
|
89
|
+
onClick={(e) => {
|
|
90
|
+
this.handleClick(e, instance, p, i);
|
|
91
|
+
}}
|
|
92
|
+
x={Math.min(x1, x2)}
|
|
93
|
+
y={Math.min(y1, y2)}
|
|
94
|
+
width={Math.abs(x2 - x1)}
|
|
95
|
+
height={Math.abs(y2 - y1)}
|
|
96
|
+
style={data.style}
|
|
97
|
+
onMouseMove={mmove}
|
|
98
|
+
onMouseLeave={mleave}
|
|
99
|
+
rx={data.borderRadius}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
ColumnGraph.prototype.baseClass = "columngraph";
|
|
107
|
+
ColumnGraph.prototype.y0Field = false;
|
|
108
|
+
ColumnGraph.prototype.y0 = 0;
|
|
109
|
+
ColumnGraph.prototype.legendShape = "column";
|
|
110
|
+
ColumnGraph.prototype.hiddenBase = false;
|
|
111
|
+
|
|
112
|
+
Widget.alias("columngraph", ColumnGraph);
|
package/src/charts/LineGraph.js
CHANGED
|
@@ -65,7 +65,7 @@ export class LineGraph extends Widget {
|
|
|
65
65
|
context.pointReducer(x, p[this.y0Field], data.name, p, data, index);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
if (context.pointReducer) context.pointReducer(x, p[this.yField], data.name, p, data, index);
|
|
68
|
+
if (context.pointReducer) context.pointReducer(x, p[this.yField], data.name, p, data.data, index);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
import * as Cx from "../../core";
|
|
2
|
-
import { PointReducerProps } from "./PointReducer";
|
|
3
|
-
|
|
4
|
-
interface SnapPointFinderProps extends PointReducerProps {
|
|
5
|
-
/* Cursor X value. */
|
|
6
|
-
cursorX?: Cx.NumberProp;
|
|
7
|
-
|
|
8
|
-
/* Cursor Y value */
|
|
9
|
-
cursorY?: Cx.NumberProp;
|
|
10
|
-
|
|
11
|
-
/* A binding used to receive the x value of the nearest point.*/
|
|
12
|
-
snapX?: Cx.
|
|
13
|
-
|
|
14
|
-
/* A binding used to receive the y value of the nearest point. */
|
|
15
|
-
snapY?: Cx.
|
|
16
|
-
|
|
17
|
-
/* A binding used to receive the record prop */
|
|
18
|
-
snapRecord?: Cx.Prop<Cx.Record>;
|
|
19
|
-
|
|
20
|
-
/* Maximum distance between cursor and the snap point. */
|
|
21
|
-
maxDistance?: number;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import * as Cx from "../../core";
|
|
2
|
+
import { PointReducerProps } from "./PointReducer";
|
|
3
|
+
|
|
4
|
+
interface SnapPointFinderProps extends PointReducerProps {
|
|
5
|
+
/* Cursor X value. */
|
|
6
|
+
cursorX?: Cx.NumberProp;
|
|
7
|
+
|
|
8
|
+
/* Cursor Y value */
|
|
9
|
+
cursorY?: Cx.NumberProp;
|
|
10
|
+
|
|
11
|
+
/* A binding used to receive the x value of the nearest point.*/
|
|
12
|
+
snapX?: Cx.NumberProp | Cx.StringProp;
|
|
13
|
+
|
|
14
|
+
/* A binding used to receive the y value of the nearest point. */
|
|
15
|
+
snapY?: Cx.NumberProp | Cx.StringProp;
|
|
16
|
+
|
|
17
|
+
/* A binding used to receive the record prop */
|
|
18
|
+
snapRecord?: Cx.Prop<Cx.Record>;
|
|
19
|
+
|
|
20
|
+
/* Maximum distance between cursor and the snap point. Default value is 50. Adjust accordingly for large distances, e.g. set to Infinity when using TimeAxis */
|
|
21
|
+
maxDistance?: number;
|
|
22
|
+
|
|
23
|
+
/* A function used to convert x values into numeric format. Commonly used with dates. */
|
|
24
|
+
convertX?: (value: number | string) => number;
|
|
25
|
+
|
|
26
|
+
/* A function used to convert y values into numeric format. Commonly used with dates. */
|
|
27
|
+
convertY?: (value: number | string) => number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class SnapPointFinder extends Cx.Widget<SnapPointFinderProps> {}
|
|
@@ -1,47 +1,49 @@
|
|
|
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
|
-
onInitAccumulator(acc, {data}) {
|
|
16
|
-
acc.cursorX = data.cursorX;
|
|
17
|
-
acc.cursorY = data.cursorY;
|
|
18
|
-
acc.dist = data.maxDistance > 0 ? Math.pow(data.maxDistance, 2) : Number.POSITIVE_INFINITY;
|
|
19
|
-
acc.snapX = null;
|
|
20
|
-
acc.snapY = null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
onMap(acc, x, y, name, p) {
|
|
24
|
-
let d = null;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (d != null && d < acc.dist) {
|
|
33
|
-
acc.dist = d;
|
|
34
|
-
acc.snapX = x;
|
|
35
|
-
acc.snapY = y;
|
|
36
|
-
acc.snapRecord = p;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
onReduce(acc, instance) {
|
|
41
|
-
instance.set(
|
|
42
|
-
instance.set(
|
|
43
|
-
instance.set(
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
SnapPointFinder.prototype.maxDistance = 50;
|
|
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
|
+
onInitAccumulator(acc, { data }) {
|
|
16
|
+
acc.cursorX = data.cursorX;
|
|
17
|
+
acc.cursorY = data.cursorY;
|
|
18
|
+
acc.dist = data.maxDistance > 0 ? Math.pow(data.maxDistance, 2) : Number.POSITIVE_INFINITY;
|
|
19
|
+
acc.snapX = null;
|
|
20
|
+
acc.snapY = null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onMap(acc, x, y, name, p) {
|
|
24
|
+
let d = null;
|
|
25
|
+
let cx = this.convertX(x);
|
|
26
|
+
let cy = this.convertY(y);
|
|
27
|
+
|
|
28
|
+
if (acc.cursorX != null && cx != null) d = (d || 0) + Math.pow(Math.abs(cx - acc.cursorX), 2);
|
|
29
|
+
|
|
30
|
+
if (acc.cursorY != null && cy != null) d = (d || 0) + Math.pow(Math.abs(cy - acc.cursorY), 2);
|
|
31
|
+
|
|
32
|
+
if (d != null && d < acc.dist) {
|
|
33
|
+
acc.dist = d;
|
|
34
|
+
acc.snapX = x;
|
|
35
|
+
acc.snapY = y;
|
|
36
|
+
acc.snapRecord = p;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
onReduce(acc, instance) {
|
|
41
|
+
instance.set("snapX", acc.snapX);
|
|
42
|
+
instance.set("snapY", acc.snapY);
|
|
43
|
+
instance.set("snapRecord", acc.snapRecord);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
SnapPointFinder.prototype.maxDistance = 50;
|
|
48
|
+
SnapPointFinder.prototype.convertX = (x) => x;
|
|
49
|
+
SnapPointFinder.prototype.convertY = (y) => y;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import * as Cx from
|
|
2
|
-
import {PointReducerProps} from
|
|
3
|
-
|
|
4
|
-
interface ValueAtFinderProps extends PointReducerProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export class ValueAtFinder extends Cx.Widget<ValueAtFinderProps> {}
|
|
1
|
+
import * as Cx from "../../core";
|
|
2
|
+
import { PointReducerProps } from "./PointReducer";
|
|
3
|
+
|
|
4
|
+
interface ValueAtFinderProps extends PointReducerProps {
|
|
5
|
+
/* X axis probe value. */
|
|
6
|
+
at?: Cx.NumberProp | Cx.StringProp;
|
|
7
|
+
|
|
8
|
+
/* A binding used to receive the measured y axis value */
|
|
9
|
+
value?: Cx.Bind | Cx.AccessorChain<number>;
|
|
10
|
+
|
|
11
|
+
/* A function used to convert x values into numeric format. Commonly used with dates. */
|
|
12
|
+
convert?: (value: number | string) => number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Calculate value at a given point on the graph */
|
|
16
|
+
export class ValueAtFinder extends Cx.Widget<ValueAtFinderProps> {}
|