@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/axes.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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
|
|
15
|
-
import {
|
|
1
|
+
import e, { useEffect as t, useRef as n } from "react";
|
|
2
|
+
import r from "prop-types";
|
|
3
|
+
import { styled as i } from "@mui/material/styles";
|
|
4
|
+
import a from "./node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/AxisBottom.js";
|
|
5
|
+
import o from "./node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/AxisLeft.js";
|
|
6
|
+
import s from "@mui/material/Checkbox";
|
|
7
|
+
import { types as c } from "@pie-lib/plot";
|
|
8
|
+
import { color as l } from "@pie-lib/render-ui";
|
|
9
|
+
import { AlertDialog as u } from "@pie-lib/config-ui";
|
|
10
|
+
import { renderMath as d } from "@pie-element/shared-math-rendering-mathjax";
|
|
11
|
+
import { TickCorrectnessIndicator as f } from "./common/correctness-indicators.js";
|
|
12
|
+
import { bandKey as p, getRotateAngle as m, getRotatedLabelOverhang as h, getTickValues as g, textOf as _ } from "./utils.js";
|
|
13
|
+
import { MarkLabel as v } from "./mark-label.js";
|
|
14
|
+
import { catalogs as y } from "./i18n/index.js";
|
|
15
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
16
16
|
// src/axes.tsx
|
|
17
17
|
var S = 24, C = -110, w = 12, T = /* @__PURE__ */ new Set(), E = null;
|
|
18
18
|
function D(e) {
|
|
@@ -26,18 +26,18 @@ function D(e) {
|
|
|
26
26
|
function O(e) {
|
|
27
27
|
T.delete(e), T.size === 0 && E && (E.disconnect(), E = null);
|
|
28
28
|
}
|
|
29
|
-
var k =
|
|
29
|
+
var k = i("text")(({ theme: e }) => ({
|
|
30
30
|
fontSize: e.typography.fontSize - 2,
|
|
31
31
|
fill: e.palette.error.main
|
|
32
|
-
})), A =
|
|
32
|
+
})), A = i(s)(() => ({ color: `${l.tertiary()} !important` })), j = i("g")(({ theme: e }) => ({
|
|
33
33
|
"& .vx-axis-line": {
|
|
34
|
-
stroke:
|
|
34
|
+
stroke: l.visualElementsColors.AXIS_LINE_COLOR,
|
|
35
35
|
strokeWidth: 2
|
|
36
36
|
},
|
|
37
37
|
"& .vx-axis-tick": {
|
|
38
|
-
fill:
|
|
38
|
+
fill: l.visualElementsColors.AXIS_TICK_COLOR,
|
|
39
39
|
"& line": {
|
|
40
|
-
stroke:
|
|
40
|
+
stroke: l.visualElementsColors.AXIS_TICK_COLOR,
|
|
41
41
|
strokeWidth: 2
|
|
42
42
|
},
|
|
43
43
|
fontFamily: e.typography.body1?.fontFamily,
|
|
@@ -46,17 +46,17 @@ var k = m("text")(({ theme: e }) => ({
|
|
|
46
46
|
}
|
|
47
47
|
})), M = (e) => ({
|
|
48
48
|
borderRadius: e.spacing(2),
|
|
49
|
-
color:
|
|
49
|
+
color: l.defaults.WHITE,
|
|
50
50
|
fontSize: "16px",
|
|
51
51
|
width: "16px",
|
|
52
52
|
height: "16px",
|
|
53
53
|
padding: "2px",
|
|
54
|
-
border: `1px solid ${
|
|
54
|
+
border: `1px solid ${l.defaults.WHITE}`,
|
|
55
55
|
boxSizing: "unset"
|
|
56
|
-
}), N = { backgroundColor:
|
|
56
|
+
}), N = { backgroundColor: l.incorrectWithIcon() }, P = { backgroundColor: l.correct() }, F = class extends e.Component {
|
|
57
57
|
static propTypes = {
|
|
58
|
-
defineChart:
|
|
59
|
-
error:
|
|
58
|
+
defineChart: r.bool,
|
|
59
|
+
error: r.any
|
|
60
60
|
};
|
|
61
61
|
relabel = () => this.forceUpdate();
|
|
62
62
|
constructor(e) {
|
|
@@ -67,9 +67,9 @@ var k = m("text")(({ theme: e }) => ({
|
|
|
67
67
|
}
|
|
68
68
|
handleAlertDialog = (e, t) => this.setState({ dialog: { open: e } }, t);
|
|
69
69
|
changeCategory = (e, t) => {
|
|
70
|
-
let { categories: n, onChangeCategory: r } = this.props
|
|
70
|
+
let { categories: n, onChangeCategory: r } = this.props;
|
|
71
71
|
r(e, {
|
|
72
|
-
...
|
|
72
|
+
...n[e],
|
|
73
73
|
label: t
|
|
74
74
|
});
|
|
75
75
|
};
|
|
@@ -114,137 +114,137 @@ var k = m("text")(({ theme: e }) => ({
|
|
|
114
114
|
return n;
|
|
115
115
|
};
|
|
116
116
|
render() {
|
|
117
|
-
let { categories: e, xBand: t, bandWidth:
|
|
118
|
-
if (!
|
|
117
|
+
let { categories: e, xBand: t, bandWidth: n, barWidth: r, rotate: i, top: a, graphProps: o, defineChart: s, chartingOptions: c, x: l, y: d, formattedValue: m, changeInteractiveEnabled: h, changeEditableEnabled: g, error: S, autoFocus: T, hiddenLabelRef: E, showCorrectness: D, language: O } = this.props;
|
|
118
|
+
if (!m) return null;
|
|
119
119
|
let j = {
|
|
120
120
|
correctnessIcon: M,
|
|
121
121
|
incorrectIcon: N,
|
|
122
122
|
correctIcon: P
|
|
123
|
-
}, { dialog: F } = this.state, { changeEditable: I, changeInteractive: L } =
|
|
124
|
-
return /* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
x:
|
|
123
|
+
}, { dialog: F } = this.state, { changeEditable: I, changeInteractive: L } = c || {}, R = parseInt(m.split("-")[0], 10), z = e[R], { editable: B, interactive: V, label: H, correctness: U } = z || {}, W = t(p({ label: H }, R)), G = (e || []).reduce((e, t) => (e && e.label ? e.label.length : 0) > (t && t.label ? t.label.length : 0) ? e : t, { label: "" }), K = S ? [...new Set(Object.values(S))].join(" ") : "", q = y.forLocale(O, this.relabel);
|
|
124
|
+
return /* @__PURE__ */ x("g", { children: [
|
|
125
|
+
/* @__PURE__ */ x("foreignObject", {
|
|
126
|
+
x: n ? W : l - r / 2,
|
|
127
127
|
y: 18,
|
|
128
|
-
width:
|
|
128
|
+
width: r,
|
|
129
129
|
height: 4,
|
|
130
130
|
style: {
|
|
131
131
|
pointerEvents: "none",
|
|
132
132
|
overflow: "visible"
|
|
133
133
|
},
|
|
134
|
-
children: [R === 0 && /* @__PURE__ */ v
|
|
134
|
+
children: [R === 0 && /* @__PURE__ */ b(v, {
|
|
135
135
|
isHiddenLabel: !0,
|
|
136
136
|
inputRef: E,
|
|
137
137
|
disabled: !0,
|
|
138
138
|
mark: G,
|
|
139
|
-
graphProps:
|
|
140
|
-
barWidth:
|
|
141
|
-
}), /* @__PURE__ */ v
|
|
142
|
-
autoFocus:
|
|
139
|
+
graphProps: o,
|
|
140
|
+
barWidth: r
|
|
141
|
+
}), /* @__PURE__ */ b(v, {
|
|
142
|
+
autoFocus: s && T,
|
|
143
143
|
inputRef: (e) => this.input = e,
|
|
144
|
-
disabled: !
|
|
144
|
+
disabled: !s && !B,
|
|
145
145
|
mark: z,
|
|
146
|
-
graphProps:
|
|
146
|
+
graphProps: o,
|
|
147
147
|
onChange: (e) => this.changeCategory(R, e),
|
|
148
|
-
barWidth:
|
|
149
|
-
rotate:
|
|
148
|
+
barWidth: r,
|
|
149
|
+
rotate: i,
|
|
150
150
|
correctness: U,
|
|
151
151
|
error: S && S[R],
|
|
152
152
|
ariaLabel: q.t("categoryLabel", { index: R + 1 }),
|
|
153
153
|
mathAriaLabel: q.t("categoryLabelValue", {
|
|
154
154
|
index: R + 1,
|
|
155
|
-
label:
|
|
155
|
+
label: _(H)
|
|
156
156
|
}),
|
|
157
157
|
limitCharacters: !0,
|
|
158
|
-
correctnessIndicator: D && U && /* @__PURE__ */
|
|
158
|
+
correctnessIndicator: D && U && /* @__PURE__ */ b(f, {
|
|
159
159
|
correctness: U,
|
|
160
160
|
interactive: V,
|
|
161
161
|
classes: j
|
|
162
162
|
})
|
|
163
163
|
})]
|
|
164
164
|
}),
|
|
165
|
-
S && R === 0 && /* @__PURE__ */
|
|
166
|
-
y:
|
|
165
|
+
S && R === 0 && /* @__PURE__ */ b(k, {
|
|
166
|
+
y: d + 23,
|
|
167
167
|
height: 6,
|
|
168
168
|
textAnchor: "start",
|
|
169
169
|
children: K
|
|
170
170
|
}),
|
|
171
|
-
|
|
171
|
+
s && R === 0 && /* @__PURE__ */ x("svg", {
|
|
172
172
|
x: C,
|
|
173
173
|
style: { overflow: "visible" },
|
|
174
|
-
children: [
|
|
175
|
-
y:
|
|
176
|
-
width:
|
|
174
|
+
children: [h && /* @__PURE__ */ b("text", {
|
|
175
|
+
y: d + 90 + a,
|
|
176
|
+
width: r,
|
|
177
177
|
height: 4,
|
|
178
178
|
style: {
|
|
179
179
|
position: "absolute",
|
|
180
180
|
pointerEvents: "none",
|
|
181
181
|
wordBreak: "break-word",
|
|
182
|
-
maxWidth:
|
|
182
|
+
maxWidth: r,
|
|
183
183
|
display: "inline-block"
|
|
184
184
|
},
|
|
185
|
-
children: this.splitText(L?.authoringLabel, w).map((e, t) => /* @__PURE__ */
|
|
185
|
+
children: this.splitText(L?.authoringLabel, w).map((e, t) => /* @__PURE__ */ b("tspan", {
|
|
186
186
|
x: "0",
|
|
187
187
|
dy: `${t > 0 ? "1.2em" : ".6em"}`,
|
|
188
188
|
children: e
|
|
189
189
|
}, t))
|
|
190
|
-
}),
|
|
191
|
-
y:
|
|
192
|
-
width:
|
|
190
|
+
}), g && /* @__PURE__ */ b("text", {
|
|
191
|
+
y: d + 145 + a,
|
|
192
|
+
width: r,
|
|
193
193
|
height: 4,
|
|
194
194
|
style: {
|
|
195
195
|
position: "absolute",
|
|
196
196
|
pointerEvents: "none",
|
|
197
197
|
wordBreak: "break-word",
|
|
198
|
-
maxWidth:
|
|
198
|
+
maxWidth: r,
|
|
199
199
|
display: "inline-block"
|
|
200
200
|
},
|
|
201
|
-
children: this.splitText(I?.authoringLabel, w).map((e, t) => /* @__PURE__ */
|
|
201
|
+
children: this.splitText(I?.authoringLabel, w).map((e, t) => /* @__PURE__ */ b("tspan", {
|
|
202
202
|
x: "0",
|
|
203
203
|
dy: `${t > 0 ? "1.2em" : ".6em"}`,
|
|
204
204
|
children: e
|
|
205
205
|
}, t))
|
|
206
206
|
})]
|
|
207
207
|
}),
|
|
208
|
-
|
|
209
|
-
x:
|
|
210
|
-
y:
|
|
211
|
-
width:
|
|
208
|
+
s && h && /* @__PURE__ */ b("foreignObject", {
|
|
209
|
+
x: l - 24,
|
|
210
|
+
y: d + 80 + a,
|
|
211
|
+
width: r,
|
|
212
212
|
height: 4,
|
|
213
213
|
style: {
|
|
214
214
|
pointerEvents: "visible",
|
|
215
215
|
overflow: "visible"
|
|
216
216
|
},
|
|
217
|
-
children: /* @__PURE__ */
|
|
217
|
+
children: /* @__PURE__ */ b(A, {
|
|
218
218
|
style: { position: "fixed" },
|
|
219
219
|
checked: V,
|
|
220
220
|
onChange: (e) => this.changeInteractive(R, e.target.checked)
|
|
221
221
|
})
|
|
222
222
|
}),
|
|
223
|
-
|
|
224
|
-
x:
|
|
225
|
-
y:
|
|
226
|
-
width:
|
|
223
|
+
s && g && /* @__PURE__ */ b("foreignObject", {
|
|
224
|
+
x: l - 24,
|
|
225
|
+
y: d + 130 + a,
|
|
226
|
+
width: r,
|
|
227
227
|
height: 4,
|
|
228
228
|
style: {
|
|
229
229
|
pointerEvents: "visible",
|
|
230
230
|
overflow: "visible"
|
|
231
231
|
},
|
|
232
|
-
children: /* @__PURE__ */
|
|
232
|
+
children: /* @__PURE__ */ b(A, {
|
|
233
233
|
style: { position: "fixed" },
|
|
234
234
|
checked: B,
|
|
235
235
|
onChange: (e) => this.changeEditable(R, e.target.checked)
|
|
236
236
|
})
|
|
237
237
|
}),
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
x:
|
|
240
|
-
y:
|
|
241
|
-
width:
|
|
238
|
+
/* @__PURE__ */ b("foreignObject", {
|
|
239
|
+
x: l - 24,
|
|
240
|
+
y: d + 100 + a,
|
|
241
|
+
width: r,
|
|
242
242
|
height: 4,
|
|
243
243
|
style: {
|
|
244
244
|
pointerEvents: "visible",
|
|
245
245
|
overflow: "visible"
|
|
246
246
|
},
|
|
247
|
-
children: /* @__PURE__ */
|
|
247
|
+
children: /* @__PURE__ */ b(u, {
|
|
248
248
|
open: F.open,
|
|
249
249
|
title: F.title,
|
|
250
250
|
text: F.text,
|
|
@@ -256,84 +256,84 @@ var k = m("text")(({ theme: e }) => ({
|
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
258
|
F.propTypes = {
|
|
259
|
-
categories:
|
|
260
|
-
xBand:
|
|
261
|
-
bandWidth:
|
|
262
|
-
barWidth:
|
|
263
|
-
rotate:
|
|
264
|
-
top:
|
|
265
|
-
x:
|
|
266
|
-
y:
|
|
267
|
-
graphProps:
|
|
268
|
-
formattedValue:
|
|
269
|
-
onChangeCategory:
|
|
270
|
-
onChange:
|
|
271
|
-
error:
|
|
272
|
-
defineChart:
|
|
273
|
-
chartingOptions:
|
|
274
|
-
changeInteractiveEnabled:
|
|
275
|
-
changeEditableEnabled:
|
|
276
|
-
autoFocus:
|
|
277
|
-
onAutoFocusUsed:
|
|
278
|
-
showCorrectness:
|
|
279
|
-
hiddenLabelRef:
|
|
280
|
-
language:
|
|
259
|
+
categories: r.array,
|
|
260
|
+
xBand: r.func,
|
|
261
|
+
bandWidth: r.number,
|
|
262
|
+
barWidth: r.number,
|
|
263
|
+
rotate: r.number,
|
|
264
|
+
top: r.number,
|
|
265
|
+
x: r.number,
|
|
266
|
+
y: r.number,
|
|
267
|
+
graphProps: r.object,
|
|
268
|
+
formattedValue: r.string,
|
|
269
|
+
onChangeCategory: r.func,
|
|
270
|
+
onChange: r.func,
|
|
271
|
+
error: r.object,
|
|
272
|
+
defineChart: r.bool,
|
|
273
|
+
chartingOptions: r.object,
|
|
274
|
+
changeInteractiveEnabled: r.bool,
|
|
275
|
+
changeEditableEnabled: r.bool,
|
|
276
|
+
autoFocus: r.bool,
|
|
277
|
+
onAutoFocusUsed: r.func,
|
|
278
|
+
showCorrectness: r.bool,
|
|
279
|
+
hiddenLabelRef: r.oneOfType([r.func, r.shape({ current: r.instanceOf(Element) })]),
|
|
280
|
+
language: r.string
|
|
281
281
|
};
|
|
282
|
-
var I = 80, L = 6, R = 18, z =
|
|
282
|
+
var I = 80, L = 6, R = 18, z = i("div")(({ theme: e }) => ({
|
|
283
283
|
textAlign: "right",
|
|
284
284
|
fontSize: e.typography.fontSize + 2,
|
|
285
285
|
fontFamily: e.typography.fontFamily,
|
|
286
|
-
color:
|
|
286
|
+
color: l.defaults.TEXT,
|
|
287
287
|
lineHeight: 1
|
|
288
|
-
})), B = ({ x: e, y:
|
|
289
|
-
let
|
|
290
|
-
return
|
|
291
|
-
let e =
|
|
292
|
-
e && (e.textContent =
|
|
293
|
-
}, [
|
|
288
|
+
})), B = ({ x: e, y: r, formattedValue: i }) => {
|
|
289
|
+
let a = n(null), o = `\\(${i}\\)`;
|
|
290
|
+
return t(() => {
|
|
291
|
+
let e = a.current;
|
|
292
|
+
e && (e.textContent = o, d(e));
|
|
293
|
+
}, [o]), /* @__PURE__ */ b("foreignObject", {
|
|
294
294
|
x: e - L - I,
|
|
295
|
-
y:
|
|
295
|
+
y: r,
|
|
296
296
|
width: I,
|
|
297
297
|
height: 1,
|
|
298
298
|
style: {
|
|
299
299
|
pointerEvents: "none",
|
|
300
300
|
overflow: "visible"
|
|
301
301
|
},
|
|
302
|
-
children: /* @__PURE__ */
|
|
303
|
-
ref:
|
|
302
|
+
children: /* @__PURE__ */ b(z, {
|
|
303
|
+
ref: a,
|
|
304
304
|
"data-range-label": !0,
|
|
305
305
|
style: { transform: "translateY(-50%)" }
|
|
306
306
|
})
|
|
307
307
|
});
|
|
308
308
|
};
|
|
309
309
|
B.propTypes = {
|
|
310
|
-
x:
|
|
311
|
-
y:
|
|
312
|
-
formattedValue:
|
|
310
|
+
x: r.number,
|
|
311
|
+
y: r.number,
|
|
312
|
+
formattedValue: r.string
|
|
313
313
|
};
|
|
314
|
-
var V = (e) => /* @__PURE__ */
|
|
314
|
+
var V = (e) => /* @__PURE__ */ b(B, { ...e }), H = class extends e.Component {
|
|
315
315
|
static propTypes = {
|
|
316
|
-
bottomScale:
|
|
317
|
-
categories:
|
|
318
|
-
defineChart:
|
|
319
|
-
error:
|
|
320
|
-
graphProps:
|
|
321
|
-
xBand:
|
|
322
|
-
leftAxis:
|
|
323
|
-
onChange:
|
|
324
|
-
onChangeCategory:
|
|
325
|
-
top:
|
|
326
|
-
theme:
|
|
327
|
-
chartingOptions:
|
|
328
|
-
changeInteractiveEnabled:
|
|
329
|
-
changeEditableEnabled:
|
|
330
|
-
autoFocus:
|
|
331
|
-
onAutoFocusUsed:
|
|
332
|
-
showCorrectness:
|
|
333
|
-
hiddenLabelRef:
|
|
334
|
-
language:
|
|
335
|
-
onLabelOverhang:
|
|
336
|
-
onRangeLabelOverhang:
|
|
316
|
+
bottomScale: r.func,
|
|
317
|
+
categories: r.array,
|
|
318
|
+
defineChart: r.bool,
|
|
319
|
+
error: r.any,
|
|
320
|
+
graphProps: c.GraphPropsType.isRequired,
|
|
321
|
+
xBand: r.func,
|
|
322
|
+
leftAxis: r.bool,
|
|
323
|
+
onChange: r.func,
|
|
324
|
+
onChangeCategory: r.func,
|
|
325
|
+
top: r.number,
|
|
326
|
+
theme: r.object,
|
|
327
|
+
chartingOptions: r.object,
|
|
328
|
+
changeInteractiveEnabled: r.bool,
|
|
329
|
+
changeEditableEnabled: r.bool,
|
|
330
|
+
autoFocus: r.bool,
|
|
331
|
+
onAutoFocusUsed: r.func,
|
|
332
|
+
showCorrectness: r.bool,
|
|
333
|
+
hiddenLabelRef: r.oneOfType([r.func, r.shape({ current: r.instanceOf(Element) })]),
|
|
334
|
+
language: r.string,
|
|
335
|
+
onLabelOverhang: r.func,
|
|
336
|
+
onRangeLabelOverhang: r.func
|
|
337
337
|
};
|
|
338
338
|
state = {
|
|
339
339
|
height: 0,
|
|
@@ -344,15 +344,15 @@ var V = (e) => /* @__PURE__ */ v(B, { ...e }), H = class extends u.Component {
|
|
|
344
344
|
reportedOverhang = 0;
|
|
345
345
|
reportedRangeOverhang = 0;
|
|
346
346
|
labelLayout = () => {
|
|
347
|
-
let { graphProps: e, xBand: t, categories: n = [], theme: r } = this.props, { scale:
|
|
347
|
+
let { graphProps: e, xBand: t, categories: n = [], theme: r } = this.props, { scale: i = {}, domain: a = {} } = e || {}, { height: o, width: s } = this.state, c = t && typeof t.bandwidth == "function" && t.bandwidth(), l = c || i.x && i.x(a.max) / n.length, u = r && r.typography ? r.typography.fontSize : 14;
|
|
348
348
|
return {
|
|
349
|
-
bandWidth:
|
|
350
|
-
barWidth:
|
|
351
|
-
rotate:
|
|
349
|
+
bandWidth: c,
|
|
350
|
+
barWidth: l,
|
|
351
|
+
rotate: m(u, o) || (s > l ? 25 : 0)
|
|
352
352
|
};
|
|
353
353
|
};
|
|
354
354
|
reportLabelOverhang = () => {
|
|
355
|
-
let { onLabelOverhang: e } = this.props, { height: t, width: n, labelHeight: r } = this.state, i =
|
|
355
|
+
let { onLabelOverhang: e } = this.props, { height: t, width: n, labelHeight: r } = this.state, i = h(n, t, this.labelLayout().rotate) + Math.max(0, r - S);
|
|
356
356
|
e && i !== this.reportedOverhang && (this.reportedOverhang = i, e(i));
|
|
357
357
|
};
|
|
358
358
|
reportRangeLabelOverhang = () => {
|
|
@@ -379,7 +379,7 @@ var V = (e) => /* @__PURE__ */ v(B, { ...e }), H = class extends u.Component {
|
|
|
379
379
|
observeHiddenLabel = (e) => {
|
|
380
380
|
if (!e) return;
|
|
381
381
|
let t = e.querySelector("[data-latex], [data-raw]");
|
|
382
|
-
t &&
|
|
382
|
+
t && d(e), (e.querySelector("mjx-container") || !t) && this.measureHiddenLabel(), D(this._onDocMutation), this.observeHiddenLabelSize(e);
|
|
383
383
|
};
|
|
384
384
|
observeHiddenLabelSize = (e) => {
|
|
385
385
|
e !== this._sizedLabel && typeof ResizeObserver < "u" && (this._sizeObserver?.disconnect(), this._sizedLabel = e, this._sizeObserver = new ResizeObserver(() => this.measureHiddenLabel()), this._sizeObserver.observe(e));
|
|
@@ -397,53 +397,53 @@ var V = (e) => /* @__PURE__ */ v(B, { ...e }), H = class extends u.Component {
|
|
|
397
397
|
e.categories !== this.props.categories && (this._updateTimer && clearTimeout(this._updateTimer), this._updateTimer = setTimeout(() => this.measureHiddenLabel(), 50)), this.reportLabelOverhang(), this.reportRangeLabelOverhang();
|
|
398
398
|
}
|
|
399
399
|
render() {
|
|
400
|
-
let { graphProps:
|
|
400
|
+
let { graphProps: e, xBand: t, leftAxis: n, onChange: r, onChangeCategory: i, categories: s = [], top: c, defineChart: l, chartingOptions: u, changeInteractiveEnabled: d, changeEditableEnabled: f, autoFocus: p, onAutoFocusUsed: m, error: h, showCorrectness: _, language: v } = this.props, { scale: y = {}, range: S = {}, size: C = {} } = e || {}, w = t && typeof t.rangeRound == "function" && t.rangeRound([0, C.width]), { bandWidth: T, barWidth: E, rotate: D } = this.labelLayout(), O = g({
|
|
401
401
|
...S,
|
|
402
402
|
step: S.labelStep
|
|
403
403
|
});
|
|
404
|
-
return /* @__PURE__ */
|
|
404
|
+
return /* @__PURE__ */ x(j, {
|
|
405
405
|
ref: (e) => this.axesNode = e,
|
|
406
|
-
children: [
|
|
407
|
-
scale:
|
|
406
|
+
children: [n && /* @__PURE__ */ b(o, {
|
|
407
|
+
scale: y.y,
|
|
408
408
|
tickLength: 10,
|
|
409
409
|
tickFormat: (e) => `${e}`,
|
|
410
410
|
tickValues: O,
|
|
411
411
|
tickComponent: V
|
|
412
|
-
}), /* @__PURE__ */
|
|
412
|
+
}), /* @__PURE__ */ b(a, {
|
|
413
413
|
scale: w,
|
|
414
|
-
labelProps: { y: 60 +
|
|
415
|
-
top:
|
|
414
|
+
labelProps: { y: 60 + c },
|
|
415
|
+
top: y.y && y.y(S.min),
|
|
416
416
|
textLabelProps: () => ({ textAnchor: "middle" }),
|
|
417
417
|
tickFormat: (e) => e,
|
|
418
|
-
tickComponent: (
|
|
419
|
-
let
|
|
418
|
+
tickComponent: (n) => {
|
|
419
|
+
let a = {
|
|
420
420
|
hiddenLabelRef: this.setHiddenLabelRef,
|
|
421
|
-
categories:
|
|
422
|
-
xBand:
|
|
421
|
+
categories: s,
|
|
422
|
+
xBand: t,
|
|
423
423
|
bandWidth: T,
|
|
424
424
|
barWidth: E,
|
|
425
425
|
rotate: D,
|
|
426
|
-
top:
|
|
427
|
-
defineChart:
|
|
428
|
-
chartingOptions:
|
|
429
|
-
autoFocus:
|
|
430
|
-
onAutoFocusUsed:
|
|
431
|
-
error:
|
|
432
|
-
onChangeCategory:
|
|
433
|
-
changeInteractiveEnabled:
|
|
434
|
-
changeEditableEnabled:
|
|
435
|
-
onChange:
|
|
436
|
-
graphProps:
|
|
437
|
-
x:
|
|
438
|
-
y:
|
|
439
|
-
formattedValue:
|
|
426
|
+
top: c,
|
|
427
|
+
defineChart: l,
|
|
428
|
+
chartingOptions: u,
|
|
429
|
+
autoFocus: p,
|
|
430
|
+
onAutoFocusUsed: m,
|
|
431
|
+
error: h,
|
|
432
|
+
onChangeCategory: i,
|
|
433
|
+
changeInteractiveEnabled: d,
|
|
434
|
+
changeEditableEnabled: f,
|
|
435
|
+
onChange: r,
|
|
436
|
+
graphProps: e,
|
|
437
|
+
x: n.x,
|
|
438
|
+
y: n.y,
|
|
439
|
+
formattedValue: n.formattedValue,
|
|
440
440
|
showCorrectness: _,
|
|
441
|
-
language:
|
|
441
|
+
language: v
|
|
442
442
|
};
|
|
443
|
-
return /* @__PURE__ */
|
|
443
|
+
return /* @__PURE__ */ b(F, { ...a });
|
|
444
444
|
},
|
|
445
|
-
autoFocus:
|
|
446
|
-
onAutoFocusUsed:
|
|
445
|
+
autoFocus: p,
|
|
446
|
+
onAutoFocusUsed: m
|
|
447
447
|
})]
|
|
448
448
|
});
|
|
449
449
|
}
|
package/dist/bars/bar.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import {
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { types as n } from "@pie-lib/plot";
|
|
4
|
+
import { dataToXBand as r } from "../utils.js";
|
|
5
|
+
import { Bars as i } from "./common/bars.js";
|
|
6
6
|
import { jsx as a } from "react/jsx-runtime";
|
|
7
7
|
// src/bars/bar.tsx
|
|
8
|
-
var o = class extends
|
|
8
|
+
var o = class extends e.Component {
|
|
9
9
|
static propTypes = {
|
|
10
|
-
data:
|
|
11
|
-
onChange:
|
|
12
|
-
graphProps:
|
|
10
|
+
data: t.array,
|
|
11
|
+
onChange: t.func,
|
|
12
|
+
graphProps: n.GraphPropsType.isRequired
|
|
13
13
|
};
|
|
14
14
|
render() {
|
|
15
|
-
let
|
|
16
|
-
return /* @__PURE__ */ a(
|
|
17
|
-
...
|
|
15
|
+
let e = this.props, { data: t, graphProps: n } = e, { scale: o = {}, size: s = {} } = n || {}, c = r(o.x, t, s.width, "bar");
|
|
16
|
+
return /* @__PURE__ */ a(i, {
|
|
17
|
+
...e,
|
|
18
18
|
xBand: c
|
|
19
19
|
});
|
|
20
20
|
}
|