@pie-lib/charting 8.0.1-next.20261006030823 → 8.0.1-next.20261006035546
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/__tests__/mark-slider.test.d.ts +1 -0
- package/dist/axes.js +150 -144
- package/dist/bars/common/bars.d.ts +3 -0
- package/dist/bars/common/bars.js +93 -72
- package/dist/chart.js +107 -106
- package/dist/common/mark-slider.d.ts +50 -0
- package/dist/common/mark-slider.js +70 -0
- package/dist/line/common/line.d.ts +2 -0
- package/dist/line/common/line.js +84 -60
- package/dist/mark-label.d.ts +1 -0
- package/dist/mark-label.js +32 -19
- package/dist/plot/common/plot.d.ts +3 -0
- package/dist/plot/common/plot.js +130 -109
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +10 -10
- package/package.json +6 -6
package/dist/bars/common/bars.js
CHANGED
|
@@ -2,16 +2,17 @@ import e from "../../node_modules/.bun/@visx_group@4.0.0_d84c32d47042070f/node_m
|
|
|
2
2
|
import t from "../../node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/Bar.js";
|
|
3
3
|
import { bandKey as n } from "../../utils.js";
|
|
4
4
|
import { D as r, DragHandle as i } from "../../common/drag-handle.js";
|
|
5
|
-
import {
|
|
6
|
-
import o from "
|
|
7
|
-
import s from "
|
|
8
|
-
import
|
|
9
|
-
import l from "
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { MarkSlider as a } from "../../common/mark-slider.js";
|
|
6
|
+
import { CorrectCheckIcon as o } from "./correct-check-icon.js";
|
|
7
|
+
import s from "react";
|
|
8
|
+
import c from "prop-types";
|
|
9
|
+
import { styled as l } from "@mui/material/styles";
|
|
10
|
+
import u from "debug";
|
|
11
|
+
import { types as d } from "@pie-lib/plot";
|
|
12
|
+
import { color as f } from "@pie-lib/render-ui";
|
|
13
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
13
14
|
//#region src/bars/common/bars.tsx
|
|
14
|
-
var
|
|
15
|
+
var g = u("pie-lib:chart:bars"), _ = [
|
|
15
16
|
"#006699",
|
|
16
17
|
"#F59B00",
|
|
17
18
|
"#08916D",
|
|
@@ -24,7 +25,7 @@ var h = l("pie-lib:chart:bars"), g = [
|
|
|
24
25
|
"#4FD2D2",
|
|
25
26
|
"#F0E442",
|
|
26
27
|
"#E287B2"
|
|
27
|
-
],
|
|
28
|
+
], v = [
|
|
28
29
|
"#003754",
|
|
29
30
|
"#975616",
|
|
30
31
|
"#00503B",
|
|
@@ -37,23 +38,24 @@ var h = l("pie-lib:chart:bars"), g = [
|
|
|
37
38
|
"#167A7A",
|
|
38
39
|
"#91862D",
|
|
39
40
|
"#894A65"
|
|
40
|
-
],
|
|
41
|
+
], y = (e, t, n, r, i) => e && t && i ? r[n % r.length] : e && i ? f.visualElementsColors.ROLLOVER_FILL_BAR_COLOR : t || null, b = l(t)(() => ({ fill: f.defaults.TERTIARY })), x = 10, S = class extends s.Component {
|
|
41
42
|
static propTypes = {
|
|
42
|
-
barColor:
|
|
43
|
-
onChangeCategory:
|
|
44
|
-
value:
|
|
45
|
-
label:
|
|
46
|
-
xBand:
|
|
47
|
-
index:
|
|
48
|
-
graphProps:
|
|
49
|
-
interactive:
|
|
50
|
-
disabled:
|
|
51
|
-
correctness:
|
|
52
|
-
value:
|
|
53
|
-
label:
|
|
43
|
+
barColor: c.string,
|
|
44
|
+
onChangeCategory: c.func,
|
|
45
|
+
value: c.number,
|
|
46
|
+
label: c.string,
|
|
47
|
+
xBand: c.func,
|
|
48
|
+
index: c.number.isRequired,
|
|
49
|
+
graphProps: d.GraphPropsType.isRequired,
|
|
50
|
+
interactive: c.bool,
|
|
51
|
+
disabled: c.bool,
|
|
52
|
+
correctness: c.shape({
|
|
53
|
+
value: c.string,
|
|
54
|
+
label: c.string
|
|
54
55
|
}),
|
|
55
|
-
correctData:
|
|
56
|
-
defineChart:
|
|
56
|
+
correctData: c.array,
|
|
57
|
+
defineChart: c.bool,
|
|
58
|
+
language: c.string
|
|
57
59
|
};
|
|
58
60
|
constructor(e) {
|
|
59
61
|
super(e), this.state = {
|
|
@@ -79,85 +81,103 @@ var h = l("pie-lib:chart:bars"), g = [
|
|
|
79
81
|
handleMouseEnter = () => this.setState({ isHovered: !0 });
|
|
80
82
|
handleMouseLeave = () => this.setState({ isHovered: !1 });
|
|
81
83
|
setDragValue = (e) => this.setState({ dragValue: e });
|
|
84
|
+
changeValue = (e) => {
|
|
85
|
+
let { label: t, onChangeCategory: n } = this.props;
|
|
86
|
+
n({
|
|
87
|
+
label: t,
|
|
88
|
+
value: e
|
|
89
|
+
});
|
|
90
|
+
};
|
|
82
91
|
dragStop = () => {
|
|
83
|
-
let {
|
|
84
|
-
|
|
85
|
-
label: e,
|
|
86
|
-
value: n
|
|
87
|
-
}), this.setDragValue(void 0);
|
|
92
|
+
let { dragValue: e } = this.state;
|
|
93
|
+
g("[dragStop]", e), e !== void 0 && this.changeValue(e), this.setDragValue(void 0);
|
|
88
94
|
};
|
|
89
95
|
dragValue = (e, t) => {
|
|
90
|
-
|
|
96
|
+
g("[dragValue] next:", t), this.setDragValue(t);
|
|
91
97
|
};
|
|
92
98
|
render() {
|
|
93
|
-
let { graphProps: e, value: t, label:
|
|
94
|
-
return /* @__PURE__ */
|
|
99
|
+
let { graphProps: e, value: t, label: s, xBand: c, index: l, interactive: u, disabled: d, correctness: g, barColor: _, defineChart: S, correctData: C, language: w } = this.props, { scale: T, range: E } = e, { dragValue: D, isHovered: O } = this.state, k = y(O, _, l, v, u && !g), A = Number.isFinite(D) ? D : t, j = c.bandwidth(), M = T.y(E.max - A), N = c(n({ label: s }, l)), P = E.max - A, F = E.max - P, I = C ? C.find((e) => e.label === s) : null, L = u ? r : i, R = !!_;
|
|
100
|
+
return /* @__PURE__ */ h(a, {
|
|
95
101
|
ref: (e) => this.gRef = e,
|
|
96
102
|
onMouseEnter: this.handleMouseEnter,
|
|
97
103
|
onMouseLeave: this.handleMouseLeave,
|
|
98
104
|
onTouchStart: this.handleMouseEnter,
|
|
99
105
|
onTouchEnd: this.handleMouseLeave,
|
|
106
|
+
enabled: u && !d,
|
|
107
|
+
label: s,
|
|
108
|
+
index: l,
|
|
109
|
+
value: A,
|
|
110
|
+
graphProps: e,
|
|
111
|
+
language: w,
|
|
112
|
+
focusBox: {
|
|
113
|
+
x: N,
|
|
114
|
+
y: T.y(F) - x,
|
|
115
|
+
width: j,
|
|
116
|
+
height: Math.max(0, M) + x
|
|
117
|
+
},
|
|
118
|
+
onChange: this.changeValue,
|
|
100
119
|
children: [
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
x:
|
|
103
|
-
y:
|
|
104
|
-
width:
|
|
105
|
-
height:
|
|
106
|
-
style: { fill:
|
|
120
|
+
/* @__PURE__ */ m(b, {
|
|
121
|
+
x: N,
|
|
122
|
+
y: T.y(F),
|
|
123
|
+
width: j,
|
|
124
|
+
height: M,
|
|
125
|
+
style: { fill: k }
|
|
107
126
|
}),
|
|
108
|
-
|
|
109
|
-
let e = parseFloat(
|
|
127
|
+
g && g.value === "incorrect" && (() => {
|
|
128
|
+
let e = parseFloat(I && I.value);
|
|
110
129
|
if (isNaN(e)) return null;
|
|
111
|
-
let t =
|
|
112
|
-
return /* @__PURE__ */
|
|
113
|
-
x:
|
|
130
|
+
let t = T.y(E.max - e), n = M, r = Math.abs(t - n), i = T.y(e), a = t > n ? f.borderGray() : f.defaults.WHITE, s = t > n ? i : i - r;
|
|
131
|
+
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(b, {
|
|
132
|
+
x: N + 2,
|
|
114
133
|
y: s,
|
|
115
|
-
width:
|
|
134
|
+
width: j - 4,
|
|
116
135
|
height: r,
|
|
117
136
|
style: {
|
|
118
|
-
stroke:
|
|
137
|
+
stroke: a,
|
|
119
138
|
strokeWidth: 2,
|
|
120
139
|
strokeDasharray: "5,2",
|
|
121
140
|
fill: "none"
|
|
122
141
|
}
|
|
123
|
-
}), /* @__PURE__ */
|
|
124
|
-
x:
|
|
142
|
+
}), /* @__PURE__ */ m("foreignObject", {
|
|
143
|
+
x: N + j - (R ? 24 : 14),
|
|
125
144
|
y: i - 12,
|
|
126
145
|
width: 24,
|
|
127
146
|
height: 24,
|
|
128
|
-
children: /* @__PURE__ */
|
|
147
|
+
children: /* @__PURE__ */ m(o, { dashColor: a })
|
|
129
148
|
})] });
|
|
130
149
|
})(),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
x:
|
|
133
|
-
y:
|
|
134
|
-
defineChart:
|
|
135
|
-
interactive:
|
|
136
|
-
disabled:
|
|
137
|
-
width:
|
|
150
|
+
/* @__PURE__ */ m(L, {
|
|
151
|
+
x: N,
|
|
152
|
+
y: A,
|
|
153
|
+
defineChart: S,
|
|
154
|
+
interactive: u,
|
|
155
|
+
disabled: d,
|
|
156
|
+
width: j,
|
|
138
157
|
onDrag: (e) => this.dragValue(t, e),
|
|
139
158
|
onDragStop: this.dragStop,
|
|
140
159
|
graphProps: e,
|
|
141
|
-
correctness:
|
|
142
|
-
isHovered:
|
|
143
|
-
color:
|
|
160
|
+
correctness: g,
|
|
161
|
+
isHovered: O,
|
|
162
|
+
color: k
|
|
144
163
|
})
|
|
145
164
|
]
|
|
146
165
|
});
|
|
147
166
|
}
|
|
148
|
-
},
|
|
167
|
+
}, C = S, w = class extends s.Component {
|
|
149
168
|
static propTypes = {
|
|
150
|
-
data:
|
|
151
|
-
correctData:
|
|
152
|
-
onChangeCategory:
|
|
153
|
-
defineChart:
|
|
154
|
-
xBand:
|
|
155
|
-
graphProps:
|
|
156
|
-
histogram:
|
|
169
|
+
data: c.array,
|
|
170
|
+
correctData: c.array,
|
|
171
|
+
onChangeCategory: c.func,
|
|
172
|
+
defineChart: c.bool,
|
|
173
|
+
xBand: c.func,
|
|
174
|
+
graphProps: d.GraphPropsType.isRequired,
|
|
175
|
+
histogram: c.bool,
|
|
176
|
+
language: c.string
|
|
157
177
|
};
|
|
158
178
|
render() {
|
|
159
|
-
let { data: t, graphProps: n, xBand: r, onChangeCategory: i, defineChart: a, histogram: o, correctData: s, disabled: c } = this.props;
|
|
160
|
-
return /* @__PURE__ */
|
|
179
|
+
let { data: t, graphProps: n, xBand: r, onChangeCategory: i, defineChart: a, histogram: o, correctData: s, disabled: c, language: l } = this.props;
|
|
180
|
+
return /* @__PURE__ */ m(e, { children: (t || []).map((e, t) => /* @__PURE__ */ m(C, {
|
|
161
181
|
value: e.value,
|
|
162
182
|
interactive: a || e.interactive,
|
|
163
183
|
defineChart: a,
|
|
@@ -169,9 +189,10 @@ var h = l("pie-lib:chart:bars"), g = [
|
|
|
169
189
|
graphProps: n,
|
|
170
190
|
correctness: e.correctness,
|
|
171
191
|
correctData: s,
|
|
172
|
-
|
|
173
|
-
|
|
192
|
+
language: l,
|
|
193
|
+
barColor: o && (_[t] ? _[t] : _[t % _.length])
|
|
194
|
+
}, `bar-${e.label}-${t}`)) });
|
|
174
195
|
}
|
|
175
196
|
};
|
|
176
197
|
//#endregion
|
|
177
|
-
export {
|
|
198
|
+
export { w as Bars, w as default, S as RawBar };
|
package/dist/chart.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { Grid as e } from "./grid.js";
|
|
2
|
-
import { dataToXBand as t, getDomainAndRangeByChartType as n, getGridLinesAndAxisByChartType as r, getTopPadding as i } from "./utils.js";
|
|
3
|
-
import { RawChartAxes as
|
|
4
|
-
import
|
|
5
|
-
import { ActionsButton as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { styled as
|
|
9
|
-
import
|
|
10
|
-
import { cloneDeep as
|
|
11
|
-
import { Root as
|
|
12
|
-
import { AlertDialog as
|
|
13
|
-
import { createUniqueId as
|
|
14
|
-
import { jsx as
|
|
15
|
-
import
|
|
2
|
+
import { dataToXBand as t, getDomainAndRangeByChartType as n, getGridLinesAndAxisByChartType as r, getTopPadding as i, textOf as a } from "./utils.js";
|
|
3
|
+
import { RawChartAxes as o } from "./axes.js";
|
|
4
|
+
import s from "./chart-types.js";
|
|
5
|
+
import { ActionsButton as c } from "./actions-button.js";
|
|
6
|
+
import l from "react";
|
|
7
|
+
import u from "prop-types";
|
|
8
|
+
import { styled as d } from "@mui/material/styles";
|
|
9
|
+
import f from "debug";
|
|
10
|
+
import { cloneDeep as p } from "@pie-element/shared-lodash";
|
|
11
|
+
import { Root as m, createGraphProps as h } from "@pie-lib/plot";
|
|
12
|
+
import { AlertDialog as g } from "@pie-lib/config-ui";
|
|
13
|
+
import { createUniqueId as _ } from "@pie-lib/render-ui";
|
|
14
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
15
|
+
import b from "@pie-lib/translator";
|
|
16
16
|
//#region src/chart.tsx
|
|
17
|
-
var { translator:
|
|
18
|
-
let
|
|
17
|
+
var { translator: x } = b, ee = f("pie-lib:charts:chart"), te = d("div")(() => ({ width: "min-content" })), S = ({ title: e, chartType: t, categories: n, range: r, language: i }) => {
|
|
18
|
+
let o = {
|
|
19
19
|
lng: i,
|
|
20
20
|
interpolation: { escapeValue: !1 }
|
|
21
|
-
},
|
|
22
|
-
...
|
|
23
|
-
label:
|
|
21
|
+
}, s = x.t(`charting.chartTypes.${t}`, o), c = a(r.label), l = c ? x.t("charting.labelledValueRange", {
|
|
22
|
+
...o,
|
|
23
|
+
label: c,
|
|
24
24
|
min: r.min,
|
|
25
25
|
max: r.max
|
|
26
|
-
}) :
|
|
27
|
-
...
|
|
26
|
+
}) : x.t("charting.valueRange", {
|
|
27
|
+
...o,
|
|
28
28
|
min: r.min,
|
|
29
29
|
max: r.max
|
|
30
|
-
}),
|
|
31
|
-
...
|
|
30
|
+
}), u = x.t("charting.categories", {
|
|
31
|
+
...o,
|
|
32
32
|
count: n.length,
|
|
33
|
-
categories: n.map((e) =>
|
|
33
|
+
categories: n.map((e) => a(e.label)).join(", ")
|
|
34
34
|
});
|
|
35
35
|
return {
|
|
36
|
-
ariaLabel:
|
|
37
|
-
ariaDescription: `${
|
|
36
|
+
ariaLabel: a(e) || s,
|
|
37
|
+
ariaDescription: `${s}. ${u} ${l}`
|
|
38
38
|
};
|
|
39
|
-
},
|
|
39
|
+
}, C = class extends l.Component {
|
|
40
40
|
constructor(e) {
|
|
41
41
|
super(e), this.state = {
|
|
42
42
|
dialog: { open: !1 },
|
|
@@ -45,54 +45,54 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
|
|
|
45
45
|
}, this.maskUid = this.generateMaskId();
|
|
46
46
|
}
|
|
47
47
|
static propTypes = {
|
|
48
|
-
className:
|
|
49
|
-
chartType:
|
|
50
|
-
size:
|
|
51
|
-
width:
|
|
52
|
-
height:
|
|
48
|
+
className: u.string,
|
|
49
|
+
chartType: u.string.isRequired,
|
|
50
|
+
size: u.shape({
|
|
51
|
+
width: u.number,
|
|
52
|
+
height: u.number
|
|
53
53
|
}),
|
|
54
|
-
domain:
|
|
55
|
-
label:
|
|
56
|
-
min:
|
|
57
|
-
max:
|
|
58
|
-
axisLabel:
|
|
54
|
+
domain: u.shape({
|
|
55
|
+
label: u.string,
|
|
56
|
+
min: u.number,
|
|
57
|
+
max: u.number,
|
|
58
|
+
axisLabel: u.string
|
|
59
59
|
}),
|
|
60
|
-
data:
|
|
61
|
-
label:
|
|
62
|
-
value:
|
|
60
|
+
data: u.arrayOf(u.shape({
|
|
61
|
+
label: u.string,
|
|
62
|
+
value: u.number
|
|
63
63
|
})),
|
|
64
|
-
range:
|
|
65
|
-
label:
|
|
66
|
-
min:
|
|
67
|
-
max:
|
|
68
|
-
step:
|
|
69
|
-
labelStep:
|
|
70
|
-
axisLabel:
|
|
64
|
+
range: u.shape({
|
|
65
|
+
label: u.string,
|
|
66
|
+
min: u.number,
|
|
67
|
+
max: u.number,
|
|
68
|
+
step: u.number,
|
|
69
|
+
labelStep: u.number,
|
|
70
|
+
axisLabel: u.string
|
|
71
71
|
}),
|
|
72
|
-
charts:
|
|
73
|
-
labelsPlaceholders:
|
|
74
|
-
title:
|
|
75
|
-
titlePlaceholder:
|
|
76
|
-
onDataChange:
|
|
77
|
-
onChangeLabels:
|
|
78
|
-
onChangeTitle:
|
|
79
|
-
error:
|
|
80
|
-
addCategoryEnabled:
|
|
81
|
-
showPixelGuides:
|
|
82
|
-
categoryDefaultLabel:
|
|
83
|
-
categoryDefaults:
|
|
84
|
-
defineChart:
|
|
85
|
-
disabled:
|
|
86
|
-
theme:
|
|
87
|
-
chartingOptions:
|
|
88
|
-
changeInteractiveEnabled:
|
|
89
|
-
changeEditableEnabled:
|
|
90
|
-
language:
|
|
91
|
-
mathMlOptions:
|
|
92
|
-
labelsCharactersLimit:
|
|
93
|
-
correctData:
|
|
94
|
-
label:
|
|
95
|
-
value:
|
|
72
|
+
charts: u.array,
|
|
73
|
+
labelsPlaceholders: u.object,
|
|
74
|
+
title: u.string,
|
|
75
|
+
titlePlaceholder: u.string,
|
|
76
|
+
onDataChange: u.func,
|
|
77
|
+
onChangeLabels: u.func,
|
|
78
|
+
onChangeTitle: u.func,
|
|
79
|
+
error: u.any,
|
|
80
|
+
addCategoryEnabled: u.bool,
|
|
81
|
+
showPixelGuides: u.bool,
|
|
82
|
+
categoryDefaultLabel: u.string,
|
|
83
|
+
categoryDefaults: u.object,
|
|
84
|
+
defineChart: u.bool,
|
|
85
|
+
disabled: u.bool,
|
|
86
|
+
theme: u.object,
|
|
87
|
+
chartingOptions: u.object,
|
|
88
|
+
changeInteractiveEnabled: u.bool,
|
|
89
|
+
changeEditableEnabled: u.bool,
|
|
90
|
+
language: u.string,
|
|
91
|
+
mathMlOptions: u.object,
|
|
92
|
+
labelsCharactersLimit: u.number,
|
|
93
|
+
correctData: u.arrayOf(u.shape({
|
|
94
|
+
label: u.string,
|
|
95
|
+
value: u.number
|
|
96
96
|
}))
|
|
97
97
|
};
|
|
98
98
|
static defaultProps = { size: {
|
|
@@ -101,17 +101,17 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
|
|
|
101
101
|
} };
|
|
102
102
|
state = {
|
|
103
103
|
charts: [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
s.Bar(),
|
|
105
|
+
s.Histogram(),
|
|
106
|
+
s.LineDot(),
|
|
107
|
+
s.LineCross(),
|
|
108
|
+
s.DotPlot(),
|
|
109
|
+
s.LinePlot()
|
|
110
110
|
],
|
|
111
111
|
autoFocus: !1
|
|
112
112
|
};
|
|
113
113
|
generateMaskId() {
|
|
114
|
-
return
|
|
114
|
+
return _("chart");
|
|
115
115
|
}
|
|
116
116
|
setLabelOverhang = (e) => this.setState({ labelOverhang: e });
|
|
117
117
|
handleAlertDialog = (e, t) => this.setState({ dialog: { open: e } }, t);
|
|
@@ -140,15 +140,15 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
|
|
|
140
140
|
let { onDataChange: e, data: t, categoryDefaultLabel: n, defineChart: r, categoryDefaults: i, language: a } = this.props;
|
|
141
141
|
(t || []).length > 19 ? this.setState({ dialog: {
|
|
142
142
|
open: !0,
|
|
143
|
-
title:
|
|
144
|
-
text:
|
|
143
|
+
title: x.t("common:warning", { lng: a }),
|
|
144
|
+
text: x.t("charting.reachedLimit_other", {
|
|
145
145
|
count: 20,
|
|
146
146
|
lng: a
|
|
147
147
|
}),
|
|
148
148
|
onConfirm: () => this.handleAlertDialog(!1)
|
|
149
149
|
} }) : (this.setState({ autoFocus: !0 }), e([...t, {
|
|
150
150
|
inDefineChart: r,
|
|
151
|
-
label: n ||
|
|
151
|
+
label: n || x.t("charting.newLabel", { lng: a }),
|
|
152
152
|
value: 0,
|
|
153
153
|
deletable: !0,
|
|
154
154
|
editable: !i || i?.editable,
|
|
@@ -170,36 +170,36 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
|
|
|
170
170
|
this.setState({ autoFocus: !1 });
|
|
171
171
|
};
|
|
172
172
|
render() {
|
|
173
|
-
let { domain:
|
|
174
|
-
left:
|
|
175
|
-
bottom:
|
|
176
|
-
}, { type: z, ChartComponent: B } = this.getChart(), V = this.getFilteredCategories(), H = n(
|
|
173
|
+
let { domain: a = {}, range: s = {}, chartingOptions: l, size: u, title: d, onChangeTitle: f, onChangeLabels: _, labelsPlaceholders: b, titlePlaceholder: x, addCategoryEnabled: C, changeInteractiveEnabled: w, changeEditableEnabled: T, showPixelGuides: E, error: D, mathMlOptions: O = {}, language: k, labelsCharactersLimit: A, correctData: j, disabled: M } = this.props, { chartType: N } = this.props, { dialog: P } = this.state, F = this.props.defineChart || !1, { width: I, height: L } = u || {}, R = {
|
|
174
|
+
left: s?.label || "",
|
|
175
|
+
bottom: a?.label || ""
|
|
176
|
+
}, { type: z, ChartComponent: B } = this.getChart(), V = this.getFilteredCategories(), H = n(a, s, N), { ariaLabel: U, ariaDescription: W } = S({
|
|
177
177
|
title: d,
|
|
178
178
|
chartType: z,
|
|
179
179
|
categories: V,
|
|
180
180
|
range: {
|
|
181
181
|
...H.range,
|
|
182
|
-
label:
|
|
182
|
+
label: s.label
|
|
183
183
|
},
|
|
184
184
|
language: k
|
|
185
|
-
}), { verticalLines: G, horizontalLines: K, leftAxis: q } = r(H.range, N), J = { graphProps:
|
|
186
|
-
|
|
185
|
+
}), { verticalLines: G, horizontalLines: K, leftAxis: q } = r(H.range, N), J = { graphProps: h(H.domain, H.range, u, () => this.rootNode) };
|
|
186
|
+
ee("[render] common:", J);
|
|
187
187
|
let Y = {
|
|
188
188
|
x: -10,
|
|
189
189
|
y: -75,
|
|
190
190
|
width: I + 20,
|
|
191
191
|
height: L + 130
|
|
192
|
-
}, { scale: X } = J.graphProps, Z = t(X.x, V, I, N), ne = Z.bandwidth() || X.x(H.domain.max) / V.length, re = F ? 160 : 60, Q = Math.max(i(ne), this.state.labelOverhang), $ =
|
|
193
|
-
return $.graphProps.size.height += Q + re, (N === "dotPlot" || N === "linePlot") && j?.length && R.bottom && ($.graphProps.size.height += 25), /* @__PURE__ */
|
|
192
|
+
}, { scale: X } = J.graphProps, Z = t(X.x, V, I, N), ne = Z.bandwidth() || X.x(H.domain.max) / V.length, re = F ? 160 : 60, Q = Math.max(i(ne), this.state.labelOverhang), $ = p(J);
|
|
193
|
+
return $.graphProps.size.height += Q + re, (N === "dotPlot" || N === "linePlot") && j?.length && R.bottom && ($.graphProps.size.height += 25), /* @__PURE__ */ y(te, { children: [/* @__PURE__ */ y(m, {
|
|
194
194
|
title: d,
|
|
195
|
-
onChangeTitle:
|
|
195
|
+
onChangeTitle: f,
|
|
196
196
|
disabledTitle: !F,
|
|
197
197
|
showTitle: !0,
|
|
198
198
|
showLabels: !0,
|
|
199
199
|
labels: R,
|
|
200
|
-
onChangeLabels:
|
|
201
|
-
labelsPlaceholders:
|
|
202
|
-
titlePlaceholder:
|
|
200
|
+
onChangeLabels: _,
|
|
201
|
+
labelsPlaceholders: b,
|
|
202
|
+
titlePlaceholder: x,
|
|
203
203
|
defineChart: F,
|
|
204
204
|
disabledLabels: !F,
|
|
205
205
|
isChart: !0,
|
|
@@ -211,13 +211,13 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
|
|
|
211
211
|
ariaDescription: W,
|
|
212
212
|
...$,
|
|
213
213
|
children: [
|
|
214
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ v(e, {
|
|
215
215
|
...J,
|
|
216
216
|
xBand: Z,
|
|
217
217
|
rowTickValues: K,
|
|
218
218
|
columnTickValues: G
|
|
219
219
|
}),
|
|
220
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ v(o, {
|
|
221
221
|
autoFocus: this.state.autoFocus,
|
|
222
222
|
onAutoFocusUsed: this.resetAutoFocus,
|
|
223
223
|
...J,
|
|
@@ -236,18 +236,18 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
|
|
|
236
236
|
language: k,
|
|
237
237
|
onLabelOverhang: this.setLabelOverhang
|
|
238
238
|
}),
|
|
239
|
-
|
|
239
|
+
C ? /* @__PURE__ */ v("foreignObject", {
|
|
240
240
|
x: I,
|
|
241
241
|
y: L - 16,
|
|
242
242
|
width: I,
|
|
243
243
|
height: L,
|
|
244
|
-
children: /* @__PURE__ */
|
|
244
|
+
children: /* @__PURE__ */ v("div", {
|
|
245
245
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
246
246
|
style: {
|
|
247
247
|
display: "flex",
|
|
248
248
|
justifyContent: "flex-start"
|
|
249
249
|
},
|
|
250
|
-
children: /* @__PURE__ */
|
|
250
|
+
children: /* @__PURE__ */ v(c, {
|
|
251
251
|
categories: V,
|
|
252
252
|
addCategory: this.addCategory,
|
|
253
253
|
deleteCategory: this.deleteCategory,
|
|
@@ -255,16 +255,16 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
|
|
|
255
255
|
})
|
|
256
256
|
})
|
|
257
257
|
}) : null,
|
|
258
|
-
/* @__PURE__ */
|
|
258
|
+
/* @__PURE__ */ v("mask", {
|
|
259
259
|
id: `${this.maskUid}`,
|
|
260
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ v("rect", {
|
|
261
261
|
...Y,
|
|
262
262
|
fill: "white"
|
|
263
263
|
})
|
|
264
264
|
}),
|
|
265
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ v("g", {
|
|
266
266
|
mask: `url('#${this.maskUid}')`,
|
|
267
|
-
children: B && /* @__PURE__ */
|
|
267
|
+
children: B && /* @__PURE__ */ v(B, {
|
|
268
268
|
...J,
|
|
269
269
|
data: V,
|
|
270
270
|
height: $.graphProps.size.height,
|
|
@@ -272,11 +272,12 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
|
|
|
272
272
|
onChange: this.changeData,
|
|
273
273
|
onChangeCategory: this.changeCategory,
|
|
274
274
|
correctData: j,
|
|
275
|
-
disabled: M
|
|
275
|
+
disabled: M,
|
|
276
|
+
language: k
|
|
276
277
|
})
|
|
277
278
|
})
|
|
278
279
|
]
|
|
279
|
-
}), /* @__PURE__ */ g
|
|
280
|
+
}), /* @__PURE__ */ v(g, {
|
|
280
281
|
open: P.open,
|
|
281
282
|
title: P.title,
|
|
282
283
|
text: P.text,
|
|
@@ -286,4 +287,4 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
|
|
|
286
287
|
}
|
|
287
288
|
};
|
|
288
289
|
//#endregion
|
|
289
|
-
export {
|
|
290
|
+
export { C as Chart, C as default, S as chartAlternative };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type SliderGraphProps = {
|
|
3
|
+
range: {
|
|
4
|
+
min: number;
|
|
5
|
+
max: number;
|
|
6
|
+
step?: number;
|
|
7
|
+
labelStep?: number;
|
|
8
|
+
};
|
|
9
|
+
snap: {
|
|
10
|
+
y: (value: number) => number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type FocusBox = {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
export type MarkSliderProps = Omit<React.SVGProps<SVGGElement>, 'onChange' | 'ref'> & {
|
|
20
|
+
/** False for a read-only or disabled mark, which is no slider and takes no focus. */
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
label?: string;
|
|
23
|
+
index: number;
|
|
24
|
+
value: number;
|
|
25
|
+
graphProps: SliderGraphProps;
|
|
26
|
+
language?: string;
|
|
27
|
+
/** The box around the mark that the focus ring is drawn inside. */
|
|
28
|
+
focusBox: FocusBox;
|
|
29
|
+
/** The callback a drag of the mark commits through. */
|
|
30
|
+
onChange: (value: number) => void;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The group a chart mark is drawn in. An enabled mark is an APG slider over the value axis, named
|
|
34
|
+
* by its category: a key moves its value by the step a drag snaps to and commits it through
|
|
35
|
+
* `onChange`. Other props go to the group.
|
|
36
|
+
*/
|
|
37
|
+
export declare const MarkSlider: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGGElement>, "onChange" | "ref"> & {
|
|
38
|
+
/** False for a read-only or disabled mark, which is no slider and takes no focus. */
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
label?: string;
|
|
41
|
+
index: number;
|
|
42
|
+
value: number;
|
|
43
|
+
graphProps: SliderGraphProps;
|
|
44
|
+
language?: string;
|
|
45
|
+
/** The box around the mark that the focus ring is drawn inside. */
|
|
46
|
+
focusBox: FocusBox;
|
|
47
|
+
/** The callback a drag of the mark commits through. */
|
|
48
|
+
onChange: (value: number) => void;
|
|
49
|
+
} & React.RefAttributes<SVGGElement>>;
|
|
50
|
+
export default MarkSlider;
|