@pie-lib/charting 8.0.10 → 8.0.11-next.20261202142832
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/_virtual/_rolldown/runtime.js +6 -6
- package/dist/actions-button.js +42 -42
- package/dist/axes.js +166 -166
- package/dist/bars/bar.js +12 -12
- package/dist/bars/common/bars.js +59 -59
- package/dist/bars/histogram.js +12 -12
- package/dist/chart-setup.js +62 -62
- package/dist/chart-type.js +38 -38
- package/dist/chart.js +110 -110
- package/dist/common/correctness-indicators.js +22 -22
- package/dist/common/drag-handle.js +33 -33
- package/dist/common/drag-icon.js +11 -11
- package/dist/common/mark-slider.js +14 -14
- package/dist/grid.js +17 -17
- package/dist/i18n/index.js +4 -4
- package/dist/key-legend.js +28 -28
- package/dist/line/common/drag-handle.js +34 -34
- package/dist/line/common/line.js +56 -56
- package/dist/line/line-cross.js +61 -61
- package/dist/line/line-dot.js +48 -48
- package/dist/mark-label.js +45 -45
- package/dist/node_modules/.bun/@visx_text@4.0.0_d84c32d47042070f/node_modules/@visx/text/esm/hooks/useText.js +11 -11
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-interpolate.js +1 -1
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-scale.js +1 -1
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-shape.js +1 -1
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-time.js +1 -1
- package/dist/node_modules/.bun/classnames@2.5.1/node_modules/classnames/index.js +12 -11
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +1 -1
- package/dist/plot/common/plot.js +116 -116
- package/dist/plot/dot.js +33 -33
- package/dist/plot/line.js +44 -44
- package/package.json +8 -8
package/dist/plot/common/plot.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import _ from "
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import n from "@mui/icons-material/Check";
|
|
4
|
+
import { styled as r } from "@mui/material/styles";
|
|
5
|
+
import i from "../../node_modules/.bun/@visx_group@4.0.0_d84c32d47042070f/node_modules/@visx/group/esm/Group.js";
|
|
6
|
+
import a from "debug";
|
|
7
|
+
import { types as o } from "@pie-lib/plot";
|
|
8
|
+
import { D as s, DragHandle as c } from "../../common/drag-handle.js";
|
|
9
|
+
import { DragHover as l } from "../../common/drag-hover.js";
|
|
10
|
+
import { MarkSlider as u } from "../../common/mark-slider.js";
|
|
11
|
+
import { color as d } from "@pie-lib/render-ui";
|
|
12
|
+
import { bandKey as f } from "../../utils.js";
|
|
13
|
+
import { correct as p, incorrect as m } from "../../common/styles.js";
|
|
14
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
15
15
|
// src/plot/common/plot.tsx
|
|
16
|
-
var v =
|
|
16
|
+
var v = a("pie-lib:chart:bars"), y = 16, b = 10, x = class extends e.Component {
|
|
17
17
|
static propTypes = {
|
|
18
|
-
onChangeCategory:
|
|
19
|
-
value:
|
|
20
|
-
label:
|
|
21
|
-
xBand:
|
|
22
|
-
index:
|
|
23
|
-
graphProps:
|
|
24
|
-
CustomBarElement:
|
|
25
|
-
interactive:
|
|
26
|
-
disabled:
|
|
27
|
-
correctness:
|
|
28
|
-
value:
|
|
29
|
-
label:
|
|
18
|
+
onChangeCategory: t.func,
|
|
19
|
+
value: t.number,
|
|
20
|
+
label: t.string,
|
|
21
|
+
xBand: t.func,
|
|
22
|
+
index: t.number.isRequired,
|
|
23
|
+
graphProps: o.GraphPropsType.isRequired,
|
|
24
|
+
CustomBarElement: t.func,
|
|
25
|
+
interactive: t.bool,
|
|
26
|
+
disabled: t.bool,
|
|
27
|
+
correctness: t.shape({
|
|
28
|
+
value: t.string,
|
|
29
|
+
label: t.string
|
|
30
30
|
}),
|
|
31
|
-
defineChart:
|
|
32
|
-
correctData:
|
|
33
|
-
value:
|
|
34
|
-
label:
|
|
31
|
+
defineChart: t.bool,
|
|
32
|
+
correctData: t.arrayOf(t.shape({
|
|
33
|
+
value: t.oneOfType([t.string, t.number]),
|
|
34
|
+
label: t.string
|
|
35
35
|
})),
|
|
36
|
-
className:
|
|
37
|
-
language:
|
|
36
|
+
className: t.string,
|
|
37
|
+
language: t.string
|
|
38
38
|
};
|
|
39
39
|
constructor(e) {
|
|
40
40
|
super(e), this.state = {
|
|
41
41
|
dragValue: void 0,
|
|
42
42
|
isHovered: !1
|
|
43
|
-
}, this.hover = new
|
|
43
|
+
}, this.hover = new l((e) => this.setState({ isHovered: e }));
|
|
44
44
|
}
|
|
45
45
|
componentDidMount() {
|
|
46
46
|
this.hover.attach();
|
|
@@ -69,41 +69,41 @@ var v = d("pie-lib:chart:bars"), y = 16, b = 10, x = class extends c.Component {
|
|
|
69
69
|
dragValue = (e, t) => {
|
|
70
70
|
v("[dragValue] next:", t), this.setDragValue(t);
|
|
71
71
|
};
|
|
72
|
-
renderCorrectnessIcon = (e, t,
|
|
73
|
-
let
|
|
74
|
-
if (
|
|
72
|
+
renderCorrectnessIcon = (e, t, r, i, a, o, s) => {
|
|
73
|
+
let c;
|
|
74
|
+
if (r === 0) c = a.y(0) - y / 2;
|
|
75
75
|
else {
|
|
76
|
-
let e =
|
|
77
|
-
|
|
76
|
+
let e = r - 1;
|
|
77
|
+
c = a.y(e) - (o - s) / 2 - s / 2 - y / 2;
|
|
78
78
|
}
|
|
79
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ g("foreignObject", {
|
|
80
80
|
x: e + t / 2 - y / 2,
|
|
81
|
-
y:
|
|
81
|
+
y: c,
|
|
82
82
|
width: y,
|
|
83
83
|
height: y,
|
|
84
|
-
children: /* @__PURE__ */
|
|
84
|
+
children: /* @__PURE__ */ g(n, {
|
|
85
85
|
className: "correctnessIcon correctIcon smallIcon",
|
|
86
|
-
title:
|
|
86
|
+
title: i.label
|
|
87
87
|
})
|
|
88
88
|
});
|
|
89
89
|
};
|
|
90
90
|
render() {
|
|
91
|
-
let { graphProps:
|
|
92
|
-
v("label:",
|
|
91
|
+
let { graphProps: t, value: n, label: r, xBand: i, index: a, CustomBarElement: o, interactive: l, disabled: p, correctness: m, defineChart: y, correctData: x, className: S, language: C } = this.props, { scale: w, range: T, size: E } = t, { max: D } = T || {}, { dragValue: O, isHovered: k } = this.state, A = Number.isFinite(O) ? O : n, j = i.bandwidth(), M = w.y(T.max - A), N = i(f({ label: r }, a));
|
|
92
|
+
v("label:", r, "barX:", N, "v: ", A, "barHeight:", M, "barWidth: ", j);
|
|
93
93
|
let P = [];
|
|
94
94
|
for (let e = 0; e < A; e++) P.push(e);
|
|
95
|
-
let F = E.height / D, I = (F > j ? j : F) * .8, L =
|
|
96
|
-
return /* @__PURE__ */
|
|
95
|
+
let F = E.height / D, I = (F > j ? j : F) * .8, L = l ? s : c, R = l && !m;
|
|
96
|
+
return /* @__PURE__ */ g(e.Fragment, { children: /* @__PURE__ */ _(u, {
|
|
97
97
|
className: S,
|
|
98
98
|
onMouseEnter: this.handleMouseEnter,
|
|
99
99
|
onMouseLeave: this.handleMouseLeave,
|
|
100
100
|
onTouchStart: this.handleMouseEnter,
|
|
101
101
|
onTouchEnd: this.handleMouseLeave,
|
|
102
|
-
enabled:
|
|
103
|
-
label:
|
|
104
|
-
index:
|
|
102
|
+
enabled: l && !p,
|
|
103
|
+
label: r,
|
|
104
|
+
index: a,
|
|
105
105
|
value: A,
|
|
106
|
-
graphProps:
|
|
106
|
+
graphProps: t,
|
|
107
107
|
language: C,
|
|
108
108
|
focusBox: {
|
|
109
109
|
x: N,
|
|
@@ -113,105 +113,105 @@ var v = d("pie-lib:chart:bars"), y = 16, b = 10, x = class extends c.Component {
|
|
|
113
113
|
},
|
|
114
114
|
onChange: this.changeValue,
|
|
115
115
|
children: [
|
|
116
|
-
k && R && /* @__PURE__ */
|
|
116
|
+
k && R && /* @__PURE__ */ g("rect", {
|
|
117
117
|
x: N,
|
|
118
118
|
y: w.y(A),
|
|
119
119
|
width: j,
|
|
120
120
|
height: P?.length ? F * P.length : 0,
|
|
121
|
-
stroke:
|
|
121
|
+
stroke: d.defaults.BORDER_GRAY,
|
|
122
122
|
strokeWidth: "4px",
|
|
123
123
|
fill: "transparent"
|
|
124
124
|
}),
|
|
125
|
-
P.map((e) =>
|
|
125
|
+
P.map((e) => o({
|
|
126
126
|
index: e,
|
|
127
127
|
pointDiameter: I,
|
|
128
128
|
barX: N,
|
|
129
129
|
barWidth: j,
|
|
130
130
|
pointHeight: F,
|
|
131
|
-
label:
|
|
132
|
-
value:
|
|
131
|
+
label: r,
|
|
132
|
+
value: n,
|
|
133
133
|
scale: w
|
|
134
134
|
})),
|
|
135
|
-
|
|
136
|
-
let e = parseFloat(x[
|
|
135
|
+
m && m.value === "incorrect" && (() => {
|
|
136
|
+
let e = parseFloat(x[a] && x[a].value);
|
|
137
137
|
if (isNaN(e)) return null;
|
|
138
138
|
let t = A;
|
|
139
|
-
if (e === 0) return this.renderCorrectnessIcon(N, j, e,
|
|
139
|
+
if (e === 0) return this.renderCorrectnessIcon(N, j, e, m, w, F, I);
|
|
140
140
|
if (t > e) {
|
|
141
141
|
let t = [];
|
|
142
142
|
for (let n = 0; n < e; n++) t.push(n);
|
|
143
|
-
let
|
|
144
|
-
return /* @__PURE__ */
|
|
145
|
-
index:
|
|
146
|
-
pointDiameter:
|
|
147
|
-
barX:
|
|
148
|
-
barWidth:
|
|
149
|
-
pointHeight:
|
|
150
|
-
label:
|
|
151
|
-
value:
|
|
143
|
+
let s = t[t.length - 1], c = i(f({ label: r }, a)), l = i.bandwidth(), u = E.height / D, d = (u > l ? l : u) * .8;
|
|
144
|
+
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(o, {
|
|
145
|
+
index: s,
|
|
146
|
+
pointDiameter: d + 10,
|
|
147
|
+
barX: c,
|
|
148
|
+
barWidth: l,
|
|
149
|
+
pointHeight: u,
|
|
150
|
+
label: r,
|
|
151
|
+
value: n,
|
|
152
152
|
scale: w,
|
|
153
153
|
dottedOverline: !0
|
|
154
|
-
}), this.renderCorrectnessIcon(
|
|
154
|
+
}), this.renderCorrectnessIcon(c, l, e, m, w, u, d)] });
|
|
155
155
|
}
|
|
156
|
-
let
|
|
157
|
-
for (let
|
|
158
|
-
return /* @__PURE__ */
|
|
156
|
+
let s = [];
|
|
157
|
+
for (let n = t; n < e; n++) s.push(n);
|
|
158
|
+
return /* @__PURE__ */ _(h, { children: [s.map((e) => o({
|
|
159
159
|
index: e,
|
|
160
160
|
pointDiameter: I,
|
|
161
161
|
barX: N,
|
|
162
162
|
barWidth: j,
|
|
163
163
|
pointHeight: F,
|
|
164
|
-
label:
|
|
165
|
-
value:
|
|
164
|
+
label: r,
|
|
165
|
+
value: n,
|
|
166
166
|
scale: w,
|
|
167
167
|
dottedOverline: !0
|
|
168
|
-
})), this.renderCorrectnessIcon(N, j, e,
|
|
168
|
+
})), this.renderCorrectnessIcon(N, j, e, m, w, F, I)] });
|
|
169
169
|
})(),
|
|
170
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ g(L, {
|
|
171
171
|
x: N,
|
|
172
172
|
y: A,
|
|
173
|
-
interactive:
|
|
174
|
-
disabled:
|
|
173
|
+
interactive: l,
|
|
174
|
+
disabled: p,
|
|
175
175
|
width: j,
|
|
176
176
|
onDragStart: this.dragStart,
|
|
177
|
-
onDrag: (e) => this.dragValue(
|
|
177
|
+
onDrag: (e) => this.dragValue(n, e),
|
|
178
178
|
onDragStop: this.dragStop,
|
|
179
|
-
graphProps:
|
|
180
|
-
correctness:
|
|
179
|
+
graphProps: t,
|
|
180
|
+
correctness: m,
|
|
181
181
|
isHovered: k,
|
|
182
182
|
defineChart: y,
|
|
183
|
-
color:
|
|
183
|
+
color: d.primaryDark(),
|
|
184
184
|
isPlot: !0
|
|
185
185
|
})
|
|
186
186
|
]
|
|
187
187
|
}) });
|
|
188
188
|
}
|
|
189
|
-
}, S =
|
|
189
|
+
}, S = r(x)(({ theme: e }) => ({
|
|
190
190
|
"& .dot": {
|
|
191
|
-
fill:
|
|
192
|
-
"&.correct":
|
|
193
|
-
"&.incorrect":
|
|
191
|
+
fill: d.visualElementsColors.PLOT_FILL_COLOR,
|
|
192
|
+
"&.correct": p("stroke"),
|
|
193
|
+
"&.incorrect": m("stroke")
|
|
194
194
|
},
|
|
195
195
|
"& .dotColor": {
|
|
196
|
-
fill:
|
|
197
|
-
"&.correct":
|
|
198
|
-
"&.incorrect":
|
|
196
|
+
fill: d.visualElementsColors.PLOT_FILL_COLOR,
|
|
197
|
+
"&.correct": p("fill"),
|
|
198
|
+
"&.incorrect": m("fill")
|
|
199
199
|
},
|
|
200
200
|
"& .line": {
|
|
201
|
-
stroke:
|
|
202
|
-
"&.correct":
|
|
203
|
-
"&.incorrect":
|
|
201
|
+
stroke: d.visualElementsColors.PLOT_FILL_COLOR,
|
|
202
|
+
"&.correct": p("stroke"),
|
|
203
|
+
"&.incorrect": m("stroke")
|
|
204
204
|
},
|
|
205
|
-
"& .correctIcon": { backgroundColor:
|
|
206
|
-
"& .incorrectIcon": { backgroundColor:
|
|
205
|
+
"& .correctIcon": { backgroundColor: d.correct() },
|
|
206
|
+
"& .incorrectIcon": { backgroundColor: d.incorrectWithIcon() },
|
|
207
207
|
"& .correctnessIcon": {
|
|
208
208
|
borderRadius: e.spacing(2),
|
|
209
|
-
color:
|
|
209
|
+
color: d.defaults.WHITE,
|
|
210
210
|
fontSize: "16px",
|
|
211
211
|
width: "16px",
|
|
212
212
|
height: "16px",
|
|
213
213
|
padding: "2px",
|
|
214
|
-
border: `1px solid ${
|
|
214
|
+
border: `1px solid ${d.defaults.WHITE}`,
|
|
215
215
|
stroke: "initial",
|
|
216
216
|
boxSizing: "unset",
|
|
217
217
|
display: "block"
|
|
@@ -221,38 +221,38 @@ var v = d("pie-lib:chart:bars"), y = 16, b = 10, x = class extends c.Component {
|
|
|
221
221
|
width: "10px",
|
|
222
222
|
height: "10px"
|
|
223
223
|
}
|
|
224
|
-
})), C = class extends
|
|
224
|
+
})), C = class extends e.Component {
|
|
225
225
|
static propTypes = {
|
|
226
|
-
data:
|
|
227
|
-
onChangeCategory:
|
|
228
|
-
xBand:
|
|
229
|
-
graphProps:
|
|
230
|
-
defineChart:
|
|
231
|
-
CustomBarElement:
|
|
232
|
-
correctData:
|
|
233
|
-
value:
|
|
234
|
-
label:
|
|
226
|
+
data: t.array,
|
|
227
|
+
onChangeCategory: t.func,
|
|
228
|
+
xBand: t.func,
|
|
229
|
+
graphProps: o.GraphPropsType.isRequired,
|
|
230
|
+
defineChart: t.bool,
|
|
231
|
+
CustomBarElement: t.func,
|
|
232
|
+
correctData: t.arrayOf(t.shape({
|
|
233
|
+
value: t.oneOfType([t.string, t.number]),
|
|
234
|
+
label: t.string
|
|
235
235
|
})),
|
|
236
|
-
className:
|
|
237
|
-
language:
|
|
236
|
+
className: t.string,
|
|
237
|
+
language: t.string
|
|
238
238
|
};
|
|
239
239
|
render() {
|
|
240
|
-
let { data:
|
|
241
|
-
return /* @__PURE__ */
|
|
240
|
+
let { data: e, graphProps: t, xBand: n, CustomBarElement: r, onChangeCategory: a, defineChart: o, correctData: s, disabled: c, language: l } = this.props;
|
|
241
|
+
return /* @__PURE__ */ g(i, { children: (e || []).map((e, i) => /* @__PURE__ */ g(S, {
|
|
242
242
|
value: e.value,
|
|
243
243
|
label: e.label,
|
|
244
244
|
interactive: o || e.interactive,
|
|
245
245
|
defineChart: o,
|
|
246
246
|
disabled: c,
|
|
247
|
-
xBand:
|
|
248
|
-
index:
|
|
249
|
-
onChangeCategory: (e) => a(
|
|
250
|
-
graphProps:
|
|
251
|
-
CustomBarElement:
|
|
247
|
+
xBand: n,
|
|
248
|
+
index: i,
|
|
249
|
+
onChangeCategory: (e) => a(i, e),
|
|
250
|
+
graphProps: t,
|
|
251
|
+
CustomBarElement: r,
|
|
252
252
|
correctness: e.correctness,
|
|
253
253
|
correctData: s,
|
|
254
254
|
language: l
|
|
255
|
-
}, `bar-${e.label}-${
|
|
255
|
+
}, `bar-${e.label}-${i}`)) });
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
258
|
export { C as Plot, C as default, x as RawPlot };
|
package/dist/plot/dot.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import n from "../node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/Circle.js";
|
|
4
|
+
import { types as r } from "@pie-lib/plot";
|
|
5
|
+
import { dataToXBand as i } from "../utils.js";
|
|
6
|
+
import { Plot as a } from "./common/plot.js";
|
|
7
|
+
import { color as o } from "@pie-lib/render-ui";
|
|
7
8
|
import { styled as s } from "@mui/material/styles";
|
|
8
|
-
import {
|
|
9
|
-
import { color as l } from "@pie-lib/render-ui";
|
|
9
|
+
import { correct as c, incorrect as l } from "../common/styles.js";
|
|
10
10
|
import { jsx as u } from "react/jsx-runtime";
|
|
11
11
|
// src/plot/dot.tsx
|
|
12
|
-
var d = s(
|
|
13
|
-
fill:
|
|
14
|
-
"&.correct":
|
|
15
|
-
"&.incorrect":
|
|
16
|
-
})), f = (
|
|
17
|
-
let { index:
|
|
18
|
-
return p ? /* @__PURE__ */ u(
|
|
12
|
+
var d = s(n)(() => ({
|
|
13
|
+
fill: o.visualElementsColors.PLOT_FILL_COLOR,
|
|
14
|
+
"&.correct": c("stroke"),
|
|
15
|
+
"&.incorrect": l("stroke")
|
|
16
|
+
})), f = (e) => {
|
|
17
|
+
let { index: t, pointDiameter: r, barX: i, barWidth: a, pointHeight: s, label: c, value: l, scale: f, dottedOverline: p } = e, m = r / 2, h = i + (a - r) / 2 + m, g = f.y(t) - (s - r) / 2 - m;
|
|
18
|
+
return p ? /* @__PURE__ */ u(n, {
|
|
19
19
|
cx: h,
|
|
20
20
|
cy: g,
|
|
21
21
|
r: m + 2,
|
|
22
22
|
strokeDasharray: "4,4",
|
|
23
|
-
stroke:
|
|
23
|
+
stroke: o.defaults.BORDER_GRAY,
|
|
24
24
|
fill: "none"
|
|
25
|
-
}, `point-${
|
|
25
|
+
}, `point-${c}-${l}-${t}`) : /* @__PURE__ */ u(d, {
|
|
26
26
|
cx: h,
|
|
27
27
|
cy: g,
|
|
28
28
|
r: m
|
|
29
|
-
}, `point-${
|
|
29
|
+
}, `point-${c}-${l}-${t}`);
|
|
30
30
|
};
|
|
31
31
|
f.propTypes = {
|
|
32
|
-
index:
|
|
33
|
-
pointDiameter:
|
|
34
|
-
barX:
|
|
35
|
-
barWidth:
|
|
36
|
-
pointHeight:
|
|
37
|
-
value:
|
|
38
|
-
label:
|
|
39
|
-
scale:
|
|
40
|
-
dottedOverline:
|
|
32
|
+
index: t.number,
|
|
33
|
+
pointDiameter: t.number,
|
|
34
|
+
barX: t.number,
|
|
35
|
+
barWidth: t.number,
|
|
36
|
+
pointHeight: t.number,
|
|
37
|
+
value: t.number,
|
|
38
|
+
label: t.string,
|
|
39
|
+
scale: t.object,
|
|
40
|
+
dottedOverline: t.bool
|
|
41
41
|
};
|
|
42
|
-
var p = class extends
|
|
42
|
+
var p = class extends e.Component {
|
|
43
43
|
static propTypes = {
|
|
44
|
-
data:
|
|
45
|
-
onChange:
|
|
46
|
-
graphProps:
|
|
44
|
+
data: t.array,
|
|
45
|
+
onChange: t.func,
|
|
46
|
+
graphProps: r.GraphPropsType.isRequired
|
|
47
47
|
};
|
|
48
48
|
render() {
|
|
49
|
-
let e = this.props, { data:
|
|
50
|
-
return /* @__PURE__ */ u(
|
|
49
|
+
let e = this.props, { data: t, graphProps: n } = e, { scale: r = {}, size: o = {} } = n || {}, s = i(r.x, t, o.width, "dotPlot");
|
|
50
|
+
return /* @__PURE__ */ u(a, {
|
|
51
51
|
...e,
|
|
52
52
|
xBand: s,
|
|
53
53
|
CustomBarElement: f
|
package/dist/plot/line.js
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import n from "../node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/LinePath.js";
|
|
4
|
+
import r from "../node_modules/.bun/@visx_group@4.0.0_d84c32d47042070f/node_modules/@visx/group/esm/Group.js";
|
|
5
|
+
import { styled as i } from "@mui/material/styles";
|
|
6
|
+
import { types as a } from "@pie-lib/plot";
|
|
7
|
+
import { dataToXBand as o } from "../utils.js";
|
|
8
|
+
import { color as s } from "@pie-lib/render-ui";
|
|
9
|
+
import { Plot as c } from "./common/plot.js";
|
|
10
|
+
import { correct as l, incorrect as u } from "../common/styles.js";
|
|
11
11
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
12
12
|
// src/plot/line.tsx
|
|
13
|
-
var p =
|
|
14
|
-
stroke:
|
|
15
|
-
"&.correct":
|
|
16
|
-
"&.incorrect":
|
|
13
|
+
var p = i(n)(() => ({
|
|
14
|
+
stroke: s.visualElementsColors.PLOT_FILL_COLOR,
|
|
15
|
+
"&.correct": l("stroke"),
|
|
16
|
+
"&.incorrect": u("stroke")
|
|
17
17
|
})), m = (e) => {
|
|
18
|
-
let { index:
|
|
18
|
+
let { index: t, pointDiameter: n, barX: i, barWidth: a, pointHeight: o, label: c, value: l, scale: u, dottedOverline: m } = e, h = i + (a - n) / 2, g = u.y(t) - (o - n) / 2;
|
|
19
19
|
return m ? /* @__PURE__ */ d("rect", {
|
|
20
20
|
x: h - 2,
|
|
21
|
-
y: g -
|
|
22
|
-
width:
|
|
23
|
-
height:
|
|
21
|
+
y: g - n - 2,
|
|
22
|
+
width: n + 4,
|
|
23
|
+
height: n + 4,
|
|
24
24
|
strokeDasharray: "4,4",
|
|
25
|
-
stroke:
|
|
25
|
+
stroke: s.defaults.BORDER_GRAY,
|
|
26
26
|
fill: "none"
|
|
27
|
-
}, `point-${
|
|
27
|
+
}, `point-${c}-${l}-${t}`) : /* @__PURE__ */ f(r, { children: [/* @__PURE__ */ d(p, {
|
|
28
28
|
data: [{
|
|
29
29
|
x: h,
|
|
30
30
|
y: g
|
|
31
31
|
}, {
|
|
32
|
-
x: h +
|
|
33
|
-
y: g -
|
|
32
|
+
x: h + n,
|
|
33
|
+
y: g - n
|
|
34
34
|
}],
|
|
35
35
|
className: "line",
|
|
36
36
|
x: (e) => e.x,
|
|
37
37
|
y: (e) => e.y,
|
|
38
|
-
strokeWidth:
|
|
39
|
-
}, `point-${
|
|
38
|
+
strokeWidth: n / 5
|
|
39
|
+
}, `point-${c}-${l}-${t}-1`), /* @__PURE__ */ d(p, {
|
|
40
40
|
data: [{
|
|
41
41
|
x: h,
|
|
42
|
-
y: g -
|
|
42
|
+
y: g - n
|
|
43
43
|
}, {
|
|
44
|
-
x: h +
|
|
44
|
+
x: h + n,
|
|
45
45
|
y: g
|
|
46
46
|
}],
|
|
47
47
|
x: (e) => e.x,
|
|
48
48
|
y: (e) => e.y,
|
|
49
|
-
strokeWidth:
|
|
49
|
+
strokeWidth: n / 5,
|
|
50
50
|
className: "line"
|
|
51
|
-
}, `point-${
|
|
51
|
+
}, `point-${c}-${l}-${t}-2`)] });
|
|
52
52
|
};
|
|
53
53
|
m.propTypes = {
|
|
54
|
-
index:
|
|
55
|
-
pointDiameter:
|
|
56
|
-
barX:
|
|
57
|
-
barWidth:
|
|
58
|
-
pointHeight:
|
|
59
|
-
value:
|
|
60
|
-
label:
|
|
61
|
-
scale:
|
|
62
|
-
dottedOverline:
|
|
54
|
+
index: t.number,
|
|
55
|
+
pointDiameter: t.number,
|
|
56
|
+
barX: t.number,
|
|
57
|
+
barWidth: t.number,
|
|
58
|
+
pointHeight: t.number,
|
|
59
|
+
value: t.number,
|
|
60
|
+
label: t.string,
|
|
61
|
+
scale: t.object,
|
|
62
|
+
dottedOverline: t.bool
|
|
63
63
|
};
|
|
64
|
-
var h = class extends
|
|
64
|
+
var h = class extends e.Component {
|
|
65
65
|
static propTypes = {
|
|
66
|
-
data:
|
|
67
|
-
onChange:
|
|
68
|
-
graphProps:
|
|
66
|
+
data: t.array,
|
|
67
|
+
onChange: t.func,
|
|
68
|
+
graphProps: a.GraphPropsType.isRequired
|
|
69
69
|
};
|
|
70
70
|
render() {
|
|
71
|
-
let e = this.props, { data: t, graphProps:
|
|
72
|
-
return /* @__PURE__ */ d(
|
|
71
|
+
let e = this.props, { data: t, graphProps: n } = e, { scale: r = {}, size: i = {} } = n || {}, a = o(r.x, t, i.width, "linePlot");
|
|
72
|
+
return /* @__PURE__ */ d(c, {
|
|
73
73
|
...e,
|
|
74
|
-
xBand:
|
|
74
|
+
xBand: a,
|
|
75
75
|
CustomBarElement: m
|
|
76
76
|
});
|
|
77
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/charting",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.11-next.20261202142832",
|
|
4
4
|
"description": "charting",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"@mapbox/point-geometry": "^1.1.0",
|
|
15
15
|
"@mui/icons-material": "^7.3.4",
|
|
16
16
|
"@mui/material": "^7.3.4",
|
|
17
|
-
"@pie-element/shared-i18n": "0.1.
|
|
18
|
-
"@pie-element/shared-utils": "0.1.
|
|
19
|
-
"@pie-lib/plot": "5.0.
|
|
20
|
-
"@pie-lib/render-ui": "8.0.
|
|
17
|
+
"@pie-element/shared-i18n": "0.1.6-next.20261202142832",
|
|
18
|
+
"@pie-element/shared-utils": "0.1.10-next.20261202142832",
|
|
19
|
+
"@pie-lib/plot": "5.0.11-next.20261202142832",
|
|
20
|
+
"@pie-lib/render-ui": "8.0.11-next.20261202142832",
|
|
21
21
|
"@visx/axis": "^4.0.0",
|
|
22
22
|
"@visx/event": "^4.0.0",
|
|
23
23
|
"@visx/grid": "^4.0.0",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"invariant": "^2.2.4",
|
|
32
32
|
"react-draggable": "^4.7.2",
|
|
33
33
|
"prop-types": "^15.8.1",
|
|
34
|
-
"@pie-lib/config-ui": "14.0.
|
|
35
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.
|
|
36
|
-
"@pie-element/shared-lodash": "0.1.
|
|
34
|
+
"@pie-lib/config-ui": "14.0.11-next.20261202142832",
|
|
35
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.12-next.20261202142832",
|
|
36
|
+
"@pie-element/shared-lodash": "0.1.7-next.20261202142832",
|
|
37
37
|
"clsx": "^2.1.1",
|
|
38
38
|
"d3-time": "^3.1.1",
|
|
39
39
|
"d3-interpolate": "^3.0.2",
|