@sia.soul/sia-react-ui 0.1.3 → 0.1.4

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.
Files changed (44) hide show
  1. package/dist/{Select-CJJ5LQap.d.ts → Select-GiTHMScg.d.cts} +4 -5
  2. package/dist/{Select-CJJ5LQap.d.cts → Select-rtDktLYY.d.ts} +4 -5
  3. package/dist/chart.cjs +731 -707
  4. package/dist/chart.css +1 -1
  5. package/dist/chart.js +3 -2
  6. package/dist/{chunk-6VXOLMKZ.js → chunk-5ZTWY3PG.js} +18 -1
  7. package/dist/{chunk-2RRTDU3N.js → chunk-EJ23MVR6.js} +3 -18
  8. package/dist/chunk-EJDPRAU2.js +36 -0
  9. package/dist/{chunk-IMZT6VCU.js → chunk-IHTODT53.js} +8 -5
  10. package/dist/{chunk-R4OWKIXJ.js → chunk-MJUTLEEE.js} +20 -8
  11. package/dist/{chunk-OQLDEVCF.js → chunk-PX6BOFTW.js} +10 -3
  12. package/dist/{chunk-OAC7BSUR.js → chunk-R7BVDN3Q.js} +91 -43
  13. package/dist/{chunk-Q4XNFMUH.js → chunk-S2JAJCLN.js} +6 -4
  14. package/dist/{chunk-NZAT2RUM.js → chunk-WHARTF2I.js} +10 -1
  15. package/dist/{chunk-I342FGQY.js → chunk-Z3T6RDQP.js} +1 -1
  16. package/dist/{core-DFYheaoJ.d.ts → core-CBtbeAms.d.cts} +2 -1
  17. package/dist/{core-De2pRX5w.d.cts → core-D8BSMfHD.d.ts} +2 -1
  18. package/dist/core.cjs +275 -210
  19. package/dist/core.css +211 -27
  20. package/dist/core.d.cts +3 -2
  21. package/dist/core.d.ts +3 -2
  22. package/dist/core.js +6 -5
  23. package/dist/index.cjs +2531 -2412
  24. package/dist/index.css +212 -28
  25. package/dist/index.d.cts +17 -9
  26. package/dist/index.d.ts +17 -9
  27. package/dist/index.js +224 -190
  28. package/dist/markdown-editor.cjs +52 -20
  29. package/dist/markdown-editor.d.cts +3 -1
  30. package/dist/markdown-editor.d.ts +3 -1
  31. package/dist/markdown-editor.js +2 -1
  32. package/dist/rich-text-editor.cjs +884 -864
  33. package/dist/rich-text-editor.d.cts +3 -1
  34. package/dist/rich-text-editor.d.ts +3 -1
  35. package/dist/rich-text-editor.js +4 -3
  36. package/dist/{select-date-range-DOyG1DGp.d.ts → select-date-range-CQ1vmze_.d.ts} +7 -4
  37. package/dist/{select-date-range-UyYrHex6.d.cts → select-date-range-DRmGaEzP.d.cts} +7 -4
  38. package/dist/select-date-range.cjs +972 -903
  39. package/dist/select-date-range.d.cts +3 -2
  40. package/dist/select-date-range.d.ts +3 -2
  41. package/dist/select-date-range.js +4 -3
  42. package/dist/shared-DAYZvZVu.d.cts +5 -0
  43. package/dist/shared-DAYZvZVu.d.ts +5 -0
  44. package/package.json +1 -1
package/dist/chart.cjs CHANGED
@@ -1996,10 +1996,10 @@ function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
1996
1996
  }
1997
1997
 
1998
1998
  // src/components/LineShareChart.tsx
1999
- var import_react36 = require("react");
1999
+ var import_react37 = require("react");
2000
2000
 
2001
2001
  // src/components/Charts.tsx
2002
- var import_react34 = require("react");
2002
+ var import_react35 = require("react");
2003
2003
 
2004
2004
  // src/components/ChartScatterMotion.tsx
2005
2005
  var import_react15 = require("react");
@@ -3950,7 +3950,7 @@ function layoutTreeNodes(root, options = {}) {
3950
3950
  }
3951
3951
 
3952
3952
  // src/components/ChartDataEditor.tsx
3953
- var import_react30 = require("react");
3953
+ var import_react31 = require("react");
3954
3954
 
3955
3955
  // src/components/Button.tsx
3956
3956
  var import_react28 = require("react");
@@ -4008,14 +4008,35 @@ var Button = (0, import_react28.forwardRef)(function Button2({
4008
4008
  );
4009
4009
  });
4010
4010
 
4011
- // src/components/TextArea.tsx
4011
+ // src/components/shared.ts
4012
4012
  var import_react29 = require("react");
4013
+ var PlaceholderModeContext = (0, import_react29.createContext)("default");
4014
+ function usePlaceholderMode(mode) {
4015
+ const inherited = (0, import_react29.useContext)(PlaceholderModeContext);
4016
+ return mode ?? inherited;
4017
+ }
4018
+
4019
+ // src/components/FloatingPlaceholder.tsx
4013
4020
  var import_jsx_runtime29 = require("react/jsx-runtime");
4014
- var TextArea = (0, import_react29.forwardRef)(function TextArea2({
4021
+ function useFloatingPlaceholder({ mode, placeholder, filled, active = false }) {
4022
+ const enabled = usePlaceholderMode(mode) === "floating" && Boolean(placeholder);
4023
+ return {
4024
+ enabled,
4025
+ className: enabled ? ` sia-placeholder-floating${filled ? " sia-placeholder-floating--filled" : ""}${active ? " sia-placeholder-floating--active" : ""}` : "",
4026
+ label: enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "sia-floating-placeholder", "aria-hidden": "true", children: placeholder }) : null
4027
+ };
4028
+ }
4029
+
4030
+ // src/components/TextArea.tsx
4031
+ var import_react30 = require("react");
4032
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4033
+ var TextArea = (0, import_react30.forwardRef)(function TextArea2({
4015
4034
  label,
4016
4035
  hint,
4017
4036
  status = "default",
4018
4037
  showCount = false,
4038
+ placeholder,
4039
+ placeholderMode,
4019
4040
  className = "",
4020
4041
  id,
4021
4042
  disabled,
@@ -4025,18 +4046,19 @@ var TextArea = (0, import_react29.forwardRef)(function TextArea2({
4025
4046
  onChange,
4026
4047
  ...props
4027
4048
  }, ref) {
4028
- const fallbackId = (0, import_react29.useId)();
4049
+ const fallbackId = (0, import_react30.useId)();
4029
4050
  const textAreaId = id ?? fallbackId;
4030
- const [uncontrolledValue, setUncontrolledValue] = (0, import_react29.useState)(() => defaultValue === void 0 ? "" : String(defaultValue));
4051
+ const [uncontrolledValue, setUncontrolledValue] = (0, import_react30.useState)(() => defaultValue === void 0 ? "" : String(defaultValue));
4031
4052
  const currentText = value !== void 0 ? String(value) : uncontrolledValue;
4053
+ const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: currentText.length > 0 });
4032
4054
  const hintId = `${textAreaId}-hint`;
4033
4055
  const describedBy = [props["aria-describedby"], hint ? hintId : null].filter(Boolean).join(" ") || void 0;
4034
4056
  function handleChange(event) {
4035
4057
  setUncontrolledValue(event.target.value);
4036
4058
  onChange?.(event);
4037
4059
  }
4038
- const control = /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${status}${disabled ? " is-disabled" : ""}`, children: [
4039
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4060
+ const control = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
4061
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4040
4062
  "textarea",
4041
4063
  {
4042
4064
  ...props,
@@ -4047,30 +4069,32 @@ var TextArea = (0, import_react29.forwardRef)(function TextArea2({
4047
4069
  value,
4048
4070
  defaultValue,
4049
4071
  maxLength,
4072
+ placeholder,
4050
4073
  "aria-describedby": describedBy,
4051
4074
  "aria-invalid": status === "error" || void 0,
4052
4075
  onChange: handleChange
4053
4076
  }
4054
4077
  ),
4055
- showCount ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: `sia-textarea-control__count${maxLength !== void 0 && currentText.length >= maxLength ? " is-limit" : ""}`, "aria-live": "polite", children: [
4078
+ floating.label,
4079
+ showCount ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: `sia-textarea-control__count${maxLength !== void 0 && currentText.length >= maxLength ? " is-limit" : ""}`, "aria-live": "polite", children: [
4056
4080
  currentText.length,
4057
4081
  maxLength !== void 0 ? `/${maxLength}` : null
4058
4082
  ] }) : null
4059
4083
  ] });
4060
- if (!label && !hint) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: `sia-field ${className}`.trim(), children: control });
4061
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: `sia-field ${className}`.trim(), children: [
4062
- label ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("label", { className: "sia-field__label", htmlFor: textAreaId, children: label }) : null,
4084
+ if (!label && !hint) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: `sia-field ${className}`.trim(), children: control });
4085
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: `sia-field ${className}`.trim(), children: [
4086
+ label ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { className: "sia-field__label", htmlFor: textAreaId, children: label }) : null,
4063
4087
  control,
4064
- hint ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { id: hintId, className: `sia-field__hint sia-field__hint--${status}`, children: hint }) : null
4088
+ hint ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { id: hintId, className: `sia-field__hint sia-field__hint--${status}`, children: hint }) : null
4065
4089
  ] });
4066
4090
  });
4067
4091
 
4068
4092
  // src/components/ChartDataEditor.tsx
4069
- var import_jsx_runtime30 = require("react/jsx-runtime");
4093
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4070
4094
  function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false }) {
4071
- const [draft, setDraft] = (0, import_react30.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
4072
- const [error, setError] = (0, import_react30.useState)("");
4073
- const [applied, setApplied] = (0, import_react30.useState)(false);
4095
+ const [draft, setDraft] = (0, import_react31.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
4096
+ const [error, setError] = (0, import_react31.useState)("");
4097
+ const [applied, setApplied] = (0, import_react31.useState)(false);
4074
4098
  function apply() {
4075
4099
  try {
4076
4100
  const values = JSON.parse(draft);
@@ -4085,45 +4109,45 @@ function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false
4085
4109
  setApplied(false);
4086
4110
  }
4087
4111
  }
4088
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "sia-chart-data-editor", children: [
4089
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { children: [
4112
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "sia-chart-data-editor", children: [
4113
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("p", { children: [
4090
4114
  "\u7CFB\u5217\u987A\u5E8F\uFF1A",
4091
4115
  series.map((item) => item.name).join("\u3001")
4092
4116
  ] }),
4093
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TextArea, { "aria-label": "\u56FE\u8868\u6570\u503C\u6570\u636E", rows: 10, value: draft, readOnly, status: error ? "error" : "default", onChange: (event) => {
4117
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TextArea, { "aria-label": "\u56FE\u8868\u6570\u503C\u6570\u636E", rows: 10, value: draft, readOnly, status: error ? "error" : "default", onChange: (event) => {
4094
4118
  setDraft(event.target.value);
4095
4119
  setApplied(false);
4096
4120
  } }),
4097
- error ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", children: error }) : null,
4098
- !readOnly ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { onClick: apply, children: "\u5E94\u7528\u6570\u636E" }) : null,
4099
- applied ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "status", children: "\u6570\u636E\u5DF2\u5E94\u7528" }) : null
4121
+ error ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "alert", children: error }) : null,
4122
+ !readOnly ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Button, { onClick: apply, children: "\u5E94\u7528\u6570\u636E" }) : null,
4123
+ applied ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { role: "status", children: "\u6570\u636E\u5DF2\u5E94\u7528" }) : null
4100
4124
  ] });
4101
4125
  }
4102
4126
 
4103
4127
  // src/components/ChartBarStatistics.tsx
4104
- var import_react31 = require("react");
4105
- var import_jsx_runtime31 = require("react/jsx-runtime");
4128
+ var import_react32 = require("react");
4129
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4106
4130
  function ChartBarStatistics({ values, kinds, project, plot, horizontal, color, gradient, seriesName }) {
4107
- const id = (0, import_react31.useId)().replaceAll(":", "");
4108
- const [active, setActive] = (0, import_react31.useState)();
4131
+ const id = (0, import_react32.useId)().replaceAll(":", "");
4132
+ const [active, setActive] = (0, import_react32.useState)();
4109
4133
  const paint = gradient ? `url(#${id})` : color;
4110
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("g", { children: [
4111
- gradient ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("linearGradient", { id, gradientUnits: "userSpaceOnUse", x1: gradient.start[0], y1: gradient.start[1], x2: gradient.end[0], y2: gradient.end[1], children: gradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
4134
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4135
+ gradient ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("linearGradient", { id, gradientUnits: "userSpaceOnUse", x1: gradient.start[0], y1: gradient.start[1], x2: gradient.end[0], y2: gradient.end[1], children: gradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
4112
4136
  kinds.map((kind) => {
4113
4137
  const value = values[kind], position = project(value), label = String(Number(value.toFixed(2))), name = { average: "\u5E73\u5747\u503C", max: "\u6700\u5927\u503C", min: "\u6700\u5C0F\u503C" }[kind];
4114
4138
  const start = horizontal ? [position, plot.y] : [plot.x, position], end = horizontal ? [position, plot.y + plot.height] : [plot.x + plot.width, position];
4115
4139
  const width = active === kind ? 3.5 : 1.5;
4116
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(ChartMark, { "data-bar-statistic": kind, "data-bar-statistic-value": value, label: `${seriesName} ${name} ${label}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
4140
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { "data-bar-statistic": kind, "data-bar-statistic-value": value, label: `${seriesName} ${name} ${label}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4117
4141
  seriesName,
4118
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("br", {}),
4142
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("br", {}),
4119
4143
  name,
4120
4144
  "\uFF1A",
4121
4145
  label
4122
4146
  ] }), tooltipPoint: [end[0], end[1]], onPointerMove: () => setActive(kind), onPointerLeave: () => setActive(void 0), onFocus: () => setActive(kind), onBlur: () => setActive(void 0), children: [
4123
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: start[0], y1: start[1], x2: end[0], y2: end[1], stroke: paint, strokeWidth: width, strokeDasharray: "5 5" }),
4124
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("circle", { cx: start[0], cy: start[1], r: 2, fill: paint, stroke: paint, strokeWidth: width }),
4125
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { transform: `translate(${end[0]} ${end[1]})${horizontal ? " rotate(90)" : ""}`, d: "M0 0 L-8 -4 L-6 0 L-8 4 Z", fill: paint, stroke: paint, strokeWidth: width }),
4126
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("text", { x: end[0] + 6, y: end[1] + 4, fill: paint, style: { fontSize: 12, fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1, Arial, Verdana, sans-serif" }, children: label })
4147
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: start[0], y1: start[1], x2: end[0], y2: end[1], stroke: paint, strokeWidth: width, strokeDasharray: "5 5" }),
4148
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: start[0], cy: start[1], r: 2, fill: paint, stroke: paint, strokeWidth: width }),
4149
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { transform: `translate(${end[0]} ${end[1]})${horizontal ? " rotate(90)" : ""}`, d: "M0 0 L-8 -4 L-6 0 L-8 4 Z", fill: paint, stroke: paint, strokeWidth: width }),
4150
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: end[0] + 6, y: end[1] + 4, fill: paint, style: { fontSize: 12, fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1, Arial, Verdana, sans-serif" }, children: label })
4127
4151
  ] }, kind);
4128
4152
  })
4129
4153
  ] });
@@ -4160,7 +4184,7 @@ function lineSegments(points) {
4160
4184
  }
4161
4185
 
4162
4186
  // src/components/useBarMagicState.ts
4163
- var import_react32 = require("react");
4187
+ var import_react33 = require("react");
4164
4188
 
4165
4189
  // src/components/cartesianMagicState.ts
4166
4190
  function changeCartesianMagic(state, action) {
@@ -4175,8 +4199,8 @@ function changeCartesianMagic(state, action) {
4175
4199
  function useBarMagicState(toolbox, shape = "bar") {
4176
4200
  const initial3 = { shape, layout: "original" };
4177
4201
  const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
4178
- const [state, setState] = (0, import_react32.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
4179
- (0, import_react32.useEffect)(() => {
4202
+ const [state, setState] = (0, import_react33.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
4203
+ (0, import_react33.useEffect)(() => {
4180
4204
  if (options?.activeMagicType) setState((s) => changeCartesianMagic(s, options.activeMagicType));
4181
4205
  }, [options?.activeMagicType]);
4182
4206
  const resolved = options ? { ...options, activeMagicType: state.shape, activeMagicTypes: options.activeMagicTypes ?? (state.layout === "original" ? [state.shape] : [state.shape, state.layout]), onMagicTypeChange: (action) => {
@@ -4190,7 +4214,7 @@ function useBarMagicState(toolbox, shape = "bar") {
4190
4214
  }
4191
4215
 
4192
4216
  // src/components/useBarValueTransfer.ts
4193
- var import_react33 = require("react");
4217
+ var import_react34 = require("react");
4194
4218
 
4195
4219
  // src/components/barTransfer.ts
4196
4220
  function transferBarValue(series, source, target, categories) {
@@ -4207,10 +4231,10 @@ function transferBarValue(series, source, target, categories) {
4207
4231
 
4208
4232
  // src/components/useBarValueTransfer.ts
4209
4233
  function useBarValueTransfer(series, initial3, categories, enabled, publish, onError) {
4210
- const [islands, setIslands] = (0, import_react33.useState)([]);
4211
- const drag = (0, import_react33.useRef)();
4212
- const [offset, setOffset] = (0, import_react33.useState)();
4213
- (0, import_react33.useEffect)(() => {
4234
+ const [islands, setIslands] = (0, import_react34.useState)([]);
4235
+ const drag = (0, import_react34.useRef)();
4236
+ const [offset, setOffset] = (0, import_react34.useState)();
4237
+ (0, import_react34.useEffect)(() => {
4214
4238
  setIslands([]);
4215
4239
  drag.current = void 0;
4216
4240
  setOffset(void 0);
@@ -4310,13 +4334,13 @@ function logarithmicValueAt(progress, domain) {
4310
4334
  }
4311
4335
 
4312
4336
  // src/components/Charts.tsx
4313
- var import_jsx_runtime32 = require("react/jsx-runtime");
4314
- var import_react35 = require("react");
4337
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4338
+ var import_react36 = require("react");
4315
4339
  var PLOT = { x: 62, y: 48, width: 628, height: 250 };
4316
4340
  var PLOT_BOTTOM = PLOT.y + PLOT.height;
4317
4341
  function useLegendSelection(names, controlled, onChange) {
4318
- const [internal, setInternal] = (0, import_react34.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
4319
- (0, import_react34.useEffect)(() => {
4342
+ const [internal, setInternal] = (0, import_react35.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
4343
+ (0, import_react35.useEffect)(() => {
4320
4344
  setInternal((current) => {
4321
4345
  const next = { ...current };
4322
4346
  names.forEach((name) => {
@@ -4340,21 +4364,21 @@ function getColor(index, color, palette) {
4340
4364
  return color ?? chartColor(index, palette ?? DEFAULT_CHART_PALETTE);
4341
4365
  }
4342
4366
  function TooltipValue({ name, series, value, formatter }) {
4343
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4344
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: name }),
4345
- series ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: series }) : null,
4346
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("b", { children: formatter ? formatter(value) : formatChartNumber(value) })
4367
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4368
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: name }),
4369
+ series ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: series }) : null,
4370
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("b", { children: formatter ? formatter(value) : formatChartNumber(value) })
4347
4371
  ] });
4348
4372
  }
4349
4373
  function CartesianAxes({ categories, domain, band = false }) {
4350
4374
  const ticks = chartTicks(domain);
4351
4375
  const x = band ? categories.map((_, index) => PLOT.x + (index + 0.5) / Math.max(1, categories.length) * PLOT.width) : categories.map((_, index) => PLOT.x + index / Math.max(1, categories.length - 1) * PLOT.width);
4352
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4353
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { orientation: "left", x: PLOT.x, y: PLOT_BOTTOM, length: PLOT.height, labels: ticks.map(formatChartNumber), gridLength: PLOT.width }),
4354
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT.x, y1: PLOT_BOTTOM, x2: PLOT.x + PLOT.width, y2: PLOT_BOTTOM, className: "sia-chart__axis-line" }),
4355
- categories.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { "aria-hidden": "true", children: [
4356
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: x[index], y1: PLOT_BOTTOM, x2: x[index], y2: PLOT_BOTTOM + 5, className: "sia-chart__axis-line" }),
4357
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: x[index], y: PLOT_BOTTOM + 21, textAnchor: "middle", className: "sia-chart__axis-label", children: label })
4376
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4377
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { orientation: "left", x: PLOT.x, y: PLOT_BOTTOM, length: PLOT.height, labels: ticks.map(formatChartNumber), gridLength: PLOT.width }),
4378
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT.x, y1: PLOT_BOTTOM, x2: PLOT.x + PLOT.width, y2: PLOT_BOTTOM, className: "sia-chart__axis-line" }),
4379
+ categories.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { "aria-hidden": "true", children: [
4380
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: x[index], y1: PLOT_BOTTOM, x2: x[index], y2: PLOT_BOTTOM + 5, className: "sia-chart__axis-line" }),
4381
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: x[index], y: PLOT_BOTTOM + 21, textAnchor: "middle", className: "sia-chart__axis-label", children: label })
4358
4382
  ] }, `${label}-${index}`))
4359
4383
  ] });
4360
4384
  }
@@ -4405,18 +4429,18 @@ function logScale(value, domain, range) {
4405
4429
  return logarithmicScale(value, domain, range);
4406
4430
  }
4407
4431
  function lineSymbol(type, x, y, size, color, image, strokeWidth = 2) {
4408
- if (type === "image") return image ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("image", { "data-chart-symbol": "image", href: image, x: x - size / 2, y: y - size / 2, width: size, height: size, preserveAspectRatio: "none" }) : null;
4409
- if (type === "emptyCircle") return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: "#fff", stroke: color, strokeWidth: 2 });
4432
+ if (type === "image") return image ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("image", { "data-chart-symbol": "image", href: image, x: x - size / 2, y: y - size / 2, width: size, height: size, preserveAspectRatio: "none" }) : null;
4433
+ if (type === "emptyCircle") return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: "#fff", stroke: color, strokeWidth: 2 });
4410
4434
  const pathType = type === "emptyHeart" ? "heart" : type === "emptyPin" ? "pin" : type;
4411
- if (pathType && ["heart", "droplet", "pin", "arrow"].includes(pathType)) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { "data-chart-symbol": type, d: chartMarkerPath(pathType, x, y, size), fill: type?.startsWith("empty") ? "#fff" : color, stroke: color, strokeWidth });
4412
- if (type === "star" || type === "star6") return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { "data-chart-symbol": type, points: chartStarPoints(x, y, size, type === "star" ? 5 : 6).map((p) => p.join(",")).join(" "), fill: color, stroke: color, strokeWidth });
4413
- if (type === "none") return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: x, cy: y, r: Math.max(6, size), fill: "transparent" });
4414
- if (type === "square") return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: x - size / 2, y: y - size / 2, width: size, height: size, rx: 1, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
4415
- if (type === "diamond") return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: x - size / 2, y: y - size / 2, width: size, height: size, rx: 1, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2, transform: `rotate(45 ${x} ${y})` });
4416
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
4435
+ if (pathType && ["heart", "droplet", "pin", "arrow"].includes(pathType)) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { "data-chart-symbol": type, d: chartMarkerPath(pathType, x, y, size), fill: type?.startsWith("empty") ? "#fff" : color, stroke: color, strokeWidth });
4436
+ if (type === "star" || type === "star6") return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { "data-chart-symbol": type, points: chartStarPoints(x, y, size, type === "star" ? 5 : 6).map((p) => p.join(",")).join(" "), fill: color, stroke: color, strokeWidth });
4437
+ if (type === "none") return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: x, cy: y, r: Math.max(6, size), fill: "transparent" });
4438
+ if (type === "square") return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: x - size / 2, y: y - size / 2, width: size, height: size, rx: 1, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
4439
+ if (type === "diamond") return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: x - size / 2, y: y - size / 2, width: size, height: size, rx: 1, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2, transform: `rotate(45 ${x} ${y})` });
4440
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
4417
4441
  }
4418
4442
  function useZoom(value, defaultValue, onChange) {
4419
- const [internal, setInternal] = (0, import_react34.useState)([...defaultValue ?? [0, 100]]);
4443
+ const [internal, setInternal] = (0, import_react35.useState)([...defaultValue ?? [0, 100]]);
4420
4444
  const current = value ?? internal;
4421
4445
  const update = (next) => {
4422
4446
  if (!value) setInternal(next);
@@ -4426,8 +4450,8 @@ function useZoom(value, defaultValue, onChange) {
4426
4450
  }
4427
4451
  function useToolboxMagicType(toolbox, fallback) {
4428
4452
  const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
4429
- const [internal, setInternal] = (0, import_react34.useState)(options?.activeMagicType ?? fallback);
4430
- (0, import_react34.useEffect)(() => {
4453
+ const [internal, setInternal] = (0, import_react35.useState)(options?.activeMagicType ?? fallback);
4454
+ (0, import_react35.useEffect)(() => {
4431
4455
  if (options?.activeMagicType) setInternal(options.activeMagicType);
4432
4456
  }, [options?.activeMagicType]);
4433
4457
  const active = options?.activeMagicType ?? internal;
@@ -4445,15 +4469,15 @@ function useToolboxMagicType(toolbox, fallback) {
4445
4469
  } : toolbox;
4446
4470
  return [active, resolved];
4447
4471
  }
4448
- var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableMode = "resize", onTransferError, grid, valueTransfer: externalValueTransfer, categories, series: sourceSeries, appearance = "sia", categoryLabelInterval = 0, boundaryGap = false, showCategorySplitLine = true, categoryAxisName, valueAxisName, legendLayout, logBase = 10, logExponentStep = 1, animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, stacked = false, orientation = "vertical", xAxisType = "category", valueAxisType = "value", valueAxisInverse = false, tooltipTrigger = "item", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, dataZoom = false, zoomIndexMode = "points", zoomPosition = "bottom", zoomControlBounds, zoomPan = false, zoomSelectionShape = "band", zoomSelectionStyle, zoomMinSelectionSize, calculable = false, zoom, defaultZoom, onZoomChange, onDataChange, palette, toolbox, ...props }, ref) {
4449
- const [hoverIndex, setHoverIndex] = (0, import_react34.useState)(null);
4450
- const [editableSeries, setEditableSeries] = (0, import_react34.useState)(sourceSeries);
4451
- const [dragPoint, setDragPoint] = (0, import_react34.useState)(null);
4452
- const linePaintId = (0, import_react34.useId)().replaceAll(":", "");
4453
- const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react34.useState)();
4454
- (0, import_react34.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
4472
+ var LineChart = (0, import_react35.forwardRef)(function LineChart2({ calculableMode = "resize", onTransferError, grid, valueTransfer: externalValueTransfer, categories, series: sourceSeries, appearance = "sia", categoryLabelInterval = 0, boundaryGap = false, showCategorySplitLine = true, categoryAxisName, valueAxisName, legendLayout, logBase = 10, logExponentStep = 1, animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, stacked = false, orientation = "vertical", xAxisType = "category", valueAxisType = "value", valueAxisInverse = false, tooltipTrigger = "item", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, dataZoom = false, zoomIndexMode = "points", zoomPosition = "bottom", zoomControlBounds, zoomPan = false, zoomSelectionShape = "band", zoomSelectionStyle, zoomMinSelectionSize, calculable = false, zoom, defaultZoom, onZoomChange, onDataChange, palette, toolbox, ...props }, ref) {
4473
+ const [hoverIndex, setHoverIndex] = (0, import_react35.useState)(null);
4474
+ const [editableSeries, setEditableSeries] = (0, import_react35.useState)(sourceSeries);
4475
+ const [dragPoint, setDragPoint] = (0, import_react35.useState)(null);
4476
+ const linePaintId = (0, import_react35.useId)().replaceAll(":", "");
4477
+ const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react35.useState)();
4478
+ (0, import_react35.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
4455
4479
  const series = externalValueTransfer ? sourceSeries : editableSeries;
4456
- const initialTransferSeries = (0, import_react34.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
4480
+ const initialTransferSeries = (0, import_react35.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
4457
4481
  const localTransfer = useBarValueTransfer(series.map((item) => ({ ...item, data: item.data.map(lineValue) })), initialTransferSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (nextBars) => {
4458
4482
  const next = series.map((item, row) => ({ ...item, data: item.data.map((datum, index) => {
4459
4483
  const value = barDatum(nextBars[row].data[index]).value;
@@ -4469,9 +4493,9 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4469
4493
  const PLOT2 = plot;
4470
4494
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
4471
4495
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
4472
- const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...zoomControlBounds, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataZoom, { handleLabels: [categories[Math.min(categories.length - 1, Math.floor(Math.min(...zoomValue) / 100 * categories.length))] ?? "", categories[Math.max(0, Math.ceil(Math.max(...zoomValue) / 100 * categories.length) - 1)] ?? ""], shadowBounds: zoomControlBounds, panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), onChange: setZoomValue }) }) : null;
4473
- const [zoomBrushActive, setZoomBrushActive] = (0, import_react34.useState)(false);
4474
- const [zoomHistory, setZoomHistory] = (0, import_react34.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
4496
+ const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...zoomControlBounds, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataZoom, { handleLabels: [categories[Math.min(categories.length - 1, Math.floor(Math.min(...zoomValue) / 100 * categories.length))] ?? "", categories[Math.max(0, Math.ceil(Math.max(...zoomValue) / 100 * categories.length) - 1)] ?? ""], shadowBounds: zoomControlBounds, panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), onChange: setZoomValue }) }) : null;
4497
+ const [zoomBrushActive, setZoomBrushActive] = (0, import_react35.useState)(false);
4498
+ const [zoomHistory, setZoomHistory] = (0, import_react35.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
4475
4499
  const zoomBrush = dataZoom && zoomBrushActive ? { minSelectionSize: zoomMinSelectionSize, selectionStyle: zoomSelectionStyle, selectionShape: zoomSelectionShape, bounds: PLOT2, onCancel: () => setZoomBrushActive(false), onSelect: (range) => {
4476
4500
  const start = Math.min(...zoomValue), span = Math.max(...zoomValue) - start;
4477
4501
  const next = [start + range[0] * span, start + range[1] * span];
@@ -4490,7 +4514,7 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4490
4514
  setZoomValue([...next.at(-1) ?? [0, 100]]);
4491
4515
  } : void 0),
4492
4516
  zoomBackDisabled: resolvedToolbox.onZoomBack ? resolvedToolbox.zoomBackDisabled : zoomHistory.length === 0,
4493
- dataView: resolvedToolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { allowNull: true, readOnly: resolvedToolbox.dataViewReadOnly, series: series.map((item) => ({ name: item.name, data: item.data.map((datum) => {
4517
+ dataView: resolvedToolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { allowNull: true, readOnly: resolvedToolbox.dataViewReadOnly, series: series.map((item) => ({ name: item.name, data: item.data.map((datum) => {
4494
4518
  const value = lineValue(datum);
4495
4519
  return Number.isFinite(value) ? value : null;
4496
4520
  }) })), onApply: (values2) => {
@@ -4518,11 +4542,11 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4518
4542
  const categoryLabels = visibleCategories.map((label, index) => index % labelStep ? "" : label);
4519
4543
  const visibleSeries = series.filter((item) => legend.isSelected(item.name)).map((item) => ({ ...item, stack: lineMagic.layout === "tiled" ? void 0 : item.stack, data: item.data.slice(startIndex, endIndex) }));
4520
4544
  if (lineMagic.shape === "bar") {
4521
- const switched = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4545
+ const switched = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4522
4546
  BarChart,
4523
4547
  {
4524
4548
  ...props,
4525
- svgOverlay: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4549
+ svgOverlay: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4526
4550
  props.svgOverlay,
4527
4551
  inlineZoom
4528
4552
  ] }),
@@ -4566,10 +4590,10 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4566
4590
  toolbox: chartToolbox
4567
4591
  }
4568
4592
  );
4569
- return dataZoom && !zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "sia-chart-with-zoom", children: [
4570
- zoomPosition === "top" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataZoom, { panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), showDetail: true, onChange: setZoomValue }) : null,
4593
+ return dataZoom && !zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "sia-chart-with-zoom", children: [
4594
+ zoomPosition === "top" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataZoom, { panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), showDetail: true, onChange: setZoomValue }) : null,
4571
4595
  switched,
4572
- zoomPosition === "bottom" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataZoom, { panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), showDetail: true, onChange: setZoomValue }) : null
4596
+ zoomPosition === "bottom" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataZoom, { panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), showDetail: true, onChange: setZoomValue }) : null
4573
4597
  ] }) : switched;
4574
4598
  }
4575
4599
  const stackLayout = layoutBarValues(visibleSeries.map((item) => ({ stack: item.stack, data: item.data.map(lineValue) })), visibleCategories.length, effectiveStacked);
@@ -4593,11 +4617,11 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4593
4617
  const xDomain = niceChartDomain(allXValues, false);
4594
4618
  const categoryAt = (index) => orientation === "vertical" ? PLOT2.x + (index + (boundaryGap ? 0.5 : 0)) / Math.max(1, visibleCategories.length - (boundaryGap ? 0 : 1)) * PLOT2.width : legacy ? PLOT_BOTTOM2 - index / Math.max(1, visibleCategories.length - 1) * PLOT2.height : PLOT2.y + index / Math.max(1, visibleCategories.length - 1) * PLOT2.height;
4595
4619
  const pointXAt = (datum, index) => xAxisType === "category" ? categoryAt(index) : linearScale(lineXValue(datum, index), [xDomain[0], xDomain[1]], [PLOT2.x, PLOT2.x + PLOT2.width]);
4596
- const content = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4620
+ const content = /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4597
4621
  SiaChart,
4598
4622
  {
4599
4623
  ...props,
4600
- svgOverlay: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4624
+ svgOverlay: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4601
4625
  props.svgOverlay,
4602
4626
  inlineZoom
4603
4627
  ] }),
@@ -4609,41 +4633,41 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4609
4633
  empty: !visibleCategories.length || !series.length,
4610
4634
  ariaLabel: props.ariaLabel ?? "\u6298\u7EBF\u56FE",
4611
4635
  children: [
4612
- showLegend ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { symbol: legacy ? "line" : "rect", x: legendLayout?.x ?? (props.viewBoxSize?.[0] ?? 720) / 2, y: legendLayout?.y ?? (legacy ? 14 : 20), align: legendLayout?.align, itemGap: legacy ? 10 : 18, items: series.map((item, index) => ({ name: item.name, fillGradient: item.fillGradient, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
4613
- legacy && orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4614
- valueTicks.map((tick, i, ticks) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4615
- i < ticks.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: PLOT2.x, y: valueAt(ticks[i + 1]), width: PLOT2.width, height: Math.abs(valueAt(tick) - valueAt(ticks[i + 1])), fill: i % 2 ? "rgba(200,200,200,.1)" : "rgba(250,250,250,.1)" }) : null,
4616
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: valueAt(tick), y2: valueAt(tick), stroke: "#eee" }),
4617
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: PLOT2.x - 8, y: valueAt(tick) + 4, textAnchor: "end", className: "sia-chart__axis-label", children: axisLabelFormatter?.(tick) ?? tick.toLocaleString("en-US") })
4636
+ showLegend ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { symbol: legacy ? "line" : "rect", x: legendLayout?.x ?? (props.viewBoxSize?.[0] ?? 720) / 2, y: legendLayout?.y ?? (legacy ? 14 : 20), align: legendLayout?.align, itemGap: legacy ? 10 : 18, items: series.map((item, index) => ({ name: item.name, fillGradient: item.fillGradient, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
4637
+ legacy && orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4638
+ valueTicks.map((tick, i, ticks) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4639
+ i < ticks.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: PLOT2.x, y: valueAt(ticks[i + 1]), width: PLOT2.width, height: Math.abs(valueAt(tick) - valueAt(ticks[i + 1])), fill: i % 2 ? "rgba(200,200,200,.1)" : "rgba(250,250,250,.1)" }) : null,
4640
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: valueAt(tick), y2: valueAt(tick), stroke: "#eee" }),
4641
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: PLOT2.x - 8, y: valueAt(tick) + 4, textAnchor: "end", className: "sia-chart__axis-label", children: axisLabelFormatter?.(tick) ?? tick.toLocaleString("en-US") })
4618
4642
  ] }, tick)),
4619
- categoryLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4620
- showCategorySplitLine ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: categoryAt(i), x2: categoryAt(i), y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#eee" }) : null,
4621
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: categoryAt(i), y: PLOT_BOTTOM2 + 19, textAnchor: "middle", className: "sia-chart__axis-label", children: label })
4643
+ categoryLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4644
+ showCategorySplitLine ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: categoryAt(i), x2: categoryAt(i), y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#eee" }) : null,
4645
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: categoryAt(i), y: PLOT_BOTTOM2 + 19, textAnchor: "middle", className: "sia-chart__axis-label", children: label })
4622
4646
  ] }, i)),
4623
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x, y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#008acd", strokeWidth: 2 }),
4624
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: valueAt(0), y2: valueAt(0), stroke: "#008acd", strokeWidth: 2 }),
4625
- categoryAxisName ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: PLOT2.x + PLOT2.width + 5, y: valueAt(0) + 4, fill: "#008acd", fontSize: 12, children: categoryAxisName }) : null,
4626
- valueAxisName ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: PLOT2.x, y: PLOT2.y - 9, fill: "#008acd", fontSize: 12, children: valueAxisName }) : null
4627
- ] }) : legacy && orientation === "horizontal" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4628
- valueTicks.map((tick, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4629
- index < valueTicks.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: valueAt(tick), y: PLOT2.y, width: Math.abs(valueAt(valueTicks[index + 1]) - valueAt(tick)), height: PLOT2.height, fill: index % 2 ? "rgba(200,200,200,.1)" : "rgba(250,250,250,.1)" }) : null,
4630
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: valueAt(tick), x2: valueAt(tick), y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#eee" }),
4631
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: valueAt(tick), y: PLOT_BOTTOM2 + 19, textAnchor: "middle", className: "sia-chart__axis-label", children: axisLabelFormatter?.(tick) ?? tick.toLocaleString("en-US") })
4647
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x, y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#008acd", strokeWidth: 2 }),
4648
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: valueAt(0), y2: valueAt(0), stroke: "#008acd", strokeWidth: 2 }),
4649
+ categoryAxisName ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: PLOT2.x + PLOT2.width + 5, y: valueAt(0) + 4, fill: "#008acd", fontSize: 12, children: categoryAxisName }) : null,
4650
+ valueAxisName ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: PLOT2.x, y: PLOT2.y - 9, fill: "#008acd", fontSize: 12, children: valueAxisName }) : null
4651
+ ] }) : legacy && orientation === "horizontal" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4652
+ valueTicks.map((tick, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4653
+ index < valueTicks.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: valueAt(tick), y: PLOT2.y, width: Math.abs(valueAt(valueTicks[index + 1]) - valueAt(tick)), height: PLOT2.height, fill: index % 2 ? "rgba(200,200,200,.1)" : "rgba(250,250,250,.1)" }) : null,
4654
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: valueAt(tick), x2: valueAt(tick), y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#eee" }),
4655
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: valueAt(tick), y: PLOT_BOTTOM2 + 19, textAnchor: "middle", className: "sia-chart__axis-label", children: axisLabelFormatter?.(tick) ?? tick.toLocaleString("en-US") })
4632
4656
  ] }, tick)),
4633
- categoryLabels.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4634
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: categoryAt(index), y2: categoryAt(index), stroke: "#eee" }),
4635
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: PLOT2.x - 8, y: categoryAt(index) + 4, textAnchor: "end", className: "sia-chart__axis-label", children: label })
4657
+ categoryLabels.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4658
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: categoryAt(index), y2: categoryAt(index), stroke: "#eee" }),
4659
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: PLOT2.x - 8, y: categoryAt(index) + 4, textAnchor: "end", className: "sia-chart__axis-label", children: label })
4636
4660
  ] }, index)),
4637
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x, y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#008acd", strokeWidth: 2 }),
4638
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: PLOT_BOTTOM2, y2: PLOT_BOTTOM2, stroke: "#008acd", strokeWidth: 2 })
4639
- ] }) : orientation === "vertical" && xAxisType === "category" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CartesianAxes, { categories: categoryLabels, domain }) : orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4640
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { orientation: "left", x: PLOT2.x, y: PLOT_BOTTOM2, length: PLOT2.height, labels: valueTicks.map(formatChartNumber), gridLength: PLOT2.width }),
4641
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { orientation: "bottom", x: PLOT2.x, y: PLOT_BOTTOM2, length: PLOT2.width, labels: chartTicks(xDomain).map((value) => xAxisType === "time" ? new Date(value).toLocaleDateString() : formatChartNumber(value)), gridLength: PLOT2.height })
4642
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4643
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { orientation: "bottom", x: PLOT2.x, y: PLOT_BOTTOM2, length: PLOT2.width, labels: valueTicks.map(formatChartNumber), gridLength: PLOT2.height }),
4644
- categoryLabels.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: PLOT2.x - 10, y: categoryAt(index) + 4, textAnchor: "end", className: "sia-chart__axis-label", children: label }, `${label}-${index}`))
4661
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x, y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#008acd", strokeWidth: 2 }),
4662
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: PLOT_BOTTOM2, y2: PLOT_BOTTOM2, stroke: "#008acd", strokeWidth: 2 })
4663
+ ] }) : orientation === "vertical" && xAxisType === "category" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CartesianAxes, { categories: categoryLabels, domain }) : orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4664
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { orientation: "left", x: PLOT2.x, y: PLOT_BOTTOM2, length: PLOT2.height, labels: valueTicks.map(formatChartNumber), gridLength: PLOT2.width }),
4665
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { orientation: "bottom", x: PLOT2.x, y: PLOT_BOTTOM2, length: PLOT2.width, labels: chartTicks(xDomain).map((value) => xAxisType === "time" ? new Date(value).toLocaleDateString() : formatChartNumber(value)), gridLength: PLOT2.height })
4666
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4667
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { orientation: "bottom", x: PLOT2.x, y: PLOT_BOTTOM2, length: PLOT2.width, labels: valueTicks.map(formatChartNumber), gridLength: PLOT2.height }),
4668
+ categoryLabels.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: PLOT2.x - 10, y: categoryAt(index) + 4, textAnchor: "end", className: "sia-chart__axis-label", children: label }, `${label}-${index}`))
4645
4669
  ] }),
4646
- tooltipTrigger === "axis" && hoverIndex != null ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4670
+ tooltipTrigger === "axis" && hoverIndex != null ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4647
4671
  "line",
4648
4672
  {
4649
4673
  x1: orientation === "vertical" ? categoryAt(hoverIndex) : PLOT2.x,
@@ -4656,13 +4680,13 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4656
4680
  tooltipTrigger === "axis" && xAxisType === "category" ? visibleCategories.map((name, index) => {
4657
4681
  const step = (orientation === "vertical" ? PLOT2.width : PLOT2.height) / Math.max(1, visibleCategories.length - 1);
4658
4682
  const coordinate = categoryAt(index);
4659
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4683
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4660
4684
  ChartMark,
4661
4685
  {
4662
4686
  label: `${name}\uFF0C${visibleSeries.map((item) => `${item.name} ${lineValue(item.data[index] ?? 0)}`).join("\uFF0C")}`,
4663
- tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4664
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: name }),
4665
- visibleSeries.map((item) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
4687
+ tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4688
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: name }),
4689
+ visibleSeries.map((item) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
4666
4690
  item.name,
4667
4691
  "\uFF1A",
4668
4692
  valueFormatter ? valueFormatter(lineValue(item.data[index] ?? 0)) : formatChartNumber(lineValue(item.data[index] ?? 0))
@@ -4671,7 +4695,7 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4671
4695
  tooltipPoint: orientation === "vertical" ? [coordinate, PLOT2.y + 12] : [PLOT2.x + PLOT2.width, coordinate],
4672
4696
  onPointerMove: () => setHoverIndex(index),
4673
4697
  onPointerLeave: () => setHoverIndex(null),
4674
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: orientation === "vertical" ? coordinate - step / 2 : PLOT2.x, y: orientation === "vertical" ? PLOT2.y : coordinate - step / 2, width: orientation === "vertical" ? step : PLOT2.width, height: orientation === "vertical" ? PLOT2.height : step, fill: "transparent" })
4698
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: orientation === "vertical" ? coordinate - step / 2 : PLOT2.x, y: orientation === "vertical" ? PLOT2.y : coordinate - step / 2, width: orientation === "vertical" ? step : PLOT2.width, height: orientation === "vertical" ? PLOT2.height : step, fill: "transparent" })
4675
4699
  },
4676
4700
  `axis-${name}-${index}`
4677
4701
  );
@@ -4692,7 +4716,7 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4692
4716
  (stacked || item.stack) && !legacy ? valueAt(previous[index]) : valueAt(valueAxisType === "log" ? domain[0] : 0),
4693
4717
  point[1]
4694
4718
  ]);
4695
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPointMotion, { points: item.area ? [...plotted, ...basePoints] : plotted, enabled: props.animation !== false && !dragPoint, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, horizontal: orientation === "horizontal", children: (animatedShape) => {
4719
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPointMotion, { points: item.area ? [...plotted, ...basePoints] : plotted, enabled: props.animation !== false && !dragPoint, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, horizontal: orientation === "horizontal", children: (animatedShape) => {
4696
4720
  const animatedPoints = animatedShape.slice(0, plotted.length);
4697
4721
  const animatedBase = animatedShape.slice(plotted.length);
4698
4722
  const areaRuns = [];
@@ -4711,34 +4735,34 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4711
4735
  const average = itemValues.reduce((sum, value) => sum + value, 0) / Math.max(1, itemValues.length);
4712
4736
  const averageCoordinate = valueAt(average);
4713
4737
  const extremeIndexes = [item.markMin ? itemValues.indexOf(Math.min(...itemValues)) : -1, item.markMax ? itemValues.indexOf(Math.max(...itemValues)) : -1].filter((index) => index >= 0);
4714
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4715
- gradient ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("linearGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", x1: gradient.start[0], y1: gradient.start[1], x2: gradient.end[0], y2: gradient.end[1], children: gradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
4716
- statistics && item.statisticLines ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartBarStatistics, { values: statistics, kinds: item.statisticLines, project: valueAt, plot: PLOT2, horizontal: orientation === "horizontal", color, gradient, seriesName: item.name }) : null,
4717
- areaGradient ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("linearGradient", { id: areaGradientId, gradientUnits: "userSpaceOnUse", x1: areaGradient.start[0], y1: areaGradient.start[1], x2: areaGradient.end[0], y2: areaGradient.end[1], children: areaGradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
4718
- item.area ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: areaPath, fill: areaGradient ? `url(#${areaGradientId})` : color, style: areaGradient ? { opacity: 1 } : void 0, className: "sia-chart__area" }) : null,
4719
- item.markAverage ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { className: "sia-chart__mark-line", style: legacy ? { color } : void 0, children: [
4720
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: orientation === "vertical" ? PLOT2.x : averageCoordinate, y1: orientation === "vertical" ? averageCoordinate : PLOT2.y, x2: orientation === "vertical" ? PLOT2.x + PLOT2.width : averageCoordinate, y2: orientation === "vertical" ? averageCoordinate : PLOT_BOTTOM2, stroke: color }),
4721
- legacy && orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4722
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: PLOT2.x, cy: averageCoordinate, r: 2, fill: "#fff", stroke: color }),
4723
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: `M ${PLOT2.x + PLOT2.width - 8} ${averageCoordinate - 4} L ${PLOT2.x + PLOT2.width} ${averageCoordinate} L ${PLOT2.x + PLOT2.width - 8} ${averageCoordinate + 4} Z`, fill: color })
4738
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4739
+ gradient ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("linearGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", x1: gradient.start[0], y1: gradient.start[1], x2: gradient.end[0], y2: gradient.end[1], children: gradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
4740
+ statistics && item.statisticLines ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartBarStatistics, { values: statistics, kinds: item.statisticLines, project: valueAt, plot: PLOT2, horizontal: orientation === "horizontal", color, gradient, seriesName: item.name }) : null,
4741
+ areaGradient ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("linearGradient", { id: areaGradientId, gradientUnits: "userSpaceOnUse", x1: areaGradient.start[0], y1: areaGradient.start[1], x2: areaGradient.end[0], y2: areaGradient.end[1], children: areaGradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
4742
+ item.area ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: areaPath, fill: areaGradient ? `url(#${areaGradientId})` : color, style: areaGradient ? { opacity: 1 } : void 0, className: "sia-chart__area" }) : null,
4743
+ item.markAverage ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { className: "sia-chart__mark-line", style: legacy ? { color } : void 0, children: [
4744
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: orientation === "vertical" ? PLOT2.x : averageCoordinate, y1: orientation === "vertical" ? averageCoordinate : PLOT2.y, x2: orientation === "vertical" ? PLOT2.x + PLOT2.width : averageCoordinate, y2: orientation === "vertical" ? averageCoordinate : PLOT_BOTTOM2, stroke: color }),
4745
+ legacy && orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4746
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: PLOT2.x, cy: averageCoordinate, r: 2, fill: "#fff", stroke: color }),
4747
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: `M ${PLOT2.x + PLOT2.width - 8} ${averageCoordinate - 4} L ${PLOT2.x + PLOT2.width} ${averageCoordinate} L ${PLOT2.x + PLOT2.width - 8} ${averageCoordinate + 4} Z`, fill: color })
4724
4748
  ] }) : null,
4725
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: orientation === "vertical" ? PLOT2.x + PLOT2.width + (legacy ? 10 : -4) : averageCoordinate + 6, y: orientation === "vertical" ? averageCoordinate + (legacy ? 4 : -6) : PLOT2.y + 12, textAnchor: orientation === "vertical" && !legacy ? "end" : "start", children: legacy ? Number(average.toFixed(2)) : `\u5747\u503C ${formatChartNumber(average)}` })
4749
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: orientation === "vertical" ? PLOT2.x + PLOT2.width + (legacy ? 10 : -4) : averageCoordinate + 6, y: orientation === "vertical" ? averageCoordinate + (legacy ? 4 : -6) : PLOT2.y + 12, textAnchor: orientation === "vertical" && !legacy ? "end" : "start", children: legacy ? Number(average.toFixed(2)) : `\u5747\u503C ${formatChartNumber(average)}` })
4726
4750
  ] }) : null,
4727
- lineSegments(animatedPoints).map((segment, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: linePath(segment, item.curve), fill: "none", stroke: strokePaint, strokeDasharray: item.lineStyle === "dashed" ? "7 5" : item.lineStyle === "dotted" ? "2 4" : void 0, style: { filter: item.lineShadow ? `drop-shadow(${item.lineShadow.offsetX ?? 0}px ${item.lineShadow.offsetY ?? 0}px ${item.lineShadow.blur}px ${item.lineShadow.color})` : void 0, strokeWidth: item.lineWidth ?? (legacy ? 2 : 2.5), animation: "none" }, className: "sia-chart__line" }, i)),
4751
+ lineSegments(animatedPoints).map((segment, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: linePath(segment, item.curve), fill: "none", stroke: strokePaint, strokeDasharray: item.lineStyle === "dashed" ? "7 5" : item.lineStyle === "dotted" ? "2 4" : void 0, style: { filter: item.lineShadow ? `drop-shadow(${item.lineShadow.offsetX ?? 0}px ${item.lineShadow.offsetY ?? 0}px ${item.lineShadow.blur}px ${item.lineShadow.color})` : void 0, strokeWidth: item.lineWidth ?? (legacy ? 2 : 2.5), animation: "none" }, className: "sia-chart__line" }, i)),
4728
4752
  extremeIndexes.map((index) => {
4729
4753
  const point = plotted[index];
4730
4754
  const value = itemValues[index];
4731
4755
  const kind = value === Math.max(...itemValues) ? "\u6700\u5927\u503C" : "\u6700\u5C0F\u503C";
4732
- return legacy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPin, { point, color, label: formatChartNumber(value) }, `${kind}-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { className: "sia-chart__mark-point", children: [
4733
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: point[0], cy: point[1], r: 10, fill: color }),
4734
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("text", { x: point[0], y: point[1] - 15, textAnchor: "middle", children: [
4756
+ return legacy ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPin, { point, color, label: formatChartNumber(value) }, `${kind}-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { className: "sia-chart__mark-point", children: [
4757
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: point[0], cy: point[1], r: 10, fill: color }),
4758
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("text", { x: point[0], y: point[1] - 15, textAnchor: "middle", children: [
4735
4759
  kind,
4736
4760
  " ",
4737
4761
  formatChartNumber(value)
4738
4762
  ] })
4739
4763
  ] }, `${kind}-${index}`);
4740
4764
  }),
4741
- item.markPoints?.map((mark) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPin, { point: [categoryAt(mark.index - startIndex), valueAt(mark.value)], color, label: mark.label ?? formatChartNumber(mark.value) }, mark.name)),
4765
+ item.markPoints?.map((mark) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPin, { point: [categoryAt(mark.index - startIndex), valueAt(mark.value)], color, label: mark.label ?? formatChartNumber(mark.value) }, mark.name)),
4742
4766
  animatedPoints.map((point, index) => {
4743
4767
  if (!point.every(Number.isFinite)) {
4744
4768
  if (!valueTransfer || Number.isFinite(lineValue(item.data[index] ?? NaN))) return null;
@@ -4751,14 +4775,14 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4751
4775
  const x = orientation === "vertical" ? coordinate : baseline;
4752
4776
  const y = orientation === "vertical" ? baseline : categoryAt(index);
4753
4777
  const emptyKey = `${item.name}:${index}`, highlighted = hoveredLinePoint === emptyKey;
4754
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { ...valueTransfer.props(series.findIndex((candidate) => candidate.name === item.name), index + startIndex), onPointerEnter: () => setHoveredLinePoint(emptyKey), onPointerLeave: () => setHoveredLinePoint(void 0), onFocus: () => setHoveredLinePoint(emptyKey), onBlur: () => setHoveredLinePoint(void 0), label: `${item.name}\uFF0C${visibleCategories[index]}\uFF0C\u7A7A\u69FD`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4778
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { ...valueTransfer.props(series.findIndex((candidate) => candidate.name === item.name), index + startIndex), onPointerEnter: () => setHoveredLinePoint(emptyKey), onPointerLeave: () => setHoveredLinePoint(void 0), onFocus: () => setHoveredLinePoint(emptyKey), onBlur: () => setHoveredLinePoint(void 0), label: `${item.name}\uFF0C${visibleCategories[index]}\uFF0C\u7A7A\u69FD`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4755
4779
  "\u62D6\u5165\u6570\u503C\uFF1A",
4756
4780
  item.name,
4757
4781
  " ",
4758
4782
  visibleCategories[index]
4759
4783
  ] }), children: [
4760
- shapedEmpty ? lineSymbol(item.symbol, x, y, emptySize, highlighted ? item.emphasisColor ?? color : "#ccc", item.symbolImage, highlighted ? 4 : 2) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: x, cy: y, r: legacy ? emptySize / 2 : 7, fill: legacy && !highlighted ? "#ccc" : "#fff", stroke: legacy && !highlighted ? "#ccc" : color, strokeWidth: legacy ? highlighted ? 4 : 2 : 1, strokeDasharray: legacy ? void 0 : "2 2" }),
4761
- legacy && highlighted && item.showEmphasisLabels ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x, y: y - emptySize / 2 - 5, textAnchor: "middle", className: "sia-chart__point-label", style: { fill: item.emphasisColor ?? color, fontSize: 12, fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1, Arial, Verdana, sans-serif", ...item.labelStyle, ...item.emphasisLabelStyle }, children: "-" }) : null
4784
+ shapedEmpty ? lineSymbol(item.symbol, x, y, emptySize, highlighted ? item.emphasisColor ?? color : "#ccc", item.symbolImage, highlighted ? 4 : 2) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: x, cy: y, r: legacy ? emptySize / 2 : 7, fill: legacy && !highlighted ? "#ccc" : "#fff", stroke: legacy && !highlighted ? "#ccc" : color, strokeWidth: legacy ? highlighted ? 4 : 2 : 1, strokeDasharray: legacy ? void 0 : "2 2" }),
4785
+ legacy && highlighted && item.showEmphasisLabels ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x, y: y - emptySize / 2 - 5, textAnchor: "middle", className: "sia-chart__point-label", style: { fill: item.emphasisColor ?? color, fontSize: 12, fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1, Arial, Verdana, sans-serif", ...item.labelStyle, ...item.emphasisLabelStyle }, children: "-" }) : null
4762
4786
  ] }, `empty-${index}`);
4763
4787
  }
4764
4788
  const value = lineValue(item.data[index] ?? 0);
@@ -4779,12 +4803,12 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4779
4803
  ...pointStyle?.labelStyle,
4780
4804
  ...emphasized ? { ...item.emphasisLabelStyle, ...pointStyle?.emphasisLabelStyle } : {}
4781
4805
  };
4782
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4806
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4783
4807
  ChartMark,
4784
4808
  {
4785
4809
  className: calculable ? "sia-chart__calculable" : void 0,
4786
4810
  label: `${item.name}\uFF0C${name}\uFF0C${formatChartNumber(value)}`,
4787
- tooltip: tooltipTrigger === "item" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }) : void 0,
4811
+ tooltip: tooltipTrigger === "item" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }) : void 0,
4788
4812
  tooltipPoint: point,
4789
4813
  onPointerDown: (event) => {
4790
4814
  if (!calculable) return;
@@ -4819,8 +4843,8 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4819
4843
  onBlur: () => setHoveredLinePoint(void 0),
4820
4844
  ...transferHandlers,
4821
4845
  children: [
4822
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("g", { transform: `rotate(${pointStyle?.symbolRotate ?? item.symbolRotate ?? 0} ${point[0]} ${point[1]})`, children: item.hollowSymbol && !pointStyle?.symbol ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: point[0], cy: point[1], r: (pointSize ?? 6) / 2, fill: "#fff", stroke: pointColor, strokeWidth: legacy && emphasized ? 4 : 2 }) : lineSymbol(item.showPoints === false ? "none" : pointStyle?.symbol ?? item.symbol, point[0], point[1], pointSize ?? 9, pointColor, pointStyle?.symbolImage ?? item.symbolImage) }),
4823
- showLabel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: point[0], y: labelPosition === "inside" ? point[1] : point[1] - Math.max(10, (pointSize ?? 6) / 2 + 5), dominantBaseline: labelPosition === "inside" ? "middle" : void 0, textAnchor: "middle", className: "sia-chart__point-label", style: labelStyle, children: label }) : null
4846
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("g", { transform: `rotate(${pointStyle?.symbolRotate ?? item.symbolRotate ?? 0} ${point[0]} ${point[1]})`, children: item.hollowSymbol && !pointStyle?.symbol ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: point[0], cy: point[1], r: (pointSize ?? 6) / 2, fill: "#fff", stroke: pointColor, strokeWidth: legacy && emphasized ? 4 : 2 }) : lineSymbol(item.showPoints === false ? "none" : pointStyle?.symbol ?? item.symbol, point[0], point[1], pointSize ?? 9, pointColor, pointStyle?.symbolImage ?? item.symbolImage) }),
4847
+ showLabel ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: point[0], y: labelPosition === "inside" ? point[1] : point[1] - Math.max(10, (pointSize ?? 6) / 2 + 5), dominantBaseline: labelPosition === "inside" ? "middle" : void 0, textAnchor: "middle", className: "sia-chart__point-label", style: labelStyle, children: label }) : null
4824
4848
  ]
4825
4849
  },
4826
4850
  `${name}-${index}`
@@ -4829,46 +4853,46 @@ var LineChart = (0, import_react34.forwardRef)(function LineChart2({ calculableM
4829
4853
  ] }, `${item.name}-${seriesIndex}`);
4830
4854
  } }, item.name);
4831
4855
  }), legacy && stacked),
4832
- valueTransfer?.islands.map((island, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { ...valueTransfer.props(-1, index), label: `\u5B64\u5C9B ${island.name} ${island.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4856
+ valueTransfer?.islands.map((island, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { ...valueTransfer.props(-1, index), label: `\u5B64\u5C9B ${island.name} ${island.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4833
4857
  island.seriesName,
4834
4858
  " ",
4835
4859
  island.name,
4836
4860
  "\uFF1A",
4837
4861
  island.value
4838
4862
  ] }), children: [
4839
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: island.x, cy: island.y, r: 20, fill: "#fff", stroke: "#2ec7c9", strokeWidth: 2 }),
4840
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: island.x, y: island.y + 4, textAnchor: "middle", fontSize: 11, children: island.value })
4863
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: island.x, cy: island.y, r: 20, fill: "#fff", stroke: "#2ec7c9", strokeWidth: 2 }),
4864
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: island.x, y: island.y + 4, textAnchor: "middle", fontSize: 11, children: island.value })
4841
4865
  ] }, `line-island-${index}`))
4842
4866
  ]
4843
4867
  }
4844
4868
  );
4845
- return dataZoom && !zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "sia-chart-with-zoom", children: [
4846
- zoomPosition === "top" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataZoom, { panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), showDetail: true, onChange: setZoomValue }) : null,
4869
+ return dataZoom && !zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "sia-chart-with-zoom", children: [
4870
+ zoomPosition === "top" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataZoom, { panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), showDetail: true, onChange: setZoomValue }) : null,
4847
4871
  content,
4848
- zoomPosition === "bottom" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataZoom, { panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), showDetail: true, onChange: setZoomValue }) : null
4872
+ zoomPosition === "bottom" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataZoom, { panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), showDetail: true, onChange: setZoomValue }) : null
4849
4873
  ] }) : content;
4850
4874
  });
4851
4875
  function ChartPin({ point, color, label }) {
4852
4876
  const scale = Math.max(1, (label.length * 3.2 + 2) / 13);
4853
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { transform: `translate(${point[0]} ${point[1]})`, className: "sia-chart__pin", children: [
4854
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "M 0 0 C -4 -8 -13 -14 -13 -23 A 13 13 0 1 1 13 -23 C 13 -14 4 -8 0 0 Z", fill: color, transform: `scale(${scale})` }),
4855
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { y: -23 * scale + 4, textAnchor: "middle", fill: "#fff", fontSize: 12, children: label })
4877
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { transform: `translate(${point[0]} ${point[1]})`, className: "sia-chart__pin", children: [
4878
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "M 0 0 C -4 -8 -13 -14 -13 -23 A 13 13 0 1 1 13 -23 C 13 -14 4 -8 0 0 Z", fill: color, transform: `scale(${scale})` }),
4879
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { y: -23 * scale + 4, textAnchor: "middle", fill: "#fff", fontSize: 12, children: label })
4856
4880
  ] });
4857
4881
  }
4858
4882
  function barDatum(datum) {
4859
4883
  return typeof datum === "number" ? { value: datum } : datum;
4860
4884
  }
4861
- var BarChart = (0, import_react34.forwardRef)(function BarChart2({ valueTransfer: externalValueTransfer, calculableMode = "resize", onTransferError, categories, series: sourceSeries, appearance = "sia", animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, grid, valueAxisPosition = "bottom", showValueAxis = true, showCategoryAxis = true, showCategorySplitLine = false, tooltipTrigger = "item", tooltipFormatter, stacked = false, orientation = "vertical", minBarSize = 1, calculable = false, onDataChange, showLegend = true, legendOrder, legendLayout, barCategoryGap = 0.2, valuePadding = 0, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
4862
- const [editableSeries, setEditableSeries] = (0, import_react34.useState)(sourceSeries);
4863
- const [dragBar, setDragBar] = (0, import_react34.useState)(null);
4864
- const [hoveredBar, setHoveredBar] = (0, import_react34.useState)();
4865
- const barPaintId = (0, import_react34.useId)().replaceAll(":", "");
4885
+ var BarChart = (0, import_react35.forwardRef)(function BarChart2({ valueTransfer: externalValueTransfer, calculableMode = "resize", onTransferError, categories, series: sourceSeries, appearance = "sia", animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, grid, valueAxisPosition = "bottom", showValueAxis = true, showCategoryAxis = true, showCategorySplitLine = false, tooltipTrigger = "item", tooltipFormatter, stacked = false, orientation = "vertical", minBarSize = 1, calculable = false, onDataChange, showLegend = true, legendOrder, legendLayout, barCategoryGap = 0.2, valuePadding = 0, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
4886
+ const [editableSeries, setEditableSeries] = (0, import_react35.useState)(sourceSeries);
4887
+ const [dragBar, setDragBar] = (0, import_react35.useState)(null);
4888
+ const [hoveredBar, setHoveredBar] = (0, import_react35.useState)();
4889
+ const barPaintId = (0, import_react35.useId)().replaceAll(":", "");
4866
4890
  const localTransfer = useBarValueTransfer(editableSeries, sourceSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (next) => {
4867
4891
  setEditableSeries(next);
4868
4892
  onDataChange?.(next);
4869
4893
  }, onTransferError);
4870
4894
  const transfer = externalValueTransfer ?? localTransfer;
4871
- (0, import_react34.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
4895
+ (0, import_react35.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
4872
4896
  const series = externalValueTransfer ? sourceSeries : editableSeries;
4873
4897
  const legacy = appearance === "macarons";
4874
4898
  const PLOT2 = legacy ? { x: grid?.left ?? 80, y: grid?.top ?? 60, width: (props.viewBoxSize?.[0] ?? 720) - (grid?.left ?? 80) - (grid?.right ?? 80), height: (props.viewBoxSize?.[1] ?? 360) - (grid?.top ?? 60) - (grid?.bottom ?? 70) } : { x: 62, y: 48, width: 628, height: 250 };
@@ -4877,7 +4901,7 @@ var BarChart = (0, import_react34.forwardRef)(function BarChart2({ valueTransfer
4877
4901
  const [barMagic, resolvedToolbox] = useBarMagicState(toolbox);
4878
4902
  const chartToolbox = typeof resolvedToolbox === "object" ? {
4879
4903
  ...resolvedToolbox,
4880
- dataView: resolvedToolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { allowNull: true, readOnly: resolvedToolbox.dataViewReadOnly, series: series.map((item) => ({ name: item.name, data: item.data.map((datum) => {
4904
+ dataView: resolvedToolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { allowNull: true, readOnly: resolvedToolbox.dataViewReadOnly, series: series.map((item) => ({ name: item.name, data: item.data.map((datum) => {
4881
4905
  const d = barDatum(datum);
4882
4906
  return d.hidden || !Number.isFinite(d.value) ? null : d.value;
4883
4907
  }) })), onApply: (values) => {
@@ -4895,7 +4919,7 @@ var BarChart = (0, import_react34.forwardRef)(function BarChart2({ valueTransfer
4895
4919
  resolvedToolbox.onRestore?.();
4896
4920
  }
4897
4921
  } : resolvedToolbox;
4898
- if (barMagic.shape === "line") return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4922
+ if (barMagic.shape === "line") return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4899
4923
  LineChart,
4900
4924
  {
4901
4925
  ...props,
@@ -4942,40 +4966,40 @@ var BarChart = (0, import_react34.forwardRef)(function BarChart2({ valueTransfer
4942
4966
  const invisible = (color) => color === "transparent" || color?.replaceAll(" ", "") === "rgba(0,0,0,0)";
4943
4967
  const axisTooltip = (index) => {
4944
4968
  const rows = activeSeries.filter((item) => !invisible(item.color) && !barDatum(item.data[index] ?? 0).hidden).map((item) => ({ name: item.name, value: barDatum(item.data[index] ?? 0).value, color: barDatum(item.data[index] ?? 0).color ?? item.color ?? getColor(series.indexOf(item), void 0, palette) }));
4945
- return tooltipFormatter?.(categories[index], rows) ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4946
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: categories[index] }),
4947
- rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
4969
+ return tooltipFormatter?.(categories[index], rows) ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4970
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: categories[index] }),
4971
+ rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
4948
4972
  row.name,
4949
4973
  "\uFF1A",
4950
4974
  valueFormatter?.(row.value) ?? row.value.toLocaleString("en-US")
4951
4975
  ] }, i))
4952
4976
  ] });
4953
4977
  };
4954
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, toolbox: chartToolbox, empty: !categories.length || !series.length, ariaLabel: props.ariaLabel ?? "\u67F1\u72B6\u56FE", children: [
4978
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, toolbox: chartToolbox, empty: !categories.length || !series.length, ariaLabel: props.ariaLabel ?? "\u67F1\u72B6\u56FE", children: [
4955
4979
  showLegend ? Array.from({ length: Math.max(1, legendLayout?.rows ?? 1) }, (_, row) => {
4956
4980
  const items = series.map((item, index) => ({ name: item.name, fillGradient: item.fillGradient, color: getColor(index, item.color, palette), borderColor: item.borderColor, disabled: !legend.isSelected(item.name) })).filter((_2, index) => series[index].showInLegend !== false).filter((item, index, all) => all.findIndex((other) => other.name === item.name) === index).sort((a, b) => legendOrder ? legendOrder.indexOf(a.name) - legendOrder.indexOf(b.name) : 0);
4957
4981
  const rowSize = Math.ceil(items.length / Math.max(1, legendLayout?.rows ?? 1));
4958
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { x: legendLayout?.x ?? (props.viewBoxSize?.[0] ?? 720) / 2, y: (legendLayout?.y ?? (legacy ? 14 : 20)) + row * 20, itemGap: legendLayout?.itemGap ?? (legacy ? 10 : 18), items: items.slice(row * rowSize, (row + 1) * rowSize), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }, row);
4982
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { x: legendLayout?.x ?? (props.viewBoxSize?.[0] ?? 720) / 2, y: (legendLayout?.y ?? (legacy ? 14 : 20)) + row * 20, itemGap: legendLayout?.itemGap ?? (legacy ? 10 : 18), items: items.slice(row * rowSize, (row + 1) * rowSize), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }, row);
4959
4983
  }) : null,
4960
- legacy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4961
- showValueAxis ? ticks.map((tick, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("g", { children: orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4962
- index < ticks.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: PLOT2.x, y: valueAt(ticks[index + 1]), width: PLOT2.width, height: Math.abs(valueAt(tick) - valueAt(ticks[index + 1])), fill: index % 2 ? "rgba(200,200,200,.1)" : "rgba(250,250,250,.1)" }) : null,
4963
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: valueAt(tick), y2: valueAt(tick), stroke: "#eee" }),
4964
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: PLOT2.x - 8, y: valueAt(tick) + 4, textAnchor: "end", className: "sia-chart__axis-label", children: axisLabelFormatter?.(tick) ?? tick.toLocaleString("en-US") })
4965
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4966
- index < ticks.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: valueAt(tick), y: PLOT2.y, width: Math.abs(valueAt(ticks[index + 1]) - valueAt(tick)), height: PLOT2.height, fill: index % 2 ? "rgba(200,200,200,.1)" : "rgba(250,250,250,.1)" }) : null,
4967
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: valueAt(tick), x2: valueAt(tick), y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#eee" }),
4968
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: valueAt(tick), y: valueAxisPosition === "top" ? PLOT2.y - 12 : PLOT_BOTTOM2 + 19, textAnchor: "middle", className: "sia-chart__axis-label", children: axisLabelFormatter?.(tick) ?? tick.toLocaleString("en-US") })
4984
+ legacy ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4985
+ showValueAxis ? ticks.map((tick, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("g", { children: orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4986
+ index < ticks.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: PLOT2.x, y: valueAt(ticks[index + 1]), width: PLOT2.width, height: Math.abs(valueAt(tick) - valueAt(ticks[index + 1])), fill: index % 2 ? "rgba(200,200,200,.1)" : "rgba(250,250,250,.1)" }) : null,
4987
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: valueAt(tick), y2: valueAt(tick), stroke: "#eee" }),
4988
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: PLOT2.x - 8, y: valueAt(tick) + 4, textAnchor: "end", className: "sia-chart__axis-label", children: axisLabelFormatter?.(tick) ?? tick.toLocaleString("en-US") })
4989
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4990
+ index < ticks.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: valueAt(tick), y: PLOT2.y, width: Math.abs(valueAt(ticks[index + 1]) - valueAt(tick)), height: PLOT2.height, fill: index % 2 ? "rgba(200,200,200,.1)" : "rgba(250,250,250,.1)" }) : null,
4991
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: valueAt(tick), x2: valueAt(tick), y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#eee" }),
4992
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: valueAt(tick), y: valueAxisPosition === "top" ? PLOT2.y - 12 : PLOT_BOTTOM2 + 19, textAnchor: "middle", className: "sia-chart__axis-label", children: axisLabelFormatter?.(tick) ?? tick.toLocaleString("en-US") })
4969
4993
  ] }) }, tick)) : null,
4970
- showCategorySplitLine && orientation === "vertical" ? categories.map((_, index) => index % labelStep ? null : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT2.x + index * band, x2: PLOT2.x + index * band, y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#eee" }, index)) : null,
4971
- showCategoryAxis ? categories.map((name, index) => index % labelStep ? null : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: orientation === "vertical" ? categoryAt(index) : PLOT2.x - 8, y: orientation === "vertical" ? PLOT_BOTTOM2 + 19 : categoryAt(index) + 4, textAnchor: orientation === "vertical" ? "middle" : "end", className: "sia-chart__axis-label", children: name }, index)) : null,
4972
- showValueAxis ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT2.x, x2: orientation === "vertical" ? PLOT2.x : PLOT2.x + PLOT2.width, y1: orientation === "vertical" || valueAxisPosition === "top" ? PLOT2.y : PLOT_BOTTOM2, y2: orientation === "horizontal" && valueAxisPosition === "top" ? PLOT2.y : PLOT_BOTTOM2, stroke: "#008acd", strokeWidth: 2 }) : null,
4973
- showCategoryAxis ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: orientation === "vertical" ? PLOT2.x : valueAt(0), x2: orientation === "vertical" ? PLOT2.x + PLOT2.width : valueAt(0), y1: orientation === "vertical" ? valueAt(0) : PLOT2.y, y2: orientation === "vertical" ? valueAt(0) : PLOT_BOTTOM2, stroke: "#008acd", strokeWidth: 2 }) : null
4974
- ] }) : orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CartesianAxes, { categories, domain, band: true }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4975
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { orientation: "bottom", x: PLOT2.x, y: PLOT_BOTTOM2, length: PLOT2.width, labels: ticks.map(formatChartNumber), gridLength: PLOT2.height }),
4976
- categories.map((name, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: PLOT2.x - 10, y: PLOT2.y + (index + 0.5) * band + 4, textAnchor: "end", className: "sia-chart__axis-label", children: name }, `${name}-${index}`))
4994
+ showCategorySplitLine && orientation === "vertical" ? categories.map((_, index) => index % labelStep ? null : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT2.x + index * band, x2: PLOT2.x + index * band, y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: "#eee" }, index)) : null,
4995
+ showCategoryAxis ? categories.map((name, index) => index % labelStep ? null : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: orientation === "vertical" ? categoryAt(index) : PLOT2.x - 8, y: orientation === "vertical" ? PLOT_BOTTOM2 + 19 : categoryAt(index) + 4, textAnchor: orientation === "vertical" ? "middle" : "end", className: "sia-chart__axis-label", children: name }, index)) : null,
4996
+ showValueAxis ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT2.x, x2: orientation === "vertical" ? PLOT2.x : PLOT2.x + PLOT2.width, y1: orientation === "vertical" || valueAxisPosition === "top" ? PLOT2.y : PLOT_BOTTOM2, y2: orientation === "horizontal" && valueAxisPosition === "top" ? PLOT2.y : PLOT_BOTTOM2, stroke: "#008acd", strokeWidth: 2 }) : null,
4997
+ showCategoryAxis ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: orientation === "vertical" ? PLOT2.x : valueAt(0), x2: orientation === "vertical" ? PLOT2.x + PLOT2.width : valueAt(0), y1: orientation === "vertical" ? valueAt(0) : PLOT2.y, y2: orientation === "vertical" ? valueAt(0) : PLOT_BOTTOM2, stroke: "#008acd", strokeWidth: 2 }) : null
4998
+ ] }) : orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CartesianAxes, { categories, domain, band: true }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
4999
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { orientation: "bottom", x: PLOT2.x, y: PLOT_BOTTOM2, length: PLOT2.width, labels: ticks.map(formatChartNumber), gridLength: PLOT2.height }),
5000
+ categories.map((name, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: PLOT2.x - 10, y: PLOT2.y + (index + 0.5) * band + 4, textAnchor: "end", className: "sia-chart__axis-label", children: name }, `${name}-${index}`))
4977
5001
  ] }),
4978
- tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { label: `${name}\u6570\u636E`, tooltip: axisTooltip(index), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: orientation === "vertical" ? categoryAt(index) - band / 2 : PLOT2.x, y: orientation === "vertical" ? PLOT2.y : categoryAt(index) - band / 2, width: orientation === "vertical" ? band : PLOT2.width, height: orientation === "vertical" ? PLOT2.height : band, fill: "transparent" }) }, `axis-${index}`)) : null,
5002
+ tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { label: `${name}\u6570\u636E`, tooltip: axisTooltip(index), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: orientation === "vertical" ? categoryAt(index) - band / 2 : PLOT2.x, y: orientation === "vertical" ? PLOT2.y : categoryAt(index) - band / 2, width: orientation === "vertical" ? band : PLOT2.width, height: orientation === "vertical" ? PLOT2.height : band, fill: "transparent" }) }, `axis-${index}`)) : null,
4979
5003
  activeSeries.map((item, seriesIndex) => {
4980
5004
  const originalSeriesIndex = series.indexOf(item);
4981
5005
  const seriesColor = getColor(originalSeriesIndex, item.color, palette);
@@ -4987,14 +5011,14 @@ var BarChart = (0, import_react34.forwardRef)(function BarChart2({ valueTransfer
4987
5011
  const groupCenter = (index) => categoryAt(index) - band / 2 + (band - occupied) / 2 + groupWidths.slice(0, groupIndex).reduce((sum, width) => sum + width, 0) + groupIndex * gap + groupWidths[groupIndex] / 2;
4988
5012
  const minimumIndex = seriesValues.indexOf(Math.min(...seriesValues));
4989
5013
  const maximumIndex = seriesValues.indexOf(Math.max(...seriesValues));
4990
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
4991
- statistics && item.statisticLines ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartBarStatistics, { values: statistics, kinds: item.statisticLines, project: valueAt, plot: PLOT2, horizontal: orientation === "horizontal", color: seriesColor, gradient: item.fillGradient, seriesName: item.name }) : null,
4992
- item.markAverage ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { className: "sia-chart__mark-line", style: legacy ? { color: seriesColor } : void 0, children: [
4993
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: orientation === "vertical" ? PLOT2.x : averagePosition, y1: orientation === "vertical" ? averagePosition : PLOT2.y, x2: orientation === "vertical" ? PLOT2.x + PLOT2.width : averagePosition, y2: orientation === "vertical" ? averagePosition : PLOT_BOTTOM2, stroke: seriesColor }),
4994
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: orientation === "vertical" ? PLOT2.x + PLOT2.width + (legacy ? 8 : -4) : averagePosition + 6, y: orientation === "vertical" ? averagePosition + (legacy ? 4 : -6) : PLOT2.y + 12, textAnchor: orientation === "vertical" && !legacy ? "end" : "start", children: legacy ? Number(average.toFixed(2)) : `\u5747\u503C ${formatChartNumber(average)}` })
5014
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
5015
+ statistics && item.statisticLines ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartBarStatistics, { values: statistics, kinds: item.statisticLines, project: valueAt, plot: PLOT2, horizontal: orientation === "horizontal", color: seriesColor, gradient: item.fillGradient, seriesName: item.name }) : null,
5016
+ item.markAverage ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { className: "sia-chart__mark-line", style: legacy ? { color: seriesColor } : void 0, children: [
5017
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: orientation === "vertical" ? PLOT2.x : averagePosition, y1: orientation === "vertical" ? averagePosition : PLOT2.y, x2: orientation === "vertical" ? PLOT2.x + PLOT2.width : averagePosition, y2: orientation === "vertical" ? averagePosition : PLOT_BOTTOM2, stroke: seriesColor }),
5018
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: orientation === "vertical" ? PLOT2.x + PLOT2.width + (legacy ? 8 : -4) : averagePosition + 6, y: orientation === "vertical" ? averagePosition + (legacy ? 4 : -6) : PLOT2.y + 12, textAnchor: orientation === "vertical" && !legacy ? "end" : "start", children: legacy ? Number(average.toFixed(2)) : `\u5747\u503C ${formatChartNumber(average)}` })
4995
5019
  ] }) : null,
4996
- item.markRange ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { className: "sia-chart__range-line", x1: orientation === "vertical" ? groupCenter(minimumIndex) : valueAt(seriesValues[minimumIndex]), y1: orientation === "vertical" ? valueAt(seriesValues[minimumIndex]) : groupCenter(minimumIndex), x2: orientation === "vertical" ? groupCenter(maximumIndex) : valueAt(seriesValues[maximumIndex]), y2: orientation === "vertical" ? valueAt(seriesValues[maximumIndex]) : groupCenter(maximumIndex), stroke: seriesColor, strokeDasharray: "7 7" }) : null,
4997
- item.markPoints?.map((mark, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPin, { point: orientation === "vertical" ? [groupCenter(mark.index), valueAt(mark.value)] : [valueAt(mark.value), groupCenter(mark.index)], color: seriesColor, label: mark.label ?? String(mark.value) }, index)),
5020
+ item.markRange ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { className: "sia-chart__range-line", x1: orientation === "vertical" ? groupCenter(minimumIndex) : valueAt(seriesValues[minimumIndex]), y1: orientation === "vertical" ? valueAt(seriesValues[minimumIndex]) : groupCenter(minimumIndex), x2: orientation === "vertical" ? groupCenter(maximumIndex) : valueAt(seriesValues[maximumIndex]), y2: orientation === "vertical" ? valueAt(seriesValues[maximumIndex]) : groupCenter(maximumIndex), stroke: seriesColor, strokeDasharray: "7 7" }) : null,
5021
+ item.markPoints?.map((mark, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPin, { point: orientation === "vertical" ? [groupCenter(mark.index), valueAt(mark.value)] : [valueAt(mark.value), groupCenter(mark.index)], color: seriesColor, label: mark.label ?? String(mark.value) }, index)),
4998
5022
  categories.map((name, index) => {
4999
5023
  const datum = barDatum(item.data[index] ?? 0);
5000
5024
  const value = datum.value;
@@ -5004,12 +5028,12 @@ var BarChart = (0, import_react34.forwardRef)(function BarChart2({ valueTransfer
5004
5028
  const slotGroup = layout.rows[seriesIndex]?.find(Boolean)?.group ?? 0;
5005
5029
  const stackTop = Math.max(0, ...layout.rows.map((row) => row[index]).filter((point) => point?.group === slotGroup).map((point) => point.end));
5006
5030
  const slot = groupCenter(index), zero = valueAt(stackTop), slotWidth = Math.max(8, groupWidths[slotGroup] ?? 10);
5007
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { ...transfer.props(originalSeriesIndex, index), label: `${item.name}\uFF0C${name}\uFF0C\u7A7A\u69FD`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5031
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { ...transfer.props(originalSeriesIndex, index), label: `${item.name}\uFF0C${name}\uFF0C\u7A7A\u69FD`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5008
5032
  item.name,
5009
5033
  " ",
5010
5034
  name,
5011
5035
  "\uFF1A\u7A7A\u69FD"
5012
- ] }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: orientation === "vertical" ? slot - slotWidth / 2 : zero - 7, y: orientation === "vertical" ? zero - 14 : slot - slotWidth / 2, width: orientation === "vertical" ? slotWidth : 14, height: orientation === "vertical" ? 14 : slotWidth, fill: "transparent", stroke: seriesColor, strokeDasharray: "3 2" }) }, `${name}-${index}`);
5036
+ ] }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: orientation === "vertical" ? slot - slotWidth / 2 : zero - 7, y: orientation === "vertical" ? zero - 14 : slot - slotWidth / 2, width: orientation === "vertical" ? slotWidth : 14, height: orientation === "vertical" ? 14 : slotWidth, fill: "transparent", stroke: seriesColor, strokeDasharray: "3 2" }) }, `${name}-${index}`);
5013
5037
  }
5014
5038
  const previous = placement.start;
5015
5039
  const groupIndex2 = placement.group;
@@ -5028,7 +5052,7 @@ var BarChart = (0, import_react34.forwardRef)(function BarChart2({ valueTransfer
5028
5052
  const color = (emphasized ? datum.emphasisColor ?? item.emphasisColor : void 0) ?? datum.color ?? seriesColor;
5029
5053
  const resolvedBorderColor = (emphasized ? datum.emphasisBorderColor ?? item.emphasisBorderColor : void 0) ?? datum.borderColor ?? item.borderColor;
5030
5054
  const extreme = item.markMin && value === Math.min(...seriesValues) || item.markMax && value === Math.max(...seriesValues);
5031
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPointMotion, { points: [[0, start], [0, end]], enabled: props.animation !== false && !dragBar, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: (motion) => {
5055
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPointMotion, { points: [[0, start], [0, end]], enabled: props.animation !== false && !dragBar, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: (motion) => {
5032
5056
  const animatedStart = motion[0][1];
5033
5057
  const animatedEnd = motion[1][1];
5034
5058
  const animatedX = orientation === "vertical" ? x : Math.min(animatedStart, animatedEnd);
@@ -5044,13 +5068,13 @@ var BarChart = (0, import_react34.forwardRef)(function BarChart2({ valueTransfer
5044
5068
  const borderWidth = Math.min((emphasized ? datum.emphasisBorderWidth ?? item.emphasisBorderWidth : void 0) ?? datum.borderWidth ?? item.borderWidth ?? 0, animatedWidth, animatedHeight);
5045
5069
  const labelY = labelPosition === "top" ? animatedY - 6 : labelPosition === "bottom" ? animatedY + animatedHeight + 14 : labelPosition === "insideTop" ? animatedY + 14 : animatedY + animatedHeight / 2 + 4;
5046
5070
  const label = (emphasized ? item.emphasisLabelFormatter?.(value, name, index) : void 0) ?? item.labelFormatter?.(value, name, index) ?? datum.label ?? (legacy ? value.toLocaleString("en-US") : formatChartNumber(value));
5047
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
5071
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5048
5072
  ChartMark,
5049
5073
  {
5050
5074
  className: calculable ? "sia-chart__calculable" : void 0,
5051
5075
  label: `${item.name}\uFF0C${name}\uFF0C${formatChartNumber(value)}`,
5052
5076
  style: invisible(color) ? { pointerEvents: "none" } : void 0,
5053
- tooltip: tooltipTrigger === "axis" ? axisTooltip(index) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }),
5077
+ tooltip: tooltipTrigger === "axis" ? axisTooltip(index) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }),
5054
5078
  tooltipPoint: [x + width / 2, y],
5055
5079
  onPointerDown: (event) => {
5056
5080
  if (!calculable) return;
@@ -5091,10 +5115,10 @@ var BarChart = (0, import_react34.forwardRef)(function BarChart2({ valueTransfer
5091
5115
  onBlur: () => setHoveredBar(void 0),
5092
5116
  ...transferProps,
5093
5117
  children: [
5094
- gradient ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("linearGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", x1: gradient.start[0], y1: gradient.start[1], x2: gradient.end[0], y2: gradient.end[1], children: gradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
5095
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: animatedX + borderWidth / 2, y: animatedY + borderWidth / 2, width: Math.max(0, animatedWidth - borderWidth), height: Math.max(0, animatedHeight - borderWidth), rx: item.radius ?? (legacy ? 5 : 4), fill: gradient ? `url(#${gradientId})` : color, stroke: resolvedBorderColor, strokeWidth: borderWidth, opacity: datum.opacity ?? item.opacity, style: { animation: "none", transition: "none" }, className: "sia-chart__bar" }),
5096
- showLabel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: labelX, y: labelY, textAnchor: labelPosition === "left" || labelPosition === "insideRight" ? "end" : labelPosition === "right" || labelPosition === "insideLeft" ? "start" : "middle", style: { fill: item.labelColor ?? (inside ? "#fff" : legacy ? gradient ? `url(#${gradientId})` : color : void 0), ...item.labelStyle, ...datum.labelStyle, ...emphasized ? { ...item.emphasisLabelStyle, ...datum.emphasisLabelStyle } : void 0 }, className: "sia-chart__point-label", children: typeof label === "string" && label.includes("\n") ? label.split("\n").map((line, i, lines) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tspan", { x: labelX, dy: i === 0 ? -(lines.length - 1) * 14 : 14, children: line || " " }, i)) : label }) : null,
5097
- extreme ? legacy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPin, { point: orientation === "vertical" ? [x + width / 2, y] : [x + width, y + height / 2], color, label: String(value) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: orientation === "vertical" ? x + width / 2 : x + width, cy: orientation === "vertical" ? y : y + height / 2, r: 5, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 }) : null
5118
+ gradient ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("linearGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", x1: gradient.start[0], y1: gradient.start[1], x2: gradient.end[0], y2: gradient.end[1], children: gradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
5119
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: animatedX + borderWidth / 2, y: animatedY + borderWidth / 2, width: Math.max(0, animatedWidth - borderWidth), height: Math.max(0, animatedHeight - borderWidth), rx: item.radius ?? (legacy ? 5 : 4), fill: gradient ? `url(#${gradientId})` : color, stroke: resolvedBorderColor, strokeWidth: borderWidth, opacity: datum.opacity ?? item.opacity, style: { animation: "none", transition: "none" }, className: "sia-chart__bar" }),
5120
+ showLabel ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: labelX, y: labelY, textAnchor: labelPosition === "left" || labelPosition === "insideRight" ? "end" : labelPosition === "right" || labelPosition === "insideLeft" ? "start" : "middle", style: { fill: item.labelColor ?? (inside ? "#fff" : legacy ? gradient ? `url(#${gradientId})` : color : void 0), ...item.labelStyle, ...datum.labelStyle, ...emphasized ? { ...item.emphasisLabelStyle, ...datum.emphasisLabelStyle } : void 0 }, className: "sia-chart__point-label", children: typeof label === "string" && label.includes("\n") ? label.split("\n").map((line, i, lines) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tspan", { x: labelX, dy: i === 0 ? -(lines.length - 1) * 14 : 14, children: line || " " }, i)) : label }) : null,
5121
+ extreme ? legacy ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPin, { point: orientation === "vertical" ? [x + width / 2, y] : [x + width, y + height / 2], color, label: String(value) }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: orientation === "vertical" ? x + width / 2 : x + width, cy: orientation === "vertical" ? y : y + height / 2, r: 5, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 }) : null
5098
5122
  ]
5099
5123
  },
5100
5124
  `${name}-${index}`
@@ -5103,29 +5127,29 @@ var BarChart = (0, import_react34.forwardRef)(function BarChart2({ valueTransfer
5103
5127
  })
5104
5128
  ] }, `${item.name}-${seriesIndex}`);
5105
5129
  }),
5106
- calculable && calculableMode === "transfer" ? transfer.islands.map((island, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { ...transfer.props(-1, index), label: `\u5B64\u5C9B ${island.name} ${island.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5130
+ calculable && calculableMode === "transfer" ? transfer.islands.map((island, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { ...transfer.props(-1, index), label: `\u5B64\u5C9B ${island.name} ${island.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5107
5131
  island.seriesName,
5108
5132
  " ",
5109
5133
  island.name,
5110
5134
  "\uFF1A",
5111
5135
  island.value
5112
5136
  ] }), children: [
5113
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: island.x, cy: island.y, r: 20, fill: "#fff", stroke: "#2ec7c9", strokeWidth: 2 }),
5114
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: island.x, y: island.y + 4, textAnchor: "middle", fontSize: 11, children: island.value })
5137
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: island.x, cy: island.y, r: 20, fill: "#fff", stroke: "#2ec7c9", strokeWidth: 2 }),
5138
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: island.x, y: island.y + 4, textAnchor: "middle", fontSize: 11, children: island.value })
5115
5139
  ] }, `bar-island-${index}`)) : null
5116
5140
  ] });
5117
5141
  });
5118
- var ScatterChart = (0, import_react34.forwardRef)(function ScatterChart2({ symbolAnimation = false, animationProgress, animationDurationUpdate = 500, statisticPoints = [], statisticLines = [], annotations = [], data: initialData, toolbox, showXAxis = true, showXSplitLine = true, showYSplitLine = true, tooltipFormatter, plotBounds, xDomain: fixedXDomain, yDomain: fixedYDomain, showPointLabels = false, yAxisPosition = "left", xCategories, xFormatter, crosshair = false, markColor, xSplitNumber = 5, ySplitNumber = 5, symbolSize, markAppearance = "label", markByCategory = false, xUnit = "", yUnit = "", minSymbolRadius = 5, xLabel, yLabel, xAxisType = "value", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, dataZoom = false, zoom, defaultZoom, onZoomChange, visualMap, markAverage, markExtremes = false, largeThreshold = 1200, onDataClick, palette, ...props }, ref) {
5119
- const [data, setData] = (0, import_react34.useState)(initialData);
5120
- const [emphasizedPoint, setEmphasizedPoint] = (0, import_react34.useState)(null);
5121
- const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react34.useState)();
5122
- (0, import_react34.useEffect)(() => setData(initialData), [initialData]);
5142
+ var ScatterChart = (0, import_react35.forwardRef)(function ScatterChart2({ symbolAnimation = false, animationProgress, animationDurationUpdate = 500, statisticPoints = [], statisticLines = [], annotations = [], data: initialData, toolbox, showXAxis = true, showXSplitLine = true, showYSplitLine = true, tooltipFormatter, plotBounds, xDomain: fixedXDomain, yDomain: fixedYDomain, showPointLabels = false, yAxisPosition = "left", xCategories, xFormatter, crosshair = false, markColor, xSplitNumber = 5, ySplitNumber = 5, symbolSize, markAppearance = "label", markByCategory = false, xUnit = "", yUnit = "", minSymbolRadius = 5, xLabel, yLabel, xAxisType = "value", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, dataZoom = false, zoom, defaultZoom, onZoomChange, visualMap, markAverage, markExtremes = false, largeThreshold = 1200, onDataClick, palette, ...props }, ref) {
5143
+ const [data, setData] = (0, import_react35.useState)(initialData);
5144
+ const [emphasizedPoint, setEmphasizedPoint] = (0, import_react35.useState)(null);
5145
+ const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react35.useState)();
5146
+ (0, import_react35.useEffect)(() => setData(initialData), [initialData]);
5123
5147
  const plot = plotBounds ?? PLOT, bottom = plot.y + plot.height;
5124
5148
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
5125
5149
  const allCategories = [...new Set(data.map((item) => item.category).filter((value) => Boolean(value)))];
5126
5150
  const legend = useLegendSelection(allCategories, legendSelected, onLegendSelectionChange);
5127
5151
  const activeData = data.filter((item) => !item.category || legend.isSelected(item.category));
5128
- const sorted = (0, import_react34.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
5152
+ const sorted = (0, import_react35.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
5129
5153
  const startIndex = dataZoom ? Math.floor(Math.min(...zoomValue) / 100 * Math.max(0, sorted.length - 1)) : 0;
5130
5154
  const endIndex = dataZoom ? Math.max(startIndex + 1, Math.ceil(Math.max(...zoomValue) / 100 * sorted.length)) : sorted.length;
5131
5155
  const categoryWindow = xCategories ? scatterCategoryWindow(xCategories, dataZoom ? zoomValue : [0, 100]) : void 0;
@@ -5140,10 +5164,10 @@ var ScatterChart = (0, import_react34.forwardRef)(function ScatterChart2({ symbo
5140
5164
  const visualMinimum = visualMap?.min ?? (visualValues.length ? Math.min(...visualValues) : 0);
5141
5165
  const visualMaximum = visualMap?.max ?? (visualValues.length ? Math.max(...visualValues) : 1);
5142
5166
  const visualColors = visualMap?.colors ?? ["#e6f4ff", "#1677ff"];
5143
- const [selectedPieces, setSelectedPieces] = (0, import_react34.useState)([]);
5144
- const [visualRange, setVisualRange] = (0, import_react34.useState)();
5167
+ const [selectedPieces, setSelectedPieces] = (0, import_react35.useState)([]);
5168
+ const [visualRange, setVisualRange] = (0, import_react35.useState)();
5145
5169
  const piecesKey = JSON.stringify(visualMap?.pieces ?? []);
5146
- (0, import_react34.useEffect)(() => setSelectedPieces([]), [piecesKey]);
5170
+ (0, import_react35.useEffect)(() => setSelectedPieces([]), [piecesKey]);
5147
5171
  const statistics = scatterStatistics(visibleData, markByCategory);
5148
5172
  const plotted = visibleData.map((item, index) => {
5149
5173
  const x = linearScale(categoryWindow ? categoryWindow.indexOf(item.x) : item.x, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]);
@@ -5157,7 +5181,7 @@ var ScatterChart = (0, import_react34.forwardRef)(function ScatterChart2({ symbo
5157
5181
  }).filter((point) => (!visualMap?.calculable || !visualRange || point.visualValue >= visualRange[0] && point.visualValue <= visualRange[1]) && (!visualMap?.selectable || point.pieceIndex < 0 || selectedPieces[point.pieceIndex] !== false));
5158
5182
  const dimensions = data.some((d) => d.value !== void 0) ? 3 : 2;
5159
5183
  const coordinates = (d) => dimensions === 3 ? [d.x, d.y, d.value ?? 0] : [d.x, d.y];
5160
- const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: allCategories.length ? allCategories.map((name) => ({ name, data: data.filter((d) => d.category === name).flatMap(coordinates) })) : [{ name: "\u6563\u70B9\u6570\u636E\uFF08x,y \u4EA4\u66FF\uFF09", data: data.flatMap(coordinates) }], onApply: (values) => {
5184
+ const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: allCategories.length ? allCategories.map((name) => ({ name, data: data.filter((d) => d.category === name).flatMap(coordinates) })) : [{ name: "\u6563\u70B9\u6570\u636E\uFF08x,y \u4EA4\u66FF\uFF09", data: data.flatMap(coordinates) }], onApply: (values) => {
5161
5185
  const cursors = values.map(() => 0);
5162
5186
  setData(data.map((d) => {
5163
5187
  const group = allCategories.length ? Math.max(0, allCategories.indexOf(d.category ?? "")) : 0, index = cursors[group];
@@ -5172,24 +5196,24 @@ var ScatterChart = (0, import_react34.forwardRef)(function ScatterChart2({ symbo
5172
5196
  setZoomValue(defaultZoom ? [...defaultZoom] : [0, 100]);
5173
5197
  toolbox.onRestore?.();
5174
5198
  } } : toolbox;
5175
- const content = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, toolbox: chartToolbox, ref, palette, empty: !visibleData.length, ariaLabel: props.ariaLabel ?? "\u6563\u70B9\u56FE", children: [
5176
- crosshair ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartCrosshair, { bounds: plot, xDomain: [xDomain[0], xDomain[1]], yDomain: [yDomain[0], yDomain[1]], formatX: (value) => {
5199
+ const content = /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, toolbox: chartToolbox, ref, palette, empty: !visibleData.length, ariaLabel: props.ariaLabel ?? "\u6563\u70B9\u56FE", children: [
5200
+ crosshair ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartCrosshair, { bounds: plot, xDomain: [xDomain[0], xDomain[1]], yDomain: [yDomain[0], yDomain[1]], formatX: (value) => {
5177
5201
  const axisValue = categoryWindow ? categoryWindow[Math.max(0, Math.min(categoryWindow.length - 1, Math.round(value)))] ?? 0 : value;
5178
5202
  return xFormatter ? xFormatter(axisValue) : xAxisType === "time" ? new Date(axisValue).toLocaleString() : `${Number(axisValue.toFixed(2))}${xUnit}`;
5179
5203
  }, formatY: (value) => `${Number(value.toFixed(2))}${yUnit}` }) : null,
5180
- showLegend && allCategories.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { items: allCategories.map((name, index) => ({ name, color: getColor(index, void 0, palette), disabled: !legend.isSelected(name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
5181
- showXAxis ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { positions: timeWindow ? xTicks.map((value) => (value - timeWindow[0]) / Math.max(1, timeWindow[1] - timeWindow[0])) : void 0, boundaryGap: !!categoryWindow, tickInterval: categoryWindow ? Math.max(1, Math.ceil(categoryWindow.length / 7)) : 1, orientation: "bottom", x: plot.x, y: bottom, length: plot.width, labels: xTicks.map((value) => xFormatter ? xFormatter(value) : xAxisType === "time" ? new Date(value).toLocaleDateString() : `${formatChartNumber(value)}${xUnit}`), gridLength: showXSplitLine ? plot.height : void 0 }) : null,
5182
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { boundaryGap: false, orientation: yAxisPosition, x: yAxisPosition === "right" ? plot.x + plot.width : plot.x, y: bottom, length: plot.height, labels: yTicks.map((value) => `${formatChartNumber(value)}${yUnit}`), gridLength: showYSplitLine ? plot.width : void 0 }),
5183
- xLabel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: plot.x + plot.width, y: bottom + 38, textAnchor: "end", className: "sia-chart__axis-name", children: xLabel }) : null,
5184
- yLabel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: plot.x, y: plot.y - 12, textAnchor: "start", className: "sia-chart__axis-name", children: yLabel }) : null,
5185
- visualMap ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartVisualMap, { calculable: visualMap.calculable, orientation: visualMap.orientation, range: visualRange ?? [visualMinimum, visualMaximum], onRangeChange: setVisualRange, min: visualMinimum, max: visualMaximum, colors: visualColors, pieces: visualMap.pieces, selectedPieces, onPieceToggle: visualMap.selectable ? (index) => setSelectedPieces((current) => {
5204
+ showLegend && allCategories.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { items: allCategories.map((name, index) => ({ name, color: getColor(index, void 0, palette), disabled: !legend.isSelected(name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
5205
+ showXAxis ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { positions: timeWindow ? xTicks.map((value) => (value - timeWindow[0]) / Math.max(1, timeWindow[1] - timeWindow[0])) : void 0, boundaryGap: !!categoryWindow, tickInterval: categoryWindow ? Math.max(1, Math.ceil(categoryWindow.length / 7)) : 1, orientation: "bottom", x: plot.x, y: bottom, length: plot.width, labels: xTicks.map((value) => xFormatter ? xFormatter(value) : xAxisType === "time" ? new Date(value).toLocaleDateString() : `${formatChartNumber(value)}${xUnit}`), gridLength: showXSplitLine ? plot.height : void 0 }) : null,
5206
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { boundaryGap: false, orientation: yAxisPosition, x: yAxisPosition === "right" ? plot.x + plot.width : plot.x, y: bottom, length: plot.height, labels: yTicks.map((value) => `${formatChartNumber(value)}${yUnit}`), gridLength: showYSplitLine ? plot.width : void 0 }),
5207
+ xLabel ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: plot.x + plot.width, y: bottom + 38, textAnchor: "end", className: "sia-chart__axis-name", children: xLabel }) : null,
5208
+ yLabel ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: plot.x, y: plot.y - 12, textAnchor: "start", className: "sia-chart__axis-name", children: yLabel }) : null,
5209
+ visualMap ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartVisualMap, { calculable: visualMap.calculable, orientation: visualMap.orientation, range: visualRange ?? [visualMinimum, visualMaximum], onRangeChange: setVisualRange, min: visualMinimum, max: visualMaximum, colors: visualColors, pieces: visualMap.pieces, selectedPieces, onPieceToggle: visualMap.selectable ? (index) => setSelectedPieces((current) => {
5186
5210
  const next = [...current];
5187
5211
  next[index] = current[index] === false;
5188
5212
  return next;
5189
5213
  }) : void 0, x: visualMap.x ?? plot.x + plot.width - 116, y: visualMap.y ?? 322, width: visualMap.width ?? 116, label: visualMap.label }) : null,
5190
- markAverage === "x" || markAverage === "both" ? statistics.map((stat) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { className: "sia-chart__mark-line", children: [
5191
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { style: { stroke: markColor ?? (markByCategory ? getColor(Math.max(0, allCategories.indexOf(stat.category)), void 0, palette) : void 0) }, x1: linearScale(stat.averageX, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]), y1: plot.y, x2: linearScale(stat.averageX, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]), y2: bottom }),
5192
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("text", { x: linearScale(stat.averageX, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]) + 5, y: plot.y + 12, children: [
5214
+ markAverage === "x" || markAverage === "both" ? statistics.map((stat) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { className: "sia-chart__mark-line", children: [
5215
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { style: { stroke: markColor ?? (markByCategory ? getColor(Math.max(0, allCategories.indexOf(stat.category)), void 0, palette) : void 0) }, x1: linearScale(stat.averageX, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]), y1: plot.y, x2: linearScale(stat.averageX, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]), y2: bottom }),
5216
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("text", { x: linearScale(stat.averageX, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]) + 5, y: plot.y + 12, children: [
5193
5217
  markByCategory ? stat.category + " " : "",
5194
5218
  "\u5747\u503C ",
5195
5219
  stat.averageX.toFixed(2)
@@ -5199,26 +5223,26 @@ var ScatterChart = (0, import_react34.forwardRef)(function ScatterChart2({ symbo
5199
5223
  const y = linearScale(stat.averageY, [yDomain[0], yDomain[1]], [bottom, plot.y]);
5200
5224
  const color = markColor ?? (markByCategory ? getColor(Math.max(0, allCategories.indexOf(stat.category)), void 0, palette) : void 0);
5201
5225
  const pin = markAppearance === "pin", end = plot.x + plot.width;
5202
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { className: "sia-chart__mark-line", children: [
5203
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { style: { stroke: color }, x1: plot.x, y1: y, x2: end, y2: y }),
5204
- pin ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5205
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: plot.x, cy: y, r: 2, fill: color }),
5206
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: `M ${end - 7} ${y - 4} L ${end} ${y} L ${end - 7} ${y + 4} Z`, fill: color })
5226
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { className: "sia-chart__mark-line", children: [
5227
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { style: { stroke: color }, x1: plot.x, y1: y, x2: end, y2: y }),
5228
+ pin ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5229
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: plot.x, cy: y, r: 2, fill: color }),
5230
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: `M ${end - 7} ${y - 4} L ${end} ${y} L ${end - 7} ${y + 4} Z`, fill: color })
5207
5231
  ] }) : null,
5208
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: pin ? end + 8 : end - 4, y: pin ? y + 4 : y - 6, textAnchor: pin ? "start" : "end", style: pin ? { fill: color } : void 0, children: pin ? Number(stat.averageY.toFixed(2)) : `${markByCategory ? stat.category + " " : ""}\u5747\u503C ${stat.averageY.toFixed(2)}` })
5232
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: pin ? end + 8 : end - 4, y: pin ? y + 4 : y - 6, textAnchor: pin ? "start" : "end", style: pin ? { fill: color } : void 0, children: pin ? Number(stat.averageY.toFixed(2)) : `${markByCategory ? stat.category + " " : ""}\u5747\u503C ${stat.averageY.toFixed(2)}` })
5209
5233
  ] }, stat.category);
5210
5234
  }) : null,
5211
- plotted.length >= largeThreshold ? buildScatterBatches(plotted.map(({ x, y, item, color }) => ({ x, y, color, radius: Math.max(1, (item.size ?? 6) / 2) }))).map((batch) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: batch.path, "data-point-count": batch.count, fill: batch.color, opacity: 0.66, className: "sia-chart__large-scatter" }, batch.color)) : plotted.map(({ item, index, x, y, color: baseColor }) => {
5235
+ plotted.length >= largeThreshold ? buildScatterBatches(plotted.map(({ x, y, item, color }) => ({ x, y, color, radius: Math.max(1, (item.size ?? 6) / 2) }))).map((batch) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: batch.path, "data-point-count": batch.count, fill: batch.color, opacity: 0.66, className: "sia-chart__large-scatter" }, batch.color)) : plotted.map(({ item, index, x, y, color: baseColor }) => {
5212
5236
  const emphasized = emphasizedPoint === index;
5213
5237
  const color = emphasized ? item.emphasisColor ?? baseColor : baseColor;
5214
5238
  const borderWidth = emphasized ? item.emphasisBorderWidth ?? item.borderWidth : item.borderWidth;
5215
5239
  const name = item.name ?? `\u6570\u636E\u70B9 ${index + 1}`;
5216
5240
  const stats = statistics.find((s) => s.category === (markByCategory ? item.category ?? "" : ""));
5217
5241
  const extreme = markExtremes && stats && (item.y === stats.maxY || item.y === stats.minY);
5218
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartScatterMotion, { x, y, radius: item.size ?? 9, enabled: symbolAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { label: `${name}\uFF0C${item.x}\uFF0C${item.y}`, onPointerEnter: () => setEmphasizedPoint(index), onPointerLeave: () => setEmphasizedPoint(null), onFocus: () => setEmphasizedPoint(index), onBlur: () => setEmphasizedPoint(null), tooltip: tooltipFormatter ? tooltipFormatter(item) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5219
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: name }),
5220
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: item.category }),
5221
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("b", { children: [
5242
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartScatterMotion, { x, y, radius: item.size ?? 9, enabled: symbolAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { label: `${name}\uFF0C${item.x}\uFF0C${item.y}`, onPointerEnter: () => setEmphasizedPoint(index), onPointerLeave: () => setEmphasizedPoint(null), onFocus: () => setEmphasizedPoint(index), onBlur: () => setEmphasizedPoint(null), tooltip: tooltipFormatter ? tooltipFormatter(item) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5243
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: name }),
5244
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: item.category }),
5245
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("b", { children: [
5222
5246
  xAxisType === "time" ? new Date(item.x).toLocaleString() : xFormatter ? xFormatter(item.x) : item.x,
5223
5247
  xUnit,
5224
5248
  ", ",
@@ -5227,28 +5251,28 @@ var ScatterChart = (0, import_react34.forwardRef)(function ScatterChart2({ symbo
5227
5251
  item.value !== void 0 ? `, ${item.value}` : ""
5228
5252
  ] })
5229
5253
  ] }), tooltipPoint: [x, y], onPointerUp: (event) => onDataClick?.({ name, value: [item.x, item.y], seriesName: item.category, data: item, nativeEvent: event }), children: [
5230
- item.symbol === "image" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("image", { "data-scatter-symbol": "image", href: item.symbolImage, x: x - (item.size ?? 9), y: y - (item.size ?? 9), width: (item.size ?? 9) * 2, height: (item.size ?? 9) * 2 }) : item.symbol === "emptyCircle" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { "data-scatter-symbol": "emptyCircle", cx: x, cy: y, r: item.size ?? 9, fill: item.symbolFill ?? "#fff", stroke: color, strokeWidth: borderWidth ?? 2 }) : item.symbol === "emptyTriangle" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { "data-scatter-symbol": "emptyTriangle", d: `M ${x} ${y - (item.size ?? 9)} L ${x + (item.size ?? 9)} ${y + (item.size ?? 9)} L ${x - (item.size ?? 9)} ${y + (item.size ?? 9)} Z`, fill: item.symbolFill ?? "#fff", stroke: color, strokeWidth: borderWidth ?? 2, transform: `rotate(${item.symbolRotate ?? 0} ${x} ${y})` }) : item.symbol === "square" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: x - Math.max(5, item.size ?? 9), y: y - Math.max(5, item.size ?? 9), width: Math.max(10, (item.size ?? 9) * 2), height: Math.max(10, (item.size ?? 9) * 2), fill: color, className: "sia-chart__bubble" }) : item.symbol === "diamond" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: x - Math.max(4, (item.size ?? 9) * 0.7), y: y - Math.max(4, (item.size ?? 9) * 0.7), width: Math.max(8, (item.size ?? 9) * 1.4), height: Math.max(8, (item.size ?? 9) * 1.4), transform: `rotate(45 ${x} ${y})`, fill: color, className: "sia-chart__bubble" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: x, cy: y, r: Math.max(minSymbolRadius, item.size ?? 9), fill: color, className: "sia-chart__bubble" }),
5231
- (emphasized ? item.showEmphasisLabel ?? item.showLabel ?? showPointLabels : item.showLabel ?? showPointLabels) ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x, y: y - Math.max(minSymbolRadius, item.size ?? 9) - 7, textAnchor: "middle", className: "sia-chart__point-label", style: { fill: color, ...item.labelStyle }, children: item.labelFormatter?.(item) ?? item.label ?? name }) : null,
5232
- extreme && markAppearance === "label" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x, y: y - Math.max(5, item.size ?? 9) - 7, textAnchor: "middle", className: "sia-chart__point-label", children: formatChartNumber(item.y) }) : null
5254
+ item.symbol === "image" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("image", { "data-scatter-symbol": "image", href: item.symbolImage, x: x - (item.size ?? 9), y: y - (item.size ?? 9), width: (item.size ?? 9) * 2, height: (item.size ?? 9) * 2 }) : item.symbol === "emptyCircle" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { "data-scatter-symbol": "emptyCircle", cx: x, cy: y, r: item.size ?? 9, fill: item.symbolFill ?? "#fff", stroke: color, strokeWidth: borderWidth ?? 2 }) : item.symbol === "emptyTriangle" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { "data-scatter-symbol": "emptyTriangle", d: `M ${x} ${y - (item.size ?? 9)} L ${x + (item.size ?? 9)} ${y + (item.size ?? 9)} L ${x - (item.size ?? 9)} ${y + (item.size ?? 9)} Z`, fill: item.symbolFill ?? "#fff", stroke: color, strokeWidth: borderWidth ?? 2, transform: `rotate(${item.symbolRotate ?? 0} ${x} ${y})` }) : item.symbol === "square" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: x - Math.max(5, item.size ?? 9), y: y - Math.max(5, item.size ?? 9), width: Math.max(10, (item.size ?? 9) * 2), height: Math.max(10, (item.size ?? 9) * 2), fill: color, className: "sia-chart__bubble" }) : item.symbol === "diamond" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: x - Math.max(4, (item.size ?? 9) * 0.7), y: y - Math.max(4, (item.size ?? 9) * 0.7), width: Math.max(8, (item.size ?? 9) * 1.4), height: Math.max(8, (item.size ?? 9) * 1.4), transform: `rotate(45 ${x} ${y})`, fill: color, className: "sia-chart__bubble" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: x, cy: y, r: Math.max(minSymbolRadius, item.size ?? 9), fill: color, className: "sia-chart__bubble" }),
5255
+ (emphasized ? item.showEmphasisLabel ?? item.showLabel ?? showPointLabels : item.showLabel ?? showPointLabels) ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x, y: y - Math.max(minSymbolRadius, item.size ?? 9) - 7, textAnchor: "middle", className: "sia-chart__point-label", style: { fill: color, ...item.labelStyle }, children: item.labelFormatter?.(item) ?? item.label ?? name }) : null,
5256
+ extreme && markAppearance === "label" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x, y: y - Math.max(5, item.size ?? 9) - 7, textAnchor: "middle", className: "sia-chart__point-label", children: formatChartNumber(item.y) }) : null
5233
5257
  ] }, `${name}-${index}`) }, `${name}-${index}`);
5234
5258
  }),
5235
5259
  markExtremes && markAppearance === "pin" ? statistics.flatMap((stat) => [stat.maxY, stat.minY].map((value, kind) => {
5236
5260
  const point = plotted.find((p) => p.item.y === value && (!markByCategory || (p.item.category ?? "") === stat.category));
5237
5261
  if (!point) return null;
5238
5262
  const { x, y, color } = point, label = String(value), radius = Math.max(15, label.length * 4);
5239
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { label: `${stat.category} ${kind ? "\u6700\u5C0F\u503C" : "\u6700\u5927\u503C"} ${label}${yUnit}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5240
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("strong", { children: [
5263
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { label: `${stat.category} ${kind ? "\u6700\u5C0F\u503C" : "\u6700\u5927\u503C"} ${label}${yUnit}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5264
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("strong", { children: [
5241
5265
  stat.category,
5242
5266
  " ",
5243
5267
  kind ? "\u6700\u5C0F\u503C" : "\u6700\u5927\u503C"
5244
5268
  ] }),
5245
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("b", { children: [
5269
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("b", { children: [
5246
5270
  label,
5247
5271
  yUnit
5248
5272
  ] })
5249
5273
  ] }), tooltipPoint: [x, y], children: [
5250
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { "data-scatter-extreme": kind ? "min" : "max", d: `M ${x} ${y} C ${x - radius * 0.3} ${y - radius * 0.6} ${x - radius} ${y - radius} ${x - radius} ${y - radius * 1.6} A ${radius} ${radius} 0 1 1 ${x + radius} ${y - radius * 1.6} C ${x + radius} ${y - radius} ${x + radius * 0.3} ${y - radius * 0.6} ${x} ${y} Z`, fill: color }),
5251
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x, y: y - radius * 1.6, textAnchor: "middle", dominantBaseline: "central", style: { fill: "#fff", fontSize: 12, pointerEvents: "none" }, children: label })
5274
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { "data-scatter-extreme": kind ? "min" : "max", d: `M ${x} ${y} C ${x - radius * 0.3} ${y - radius * 0.6} ${x - radius} ${y - radius} ${x - radius} ${y - radius * 1.6} A ${radius} ${radius} 0 1 1 ${x + radius} ${y - radius * 1.6} C ${x + radius} ${y - radius} ${x + radius * 0.3} ${y - radius * 0.6} ${x} ${y} Z`, fill: color }),
5275
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x, y: y - radius * 1.6, textAnchor: "middle", dominantBaseline: "central", style: { fill: "#fff", fontSize: 12, pointerEvents: "none" }, children: label })
5252
5276
  ] }, `${stat.category}-${kind}`);
5253
5277
  })) : null,
5254
5278
  statisticLines.map((mark) => {
@@ -5257,16 +5281,16 @@ var ScatterChart = (0, import_react34.forwardRef)(function ScatterChart2({ symbo
5257
5281
  const value = selected.reduce((sum, item) => sum + item[mark.dimension], 0) / selected.length;
5258
5282
  const vertical = mark.dimension === "x", position = vertical ? linearScale(value, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]) : linearScale(value, [yDomain[0], yDomain[1]], [bottom, plot.y]);
5259
5283
  const x1 = vertical ? position : plot.x, y1 = vertical ? bottom : position, x2 = vertical ? position : plot.x + plot.width, y2 = vertical ? plot.y : position, color = mark.color ?? "#2ec7c9", key = `statistic-${mark.name}`, width = emphasizedAnnotation === key ? 3.5 : 1.5;
5260
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPointMotion, { points: [[x1, y1], [x2, y2]], origin: [x1, y1], enabled: symbolAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: (frame) => {
5284
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPointMotion, { points: [[x1, y1], [x2, y2]], origin: [x1, y1], enabled: symbolAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: (frame) => {
5261
5285
  const [[x12, y12], [x22, y22]] = frame;
5262
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { "data-scatter-statistic": mark.dimension, label: `${mark.name}\uFF0C${value.toFixed(2)}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5263
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: mark.name }),
5264
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: value.toFixed(2) })
5286
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { "data-scatter-statistic": mark.dimension, label: `${mark.name}\uFF0C${value.toFixed(2)}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5287
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: mark.name }),
5288
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: value.toFixed(2) })
5265
5289
  ] }), tooltipPoint: [x22, y22], onPointerEnter: () => setEmphasizedAnnotation(key), onPointerLeave: () => setEmphasizedAnnotation(void 0), onFocus: () => setEmphasizedAnnotation(key), onBlur: () => setEmphasizedAnnotation(void 0), children: [
5266
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: x12, y1: y12, x2: x22, y2: y22, stroke: color, strokeWidth: width, strokeDasharray: "5 5" }),
5267
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: x12, cy: y12, r: 2, fill: color }),
5268
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: vertical ? `M ${x22 - 4} ${y22 + 8} L ${x22} ${y22} L ${x22 + 4} ${y22 + 8} Z` : `M ${x22 - 8} ${y22 - 4} L ${x22} ${y22} L ${x22 - 8} ${y22 + 4} Z`, fill: color }),
5269
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: vertical ? x22 : x22 + 5, y: vertical ? y22 - 5 : y22 + 4, textAnchor: vertical ? "middle" : "start", style: { fill: color, fontSize: 12 }, children: value.toFixed(2) })
5290
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: x12, y1: y12, x2: x22, y2: y22, stroke: color, strokeWidth: width, strokeDasharray: "5 5" }),
5291
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: x12, cy: y12, r: 2, fill: color }),
5292
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: vertical ? `M ${x22 - 4} ${y22 + 8} L ${x22} ${y22} L ${x22 + 4} ${y22 + 8} Z` : `M ${x22 - 8} ${y22 - 4} L ${x22} ${y22} L ${x22 - 8} ${y22 + 4} Z`, fill: color }),
5293
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: vertical ? x22 : x22 + 5, y: vertical ? y22 - 5 : y22 + 4, textAnchor: vertical ? "middle" : "start", style: { fill: color, fontSize: 12 }, children: value.toFixed(2) })
5270
5294
  ] }, key);
5271
5295
  } }, key);
5272
5296
  }),
@@ -5276,33 +5300,33 @@ var ScatterChart = (0, import_react34.forwardRef)(function ScatterChart2({ symbo
5276
5300
  const point = selected.reduce((best, item) => (mark.kind === "max" ? item[mark.dimension] > best[mark.dimension] : item[mark.dimension] < best[mark.dimension]) ? item : best);
5277
5301
  const x = linearScale(categoryWindow ? categoryWindow.indexOf(point.x) : point.x, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]), y = linearScale(point.y, [yDomain[0], yDomain[1]], [bottom, plot.y]);
5278
5302
  const size = mark.size ?? 34, symbol = mark.symbol ?? "pin", color = mark.color ?? "#2ec7c9", key = `extreme-${mark.name}`, value = point[mark.dimension];
5279
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartScatterMotion, { x, y, radius: size / 2, enabled: symbolAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { "data-scatter-statistic-point": mark.name, label: `${mark.name}\uFF0C${value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5280
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: mark.name }),
5281
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: value })
5303
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartScatterMotion, { x, y, radius: size / 2, enabled: symbolAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { "data-scatter-statistic-point": mark.name, label: `${mark.name}\uFF0C${value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5304
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: mark.name }),
5305
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: value })
5282
5306
  ] }), tooltipPoint: [x, y], onPointerEnter: () => setEmphasizedAnnotation(key), onPointerLeave: () => setEmphasizedAnnotation(void 0), onFocus: () => setEmphasizedAnnotation(key), onBlur: () => setEmphasizedAnnotation(void 0), children: [
5283
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: chartMarkerPath(symbol, x, y, size), fill: color, stroke: mark.borderColor ?? color, strokeWidth: emphasizedAnnotation === key ? 4 : 2 }),
5284
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x, y: symbol === "pin" ? y - size * 0.75 + 4 : y + 4, textAnchor: "middle", style: { fill: "#fff", fontSize: 12, pointerEvents: "none" }, children: value })
5307
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: chartMarkerPath(symbol, x, y, size), fill: color, stroke: mark.borderColor ?? color, strokeWidth: emphasizedAnnotation === key ? 4 : 2 }),
5308
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x, y: symbol === "pin" ? y - size * 0.75 + 4 : y + 4, textAnchor: "middle", style: { fill: "#fff", fontSize: 12, pointerEvents: "none" }, children: value })
5285
5309
  ] }, key) }, key);
5286
5310
  }),
5287
5311
  annotations.filter((mark) => !mark.category || legend.isSelected(mark.category)).map((mark) => {
5288
5312
  const x = linearScale(categoryWindow ? categoryWindow.indexOf(mark.x) : mark.x, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]);
5289
5313
  const y = linearScale(mark.y, [yDomain[0], yDomain[1]], [bottom, plot.y]), radius = mark.radius ?? 20, color = mark.color ?? "#2ec7c9";
5290
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartScatterMotion, { x, y, radius, enabled: symbolAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { label: `${mark.name}\uFF0C${mark.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5291
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: mark.name }),
5292
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: mark.value.toLocaleString("en-US") })
5314
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartScatterMotion, { x, y, radius, enabled: symbolAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { label: `${mark.name}\uFF0C${mark.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5315
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: mark.name }),
5316
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: mark.value.toLocaleString("en-US") })
5293
5317
  ] }), tooltipPoint: [x, y], onPointerEnter: () => setEmphasizedAnnotation(mark.name), onPointerLeave: () => setEmphasizedAnnotation(void 0), onFocus: () => setEmphasizedAnnotation(mark.name), onBlur: () => setEmphasizedAnnotation(void 0), children: [
5294
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { "data-scatter-annotation": mark.name, cx: x, cy: y, r: radius, fill: "none", stroke: color, strokeWidth: emphasizedAnnotation === mark.name ? 4 : 2, pointerEvents: "stroke" }),
5295
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x, y: y - radius - 5, textAnchor: "middle", style: { fill: color, fontSize: 12, fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1, Arial, Verdana, sans-serif" }, children: mark.value.toLocaleString("en-US") })
5318
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { "data-scatter-annotation": mark.name, cx: x, cy: y, r: radius, fill: "none", stroke: color, strokeWidth: emphasizedAnnotation === mark.name ? 4 : 2, pointerEvents: "stroke" }),
5319
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x, y: y - radius - 5, textAnchor: "middle", style: { fill: color, fontSize: 12, fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1, Arial, Verdana, sans-serif" }, children: mark.value.toLocaleString("en-US") })
5296
5320
  ] }, `annotation-${mark.name}`) }, `annotation-${mark.name}`);
5297
5321
  })
5298
5322
  ] });
5299
- return dataZoom ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "sia-chart-with-zoom", children: [
5323
+ return dataZoom ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "sia-chart-with-zoom", children: [
5300
5324
  content,
5301
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue })
5325
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue })
5302
5326
  ] }) : content;
5303
5327
  });
5304
- var CandlestickChart = (0, import_react34.forwardRef)(function CandlestickChart2({ showAxes = true, data: initialData, valueDomain, axisLabelFormatter, activeIndex, onActiveIndexChange, seriesVisible: controlledVisible, onSeriesVisibilityChange, showLegend = true, showCategoryLabels = true, plotBounds, markPoints, seriesName, risingBorderColor, fallingBorderColor, borderWidth = 2, risingEmphasisColor, fallingEmphasisColor, maxBarWidth = 34, appearance = "sia", risingColor = "#f5222d", fallingColor = "#52c41a", hollowRising = false, dataZoom = false, zoom, defaultZoom, onZoomChange, markExtremes = false, onDataClick, toolbox, ...props }, ref) {
5305
- const [data, setData] = (0, import_react34.useState)(initialData), [internalActive, setInternalActive] = (0, import_react34.useState)(null), [internalVisible, setInternalVisible] = (0, import_react34.useState)(true);
5328
+ var CandlestickChart = (0, import_react35.forwardRef)(function CandlestickChart2({ showAxes = true, data: initialData, valueDomain, axisLabelFormatter, activeIndex, onActiveIndexChange, seriesVisible: controlledVisible, onSeriesVisibilityChange, showLegend = true, showCategoryLabels = true, plotBounds, markPoints, seriesName, risingBorderColor, fallingBorderColor, borderWidth = 2, risingEmphasisColor, fallingEmphasisColor, maxBarWidth = 34, appearance = "sia", risingColor = "#f5222d", fallingColor = "#52c41a", hollowRising = false, dataZoom = false, zoom, defaultZoom, onZoomChange, markExtremes = false, onDataClick, toolbox, ...props }, ref) {
5329
+ const [data, setData] = (0, import_react35.useState)(initialData), [internalActive, setInternalActive] = (0, import_react35.useState)(null), [internalVisible, setInternalVisible] = (0, import_react35.useState)(true);
5306
5330
  const active = activeIndex === void 0 ? internalActive : activeIndex;
5307
5331
  const seriesVisible = controlledVisible ?? internalVisible;
5308
5332
  const setActive = (index) => {
@@ -5313,7 +5337,7 @@ var CandlestickChart = (0, import_react34.forwardRef)(function CandlestickChart2
5313
5337
  if (controlledVisible === void 0) setInternalVisible(visible);
5314
5338
  onSeriesVisibilityChange?.(visible);
5315
5339
  };
5316
- (0, import_react34.useEffect)(() => {
5340
+ (0, import_react35.useEffect)(() => {
5317
5341
  setData(initialData);
5318
5342
  }, [initialData]);
5319
5343
  const legacy = appearance === "macarons";
@@ -5327,20 +5351,20 @@ var CandlestickChart = (0, import_react34.forwardRef)(function CandlestickChart2
5327
5351
  const band = plot.width / Math.max(1, visibleData.length);
5328
5352
  const highest = Math.max(...visibleData.map((item) => item.high));
5329
5353
  const lowest = Math.min(...visibleData.map((item) => item.low));
5330
- const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: data.map((d) => ({ name: d.name, data: [d.open, d.close, d.low, d.high] })), onApply: (values) => setData(data.map((d, i) => ({ ...d, open: values[i][0], close: values[i][1], low: values[i][2], high: values[i][3] }))) }), onRestore: () => {
5354
+ const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: data.map((d) => ({ name: d.name, data: [d.open, d.close, d.low, d.high] })), onApply: (values) => setData(data.map((d, i) => ({ ...d, open: values[i][0], close: values[i][1], low: values[i][2], high: values[i][3] }))) }), onRestore: () => {
5331
5355
  setData(initialData);
5332
5356
  setZoomValue(defaultZoom ? [...defaultZoom] : [0, 100]);
5333
5357
  setActive(null);
5334
5358
  setSeriesVisible(true);
5335
5359
  toolbox.onRestore?.();
5336
5360
  } } : toolbox;
5337
- const zoomControl = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue, dataShadow: data.map((d) => d.close), showDetail: !legacy });
5338
- const content = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, toolbox: chartToolbox, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, empty: !visibleData.length, ariaLabel: props.ariaLabel ?? "K \u7EBF\u56FE", children: [
5339
- showLegend && seriesName ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { x: (props.viewBoxSize?.[0] ?? 720) / 2, items: [{ name: seriesName, color: risingColor }], selected: { [seriesName]: seriesVisible }, onItemClick: () => setSeriesVisible(!seriesVisible) }) : null,
5340
- showAxes ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { boundaryGap: false, orientation: "left", x: plot.x, y: bottom, length: plot.height, labels: chartTicks(domain).map((v) => axisLabelFormatter ? axisLabelFormatter(v) : legacy ? v.toLocaleString("en-US") : formatChartNumber(v)), gridLength: plot.width }) : null,
5341
- showAxes ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: plot.x, y1: bottom, x2: plot.x + plot.width, y2: bottom, className: "sia-chart__axis-line" }) : null,
5342
- showCategoryLabels ? visibleData.map((d, i) => i % Math.max(1, Math.ceil(visibleData.length / 6)) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: plot.x + (i + 0.5) * band, y: bottom + 20, textAnchor: "middle", className: "sia-chart__axis-label", children: d.name }, d.name) : null) : null,
5343
- seriesVisible && active != null && active >= startIndex && active < endIndex ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { "data-candlestick-active-index": active, x: plot.x + (active - startIndex) * band, y: plot.y, width: band, height: plot.height, fill: "currentColor", opacity: 0.06, pointerEvents: "none" }) : null,
5361
+ const zoomControl = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue, dataShadow: data.map((d) => d.close), showDetail: !legacy });
5362
+ const content = /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, toolbox: chartToolbox, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, empty: !visibleData.length, ariaLabel: props.ariaLabel ?? "K \u7EBF\u56FE", children: [
5363
+ showLegend && seriesName ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { x: (props.viewBoxSize?.[0] ?? 720) / 2, items: [{ name: seriesName, color: risingColor }], selected: { [seriesName]: seriesVisible }, onItemClick: () => setSeriesVisible(!seriesVisible) }) : null,
5364
+ showAxes ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { boundaryGap: false, orientation: "left", x: plot.x, y: bottom, length: plot.height, labels: chartTicks(domain).map((v) => axisLabelFormatter ? axisLabelFormatter(v) : legacy ? v.toLocaleString("en-US") : formatChartNumber(v)), gridLength: plot.width }) : null,
5365
+ showAxes ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: plot.x, y1: bottom, x2: plot.x + plot.width, y2: bottom, className: "sia-chart__axis-line" }) : null,
5366
+ showCategoryLabels ? visibleData.map((d, i) => i % Math.max(1, Math.ceil(visibleData.length / 6)) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: plot.x + (i + 0.5) * band, y: bottom + 20, textAnchor: "middle", className: "sia-chart__axis-label", children: d.name }, d.name) : null) : null,
5367
+ seriesVisible && active != null && active >= startIndex && active < endIndex ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { "data-candlestick-active-index": active, x: plot.x + (active - startIndex) * band, y: plot.y, width: band, height: plot.height, fill: "currentColor", opacity: 0.06, pointerEvents: "none" }) : null,
5344
5368
  seriesVisible ? visibleData.map((item, index) => {
5345
5369
  const x = plot.x + (index + 0.5) * band;
5346
5370
  const openY = linearScale(item.open, [domain[0], domain[1]], [bottom, plot.y]);
@@ -5352,32 +5376,32 @@ var CandlestickChart = (0, import_react34.forwardRef)(function CandlestickChart2
5352
5376
  const color = active === index + startIndex ? item.emphasisColor ?? (rising ? risingEmphasisColor : fallingEmphasisColor) ?? normalColor : normalColor;
5353
5377
  const stroke = item.borderColor ?? (rising ? risingBorderColor : fallingBorderColor) ?? normalColor;
5354
5378
  const candleWidth = Math.min(maxBarWidth, band * 0.6);
5355
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { onPointerMove: () => setActive(index + startIndex), onPointerLeave: () => setActive(null), onFocus: () => setActive(index + startIndex), onBlur: () => setActive(null), label: `${item.name}\uFF0C\u5F00\u76D8 ${item.open}\uFF0C\u6536\u76D8 ${item.close}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5356
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("strong", { children: [
5379
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { onPointerMove: () => setActive(index + startIndex), onPointerLeave: () => setActive(null), onFocus: () => setActive(index + startIndex), onBlur: () => setActive(null), label: `${item.name}\uFF0C\u5F00\u76D8 ${item.open}\uFF0C\u6536\u76D8 ${item.close}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5380
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("strong", { children: [
5357
5381
  seriesName,
5358
5382
  " ",
5359
5383
  item.name
5360
5384
  ] }),
5361
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
5385
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
5362
5386
  "\u5F00\u76D8 ",
5363
5387
  item.open,
5364
5388
  "\u3000\u6700\u9AD8 ",
5365
5389
  item.high
5366
5390
  ] }),
5367
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
5391
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
5368
5392
  "\u6536\u76D8 ",
5369
5393
  item.close,
5370
5394
  "\u3000\u6700\u4F4E ",
5371
5395
  item.low
5372
5396
  ] })
5373
5397
  ] }), tooltipPoint: [x, Math.min(openY, closeY)], onPointerUp: (event) => onDataClick?.({ name: item.name, value: [item.open, item.close, item.low, item.high], data: item, nativeEvent: event }), children: [
5374
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: x, y1: highY, x2: x, y2: lowY, stroke, strokeWidth: item.borderWidth ?? borderWidth }),
5375
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: x - candleWidth / 2, y: Math.min(openY, closeY), width: candleWidth, height: Math.max(1, Math.abs(closeY - openY)), fill: rising && hollowRising ? "var(--sia-color-surface)" : color, stroke, strokeWidth: item.borderWidth ?? borderWidth, className: "sia-chart__candlestick" }),
5376
- markExtremes && item.high === highest ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("text", { x, y: highY - 8, textAnchor: "middle", className: "sia-chart__point-label", children: [
5398
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: x, y1: highY, x2: x, y2: lowY, stroke, strokeWidth: item.borderWidth ?? borderWidth }),
5399
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: x - candleWidth / 2, y: Math.min(openY, closeY), width: candleWidth, height: Math.max(1, Math.abs(closeY - openY)), fill: rising && hollowRising ? "var(--sia-color-surface)" : color, stroke, strokeWidth: item.borderWidth ?? borderWidth, className: "sia-chart__candlestick" }),
5400
+ markExtremes && item.high === highest ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("text", { x, y: highY - 8, textAnchor: "middle", className: "sia-chart__point-label", children: [
5377
5401
  "\u6700\u9AD8 ",
5378
5402
  formatChartNumber(item.high)
5379
5403
  ] }) : null,
5380
- markExtremes && item.low === lowest ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("text", { x, y: lowY + 16, textAnchor: "middle", className: "sia-chart__point-label", children: [
5404
+ markExtremes && item.low === lowest ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("text", { x, y: lowY + 16, textAnchor: "middle", className: "sia-chart__point-label", children: [
5381
5405
  "\u6700\u4F4E ",
5382
5406
  formatChartNumber(item.low)
5383
5407
  ] }) : null
@@ -5391,40 +5415,40 @@ var CandlestickChart = (0, import_react34.forwardRef)(function CandlestickChart2
5391
5415
  const a = -Math.PI / 2 + j * Math.PI / 5, r = j % 2 === 0 ? 12 : 5;
5392
5416
  return `${x + Math.cos(a) * r},${y + Math.sin(a) * r}`;
5393
5417
  }).join(" ");
5394
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { label: `${point.name}\uFF0C${point.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: point.name, value: point.value }), tooltipPoint: [x, y], children: [
5395
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { points: star, fill: color }),
5396
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x, y: y - 18, textAnchor: "middle", fill: color, fontSize: 12, children: point.value.toLocaleString("en-US") })
5418
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { label: `${point.name}\uFF0C${point.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: point.name, value: point.value }), tooltipPoint: [x, y], children: [
5419
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { points: star, fill: color }),
5420
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x, y: y - 18, textAnchor: "middle", fill: color, fontSize: 12, children: point.value.toLocaleString("en-US") })
5397
5421
  ] }, i);
5398
5422
  }) : null,
5399
- legacy && dataZoom ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("foreignObject", { className: "sia-chart__inline-zoom", x: plot.x, y: bottom + 30, width: plot.width, height: 30, children: zoomControl }) : null
5423
+ legacy && dataZoom ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("foreignObject", { className: "sia-chart__inline-zoom", x: plot.x, y: bottom + 30, width: plot.width, height: 30, children: zoomControl }) : null
5400
5424
  ] });
5401
- return dataZoom && !legacy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "sia-chart-with-zoom", children: [
5425
+ return dataZoom && !legacy ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "sia-chart-with-zoom", children: [
5402
5426
  content,
5403
5427
  zoomControl
5404
5428
  ] }) : content;
5405
5429
  });
5406
5430
  var EMPTY_PIE_DATA = [];
5407
- var PieChart = (0, import_react34.forwardRef)(function PieChart2({ pulseRing, calculable = false, markPoints = [], data = EMPTY_PIE_DATA, series, innerRadius = 62, outerRadius = 124, rose = false, center = [360, 173], startAngle = -90, clockwise = true, padAngle = 0, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, showLabels = true, showLabelLines = true, centerLabel, selectedMode = false, selected, defaultSelected, selectedOffset = 9, onSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, animationDurationUpdate = 500, legendLayout, showGuideRings = false, onDataChange, transferId, onValueTransfer, onTransferError, onValueDragOut, outsideLabelLayout, ...props }, ref) {
5408
- const pieGradientId = (0, import_react34.useId)().replace(/:/g, "");
5409
- const [pieIslands, setPieIslands] = (0, import_react34.useState)([]);
5410
- const sourceRings = (0, import_react34.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
5411
- const [editableRings, setEditableRings] = (0, import_react34.useState)(sourceRings);
5412
- const valueDrag = (0, import_react34.useRef)(null);
5413
- const [valueOffset, setValueOffset] = (0, import_react34.useState)();
5414
- (0, import_react34.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
5431
+ var PieChart = (0, import_react35.forwardRef)(function PieChart2({ pulseRing, calculable = false, markPoints = [], data = EMPTY_PIE_DATA, series, innerRadius = 62, outerRadius = 124, rose = false, center = [360, 173], startAngle = -90, clockwise = true, padAngle = 0, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, showLabels = true, showLabelLines = true, centerLabel, selectedMode = false, selected, defaultSelected, selectedOffset = 9, onSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, animationDurationUpdate = 500, legendLayout, showGuideRings = false, onDataChange, transferId, onValueTransfer, onTransferError, onValueDragOut, outsideLabelLayout, ...props }, ref) {
5432
+ const pieGradientId = (0, import_react35.useId)().replace(/:/g, "");
5433
+ const [pieIslands, setPieIslands] = (0, import_react35.useState)([]);
5434
+ const sourceRings = (0, import_react35.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
5435
+ const [editableRings, setEditableRings] = (0, import_react35.useState)(sourceRings);
5436
+ const valueDrag = (0, import_react35.useRef)(null);
5437
+ const [valueOffset, setValueOffset] = (0, import_react35.useState)();
5438
+ (0, import_react35.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
5415
5439
  const allData = editableRings.flatMap((ring) => ring.data).filter((item) => !item.missing);
5416
5440
  const names = [...new Set(allData.map((item) => item.name))];
5417
5441
  const legend = useLegendSelection(names, legendSelected, onLegendSelectionChange);
5418
5442
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u997C\u56FE");
5419
- const [hovered, setHovered] = (0, import_react34.useState)();
5420
- const [internalSelected, setInternalSelected] = (0, import_react34.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
5443
+ const [hovered, setHovered] = (0, import_react35.useState)();
5444
+ const [internalSelected, setInternalSelected] = (0, import_react35.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
5421
5445
  const selectedNames = selected ?? internalSelected;
5422
5446
  const legacy = appearance === "macarons";
5423
5447
  const colorNames = [...new Set(allData.filter((item) => item.showInLegend !== false).map((item) => item.name))];
5424
5448
  const colorFor = (item) => getColor(Math.max(0, colorNames.indexOf(item.name)), item.color, palette);
5425
5449
  const chartToolbox = typeof resolvedToolbox === "object" ? {
5426
5450
  ...resolvedToolbox,
5427
- dataView: resolvedToolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { readOnly: resolvedToolbox.dataViewReadOnly, series: editableRings.map((ring, i) => ({ name: ring.name ?? `\u7CFB\u5217 ${i + 1}`, data: ring.data.map((item) => item.missing ? null : item.value) })), onApply: (values) => {
5451
+ dataView: resolvedToolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { readOnly: resolvedToolbox.dataViewReadOnly, series: editableRings.map((ring, i) => ({ name: ring.name ?? `\u7CFB\u5217 ${i + 1}`, data: ring.data.map((item) => item.missing ? null : item.value) })), onApply: (values) => {
5428
5452
  const next = editableRings.map((ring, i) => ({ ...ring, data: ring.data.map((item, j) => ({ ...item, missing: values[i][j] === null, value: Math.max(0, values[i][j] ?? 0) })) }));
5429
5453
  setEditableRings(next);
5430
5454
  onDataChange?.(next);
@@ -5445,9 +5469,9 @@ var PieChart = (0, import_react34.forwardRef)(function PieChart2({ pulseRing, ca
5445
5469
  onSelectionChange?.(next);
5446
5470
  }
5447
5471
  const legendData = [...new Map(allData.filter((item) => item.showInLegend !== false).map((item) => [item.name, item])).values()];
5448
- if (/funnel|漏斗/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FunnelChart, { ...props, ref, series: editableRings.map((ring) => ({ name: ring.name, data: ring.data })), showLegend, legendInteractive, legendSelected: legend.selected, onLegendSelectionChange: legend.replace, onDataClick, palette, toolbox: chartToolbox });
5449
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, toolbox: chartToolbox, empty: !allData.length || allData.every((item) => item.value <= 0), ariaLabel: props.ariaLabel ?? "\u997C\u56FE", children: [
5450
- showLegend ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { rowGap: legacy ? 18 : void 0, maxWidth: legacy ? (props.viewBoxSize?.[0] ?? 720) - 20 : void 0, symbol: legacy ? "sector" : "rect", x: legendLayout?.x ?? 360, y: legendLayout?.y ?? 330, align: legendLayout?.align, orientation: legendLayout?.orientation, itemGap: legendLayout?.itemGap, items: legendData.map((item) => ({ name: item.name, color: colorFor(item), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
5472
+ if (/funnel|漏斗/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FunnelChart, { ...props, ref, series: editableRings.map((ring) => ({ name: ring.name, data: ring.data })), showLegend, legendInteractive, legendSelected: legend.selected, onLegendSelectionChange: legend.replace, onDataClick, palette, toolbox: chartToolbox });
5473
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, toolbox: chartToolbox, empty: !allData.length || allData.every((item) => item.value <= 0), ariaLabel: props.ariaLabel ?? "\u997C\u56FE", children: [
5474
+ showLegend ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { rowGap: legacy ? 18 : void 0, maxWidth: legacy ? (props.viewBoxSize?.[0] ?? 720) - 20 : void 0, symbol: legacy ? "sector" : "rect", x: legendLayout?.x ?? 360, y: legendLayout?.y ?? 330, align: legendLayout?.align, orientation: legendLayout?.orientation, itemGap: legendLayout?.itemGap, items: legendData.map((item) => ({ name: item.name, color: colorFor(item), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
5451
5475
  editableRings.flatMap((ring, ringIndex) => {
5452
5476
  const visible = ring.data.filter((item) => !item.missing && legend.isSelected(item.name));
5453
5477
  const ringCenter = ring.center ?? center;
@@ -5483,7 +5507,7 @@ var PieChart = (0, import_react34.forwardRef)(function PieChart2({ pulseRing, ca
5483
5507
  const interactive = item.interactive !== false;
5484
5508
  const transferable = interactive && (calculable || !!transferId && (!!onValueTransfer || !!onValueDragOut));
5485
5509
  const moving = valueOffset?.key === key;
5486
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
5510
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5487
5511
  ChartMark,
5488
5512
  {
5489
5513
  label: `${ring.name ?? "\u997C\u56FE"}\uFF0C${item.name}\uFF0C${item.value}`,
@@ -5504,9 +5528,9 @@ var PieChart = (0, import_react34.forwardRef)(function PieChart2({ pulseRing, ca
5504
5528
  valueDrag.current = null;
5505
5529
  setValueOffset(void 0);
5506
5530
  },
5507
- tooltip: interactive ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5508
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: ring.name }),
5509
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
5531
+ tooltip: interactive ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5532
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: ring.name }),
5533
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
5510
5534
  item.name,
5511
5535
  "\uFF1A",
5512
5536
  item.value,
@@ -5584,27 +5608,27 @@ var PieChart = (0, import_react34.forwardRef)(function PieChart2({ pulseRing, ca
5584
5608
  }
5585
5609
  },
5586
5610
  children: [
5587
- gradient ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("radialGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", cx: gradient.center[0], cy: gradient.center[1], r: gradient.outerRadius, children: gradient.stops.map((stop, index2) => {
5611
+ gradient ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("radialGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", cx: gradient.center[0], cy: gradient.center[1], r: gradient.outerRadius, children: gradient.stops.map((stop, index2) => {
5588
5612
  const inner = Math.max(0, Math.min(1, (gradient.innerRadius ?? 0) / gradient.outerRadius));
5589
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("stop", { offset: inner + (1 - inner) * stop.offset, stopColor: stop.color }, index2);
5613
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("stop", { offset: inner + (1 - inner) * stop.offset, stopColor: stop.color }, index2);
5590
5614
  }) }) }) : null,
5591
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPointMotion, { points: [[0, arc.start], [0, arc.end]], enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: (frame) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: svgArcPath(cx, cy, arc.radius, frame[0][1], frame[1][1], arc.inner, direction), fill: gradient ? `url(#${gradientId})` : color, stroke: legacy ? "#fff" : void 0, strokeWidth: legacy ? 1 : void 0, className: "sia-chart__sector", style: { animation: "none", transform: legacy ? "none" : void 0 } }) }),
5592
- allowLabel && !inside && (labelLine.show ?? showLabelLines) ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: `M ${cx + Math.cos(arc.middle) * arc.radius} ${cy + Math.sin(arc.middle) * arc.radius} L ${lx} ${ly} L ${labelX + (right ? -4 : 4)} ${ly}`, fill: "none", stroke: color, className: "sia-chart__pie-label-line", style: labelLine.style }) : null,
5593
- allowLabel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: labelX, y: ly + 4, textAnchor: inside ? "middle" : right ? "start" : "end", className: "sia-chart__pie-label", style: labelStyle, children: labelText.split("\n").map((line, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tspan", { x: labelX, dy: lineIndex ? "1.2em" : 0, children: line }, lineIndex)) }) : null,
5594
- isHovered && ring.emphasisLabel === "center" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: ringCenter[0], y: ringCenter[1] + 10, textAnchor: "middle", fontSize: 30, fontWeight: "bold", fill: color, style: { ...ring.emphasisLabelStyle, ...item.emphasisLabelStyle }, pointerEvents: "none", children: labelText }) : null
5615
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPointMotion, { points: [[0, arc.start], [0, arc.end]], enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: animationProgress, children: (frame) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: svgArcPath(cx, cy, arc.radius, frame[0][1], frame[1][1], arc.inner, direction), fill: gradient ? `url(#${gradientId})` : color, stroke: legacy ? "#fff" : void 0, strokeWidth: legacy ? 1 : void 0, className: "sia-chart__sector", style: { animation: "none", transform: legacy ? "none" : void 0 } }) }),
5616
+ allowLabel && !inside && (labelLine.show ?? showLabelLines) ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: `M ${cx + Math.cos(arc.middle) * arc.radius} ${cy + Math.sin(arc.middle) * arc.radius} L ${lx} ${ly} L ${labelX + (right ? -4 : 4)} ${ly}`, fill: "none", stroke: color, className: "sia-chart__pie-label-line", style: labelLine.style }) : null,
5617
+ allowLabel ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: labelX, y: ly + 4, textAnchor: inside ? "middle" : right ? "start" : "end", className: "sia-chart__pie-label", style: labelStyle, children: labelText.split("\n").map((line, lineIndex) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tspan", { x: labelX, dy: lineIndex ? "1.2em" : 0, children: line }, lineIndex)) }) : null,
5618
+ isHovered && ring.emphasisLabel === "center" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: ringCenter[0], y: ringCenter[1] + 10, textAnchor: "middle", fontSize: 30, fontWeight: "bold", fill: color, style: { ...ring.emphasisLabelStyle, ...item.emphasisLabelStyle }, pointerEvents: "none", children: labelText }) : null
5595
5619
  ]
5596
5620
  },
5597
5621
  key
5598
5622
  );
5599
5623
  });
5600
- return [calculable ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { "data-pie-target": "case", "data-value-series": ringIndex, "data-value-index": -1, d: svgArcPath(ringCenter[0], ringCenter[1], ringOuter + 10, -Math.PI / 2, Math.PI * 1.5, ringInner <= 10 ? 0 : ringInner - 10, true), fill: "transparent", stroke: "#ccc", strokeWidth: 1, pointerEvents: "all" }, `case-${ringIndex}`) : null, showGuideRings ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { fill: "none", stroke: "#ccc", strokeWidth: 1, pointerEvents: "none", children: [
5601
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: ringCenter[0], cy: ringCenter[1], r: ringOuter + 10 }),
5602
- ringInner > 10 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: ringCenter[0], cy: ringCenter[1], r: ringInner - 10 }) : null
5603
- ] }, `guide-${ringIndex}`) : null, ...marks, ring.centerLabel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("foreignObject", { x: ringCenter[0] - 60, y: ringCenter[1] - 30, width: 120, height: 60, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "sia-chart__center-label", children: ring.centerLabel }) }, `center-${ringIndex}`) : null];
5624
+ return [calculable ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { "data-pie-target": "case", "data-value-series": ringIndex, "data-value-index": -1, d: svgArcPath(ringCenter[0], ringCenter[1], ringOuter + 10, -Math.PI / 2, Math.PI * 1.5, ringInner <= 10 ? 0 : ringInner - 10, true), fill: "transparent", stroke: "#ccc", strokeWidth: 1, pointerEvents: "all" }, `case-${ringIndex}`) : null, showGuideRings ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { fill: "none", stroke: "#ccc", strokeWidth: 1, pointerEvents: "none", children: [
5625
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: ringCenter[0], cy: ringCenter[1], r: ringOuter + 10 }),
5626
+ ringInner > 10 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: ringCenter[0], cy: ringCenter[1], r: ringInner - 10 }) : null
5627
+ ] }, `guide-${ringIndex}`) : null, ...marks, ring.centerLabel ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("foreignObject", { x: ringCenter[0] - 60, y: ringCenter[1] - 30, width: 120, height: 60, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "sia-chart__center-label", children: ring.centerLabel }) }, `center-${ringIndex}`) : null];
5604
5628
  }),
5605
- centerLabel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("foreignObject", { x: center[0] - 100, y: center[1] - 45, width: 200, height: 90, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "sia-chart__center-label", children: centerLabel }) }) : null,
5606
- pulseRing ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPulseRing, { ...pulseRing, enabled: props.animation !== false && pulseRing.enabled !== false }) : null,
5607
- calculable ? pieIslands.map((island, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartValueIsland, { ...island, resolveTarget: (element, x, y) => {
5629
+ centerLabel ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("foreignObject", { x: center[0] - 100, y: center[1] - 45, width: 200, height: 90, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "sia-chart__center-label", children: centerLabel }) }) : null,
5630
+ pulseRing ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPulseRing, { ...pulseRing, enabled: props.animation !== false && pulseRing.enabled !== false }) : null,
5631
+ calculable ? pieIslands.map((island, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartValueIsland, { ...island, resolveTarget: (element, x, y) => {
5608
5632
  const hit = document.elementsFromPoint(x, y).map((node) => node.closest("[data-pie-target]")).find((node) => node && node.ownerSVGElement === element.ownerSVGElement);
5609
5633
  return hit ? { chart: "pie", series: Number(hit.getAttribute("data-value-series")), index: Number(hit.getAttribute("data-value-index")) } : null;
5610
5634
  }, onDrop: (target, point) => {
@@ -5625,27 +5649,27 @@ var PieChart = (0, import_react34.forwardRef)(function PieChart2({ pulseRing, ca
5625
5649
  markPoints.map((mark, index) => {
5626
5650
  const coordinate = (value, length) => typeof value === "number" ? value : parseFloat(value) * length / 100;
5627
5651
  const x = coordinate(mark.x, props.viewBoxSize?.[0] ?? 720), y = coordinate(mark.y, props.viewBoxSize?.[1] ?? 360), radius = mark.radius ?? 10, color = mark.color ?? "#dc69aa", key = `mark-${index}`;
5628
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartScatterMotion, { x, y, radius, enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { "data-pie-mark": mark.name, label: `${mark.name}\uFF0C${mark.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5629
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: mark.name }),
5630
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: mark.value.toLocaleString("en-US") })
5652
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartScatterMotion, { x, y, radius, enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { "data-pie-mark": mark.name, label: `${mark.name}\uFF0C${mark.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5653
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: mark.name }),
5654
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: mark.value.toLocaleString("en-US") })
5631
5655
  ] }), tooltipPoint: [x, y], onPointerMove: () => setHovered(key), onPointerLeave: () => setHovered(void 0), onFocus: () => setHovered(key), onBlur: () => setHovered(void 0), children: [
5632
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { points: chartStarPoints(x, y, radius * 2, 5).map((point) => point.join(",")).join(" "), fill: color, stroke: color, strokeWidth: hovered === key ? 4 : 2 }),
5633
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x, y, dominantBaseline: "central", textAnchor: "middle", style: { fill: "#fff", fontSize: 12, fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1, Arial, Verdana, sans-serif", pointerEvents: "none" }, children: mark.value.toLocaleString("en-US") })
5656
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { points: chartStarPoints(x, y, radius * 2, 5).map((point) => point.join(",")).join(" "), fill: color, stroke: color, strokeWidth: hovered === key ? 4 : 2 }),
5657
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x, y, dominantBaseline: "central", textAnchor: "middle", style: { fill: "#fff", fontSize: 12, fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1, Arial, Verdana, sans-serif", pointerEvents: "none" }, children: mark.value.toLocaleString("en-US") })
5634
5658
  ] }) }, key);
5635
5659
  })
5636
5660
  ] });
5637
5661
  });
5638
5662
  var EMPTY_RADAR_INDICATORS = [];
5639
5663
  var EMPTY_RADAR_SERIES = [];
5640
- var RadarChart = (0, import_react34.forwardRef)(function RadarChart2({ indicators = EMPTY_RADAR_INDICATORS, series = EMPTY_RADAR_SERIES, radars, calculable = false, onTransferError, markers, levels = 5, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
5664
+ var RadarChart = (0, import_react35.forwardRef)(function RadarChart2({ indicators = EMPTY_RADAR_INDICATORS, series = EMPTY_RADAR_SERIES, radars, calculable = false, onTransferError, markers, levels = 5, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
5641
5665
  const legacy = appearance === "macarons";
5642
- const initialPanels = (0, import_react34.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
5643
- const [sourcePanels, setSourcePanels] = (0, import_react34.useState)(initialPanels);
5644
- const [hoveredRadar, setHoveredRadar] = (0, import_react34.useState)(null);
5645
- const radarPaintId = `sia-radar-${(0, import_react34.useId)().replaceAll(":", "")}`;
5646
- const radarDrag = (0, import_react34.useRef)(null);
5647
- const [radarOffset, setRadarOffset] = (0, import_react34.useState)(null);
5648
- (0, import_react34.useEffect)(() => {
5666
+ const initialPanels = (0, import_react35.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
5667
+ const [sourcePanels, setSourcePanels] = (0, import_react35.useState)(initialPanels);
5668
+ const [hoveredRadar, setHoveredRadar] = (0, import_react35.useState)(null);
5669
+ const radarPaintId = `sia-radar-${(0, import_react35.useId)().replaceAll(":", "")}`;
5670
+ const radarDrag = (0, import_react35.useRef)(null);
5671
+ const [radarOffset, setRadarOffset] = (0, import_react35.useState)(null);
5672
+ (0, import_react35.useEffect)(() => {
5649
5673
  setSourcePanels(initialPanels);
5650
5674
  radarDrag.current = null;
5651
5675
  setRadarOffset(null);
@@ -5654,7 +5678,7 @@ var RadarChart = (0, import_react34.forwardRef)(function RadarChart2({ indicator
5654
5678
  const legend = useLegendSelection(allSeries.map((item) => item.name), legendSelected, onLegendSelectionChange);
5655
5679
  const legendSeries = [...new Map(allSeries.map((item) => [item.name, item])).values()];
5656
5680
  if (legendOrder) legendSeries.sort((a, b) => legendOrder.indexOf(a.name) - legendOrder.indexOf(b.name));
5657
- const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { series: allSeries, onApply: (values) => {
5681
+ const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { series: allSeries, onApply: (values) => {
5658
5682
  let cursor = 0;
5659
5683
  const next = sourcePanels.map((panel) => ({ ...panel, series: panel.series.map((item) => ({ ...item, data: values[cursor++] })) }));
5660
5684
  setSourcePanels(next);
@@ -5677,15 +5701,15 @@ var RadarChart = (0, import_react34.forwardRef)(function RadarChart2({ indicator
5677
5701
  });
5678
5702
  return { ...panel, indicators: resolvedIndicators, series: visible };
5679
5703
  });
5680
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, toolbox: chartToolbox, ref, palette, empty: !sourcePanels.some((panel) => panel.indicators.length && panel.series.length), ariaLabel: props.ariaLabel ?? "\u96F7\u8FBE\u56FE", children: [
5681
- showLegend ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { x: legendLayout?.x ?? 360, y: legendLayout?.y ?? 20, orientation: legendLayout?.orientation, align: legendLayout?.align, symbol: legacy ? "line" : "rect", itemGap: legacy ? 10 : 18, items: legendSeries.map((item, index) => ({ name: item.name, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
5704
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, toolbox: chartToolbox, ref, palette, empty: !sourcePanels.some((panel) => panel.indicators.length && panel.series.length), ariaLabel: props.ariaLabel ?? "\u96F7\u8FBE\u56FE", children: [
5705
+ showLegend ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { x: legendLayout?.x ?? 360, y: legendLayout?.y ?? 20, orientation: legendLayout?.orientation, align: legendLayout?.align, symbol: legacy ? "line" : "rect", itemGap: legacy ? 10 : 18, items: legendSeries.map((item, index) => ({ name: item.name, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
5682
5706
  markers?.map((marker, index) => {
5683
5707
  const size = marker.size ?? 32, x = marker.x, y = marker.y - size * 0.25, a = size * 0.5, b = size;
5684
5708
  const path = `M ${x} ${y} C ${x + a / 2} ${y - 2 * b / 3} ${x + 2 * a} ${y + b / 3} ${x} ${y + b} C ${x - 2 * a} ${y + b / 3} ${x - a / 2} ${y - 2 * b / 3} ${x} ${y} Z`;
5685
5709
  const color = marker.color ?? "#d87a80";
5686
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { label: `${marker.name}\uFF0C${marker.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: marker.name, value: marker.value }), tooltipPoint: [marker.x, marker.y], children: [
5687
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { className: "sia-chart__radar-marker", d: path, fill: marker.hollow ? "#fff" : color, stroke: color, strokeWidth: 2 }),
5688
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: marker.x, y: marker.y + 4, textAnchor: "middle", style: { fill: marker.hollow ? color : "#fff", fontSize: 12 }, children: marker.value })
5710
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { label: `${marker.name}\uFF0C${marker.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: marker.name, value: marker.value }), tooltipPoint: [marker.x, marker.y], children: [
5711
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { className: "sia-chart__radar-marker", d: path, fill: marker.hollow ? "#fff" : color, stroke: color, strokeWidth: 2 }),
5712
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: marker.x, y: marker.y + 4, textAnchor: "middle", style: { fill: marker.hollow ? color : "#fff", fontSize: 12 }, children: marker.value })
5689
5713
  ] }, index);
5690
5714
  }),
5691
5715
  panels.map((panel, panelIndex) => {
@@ -5697,8 +5721,8 @@ var RadarChart = (0, import_react34.forwardRef)(function RadarChart2({ indicator
5697
5721
  const angle = start + (legacy ? -1 : 1) * index / Math.max(1, panel.indicators.length) * Math.PI * 2;
5698
5722
  return [panelCenter[0] + Math.cos(angle) * panelRadius * ratio, panelCenter[1] + Math.sin(angle) * panelRadius * ratio];
5699
5723
  };
5700
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
5701
- calculable ? panel.shape === "circle" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { "data-radar-drop-panel": panelIndex, cx: panelCenter[0], cy: panelCenter[1], r: panelRadius, fill: "transparent" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { "data-radar-drop-panel": panelIndex, points: panel.indicators.map((_, index) => pointAt(index, 1).join(",")).join(" "), fill: "transparent" }) : null,
5724
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
5725
+ calculable ? panel.shape === "circle" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { "data-radar-drop-panel": panelIndex, cx: panelCenter[0], cy: panelCenter[1], r: panelRadius, fill: "transparent" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { "data-radar-drop-panel": panelIndex, points: panel.indicators.map((_, index) => pointAt(index, 1).join(",")).join(" "), fill: "transparent" }) : null,
5702
5726
  panel.splitAreaColors?.length ? Array.from({ length: panelLevels }, (_, level) => {
5703
5727
  const boundary = (ratio) => {
5704
5728
  const r = panelRadius * ratio;
@@ -5706,22 +5730,22 @@ var RadarChart = (0, import_react34.forwardRef)(function RadarChart2({ indicator
5706
5730
  if (panel.shape === "circle") return `M ${panelCenter[0] - r} ${panelCenter[1]} a ${r} ${r} 0 1 0 ${r * 2} 0 a ${r} ${r} 0 1 0 ${-r * 2} 0 Z`;
5707
5731
  return panel.indicators.map((_2, index) => `${index ? "L" : "M"} ${pointAt(index, ratio).join(" ")}`).join(" ") + " Z";
5708
5732
  };
5709
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { className: "sia-chart__radar-band", d: `${boundary((level + 1) / panelLevels)} ${boundary(level / panelLevels)}`, fillRule: "evenodd", fill: panel.splitAreaColors[level % panel.splitAreaColors.length] }, level);
5733
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { className: "sia-chart__radar-band", d: `${boundary((level + 1) / panelLevels)} ${boundary(level / panelLevels)}`, fillRule: "evenodd", fill: panel.splitAreaColors[level % panel.splitAreaColors.length] }, level);
5710
5734
  }) : null,
5711
5735
  Array.from({ length: panelLevels }, (_, index) => {
5712
5736
  const level = legacy ? panelLevels - 1 - index : index;
5713
5737
  const style = { fill: panel.splitAreaColors?.length ? "none" : legacy ? level % 2 ? "rgba(200,200,200,.25)" : "rgba(250,250,250,.5)" : void 0, stroke: panel.splitLineColor ?? (legacy ? "#ddd" : void 0), strokeWidth: panel.splitLineWidth };
5714
- return panel.shape === "circle" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: panelCenter[0], cy: panelCenter[1], r: panelRadius * (level + 1) / panelLevels, style, className: "sia-chart__radar-grid" }, level) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { points: panel.indicators.map((_2, index2) => pointAt(index2, (level + 1) / panelLevels).join(",")).join(" "), style, className: "sia-chart__radar-grid" }, level);
5738
+ return panel.shape === "circle" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: panelCenter[0], cy: panelCenter[1], r: panelRadius * (level + 1) / panelLevels, style, className: "sia-chart__radar-grid" }, level) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { points: panel.indicators.map((_2, index2) => pointAt(index2, (level + 1) / panelLevels).join(",")).join(" "), style, className: "sia-chart__radar-grid" }, level);
5715
5739
  }),
5716
5740
  panel.indicators.map((indicator, index) => {
5717
5741
  const edge = pointAt(index, 1);
5718
5742
  const label = pointAt(index, legacy ? 1 + 15 / panelRadius : 1.18);
5719
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
5720
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: panelCenter[0], y1: panelCenter[1], x2: edge[0], y2: edge[1], style: { stroke: panel.axisColor, strokeWidth: panel.axisWidth }, className: "sia-chart__grid-line" }),
5721
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: label[0], y: label[1] + 4, textAnchor: Math.abs(label[0] - panelCenter[0]) < 4 ? "middle" : label[0] > panelCenter[0] ? "start" : "end", style: { fill: panel.indicatorColor }, className: "sia-chart__radar-label", children: panel.indicatorFormatter?.(indicator.name) ?? indicator.name }),
5743
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
5744
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: panelCenter[0], y1: panelCenter[1], x2: edge[0], y2: edge[1], style: { stroke: panel.axisColor, strokeWidth: panel.axisWidth }, className: "sia-chart__grid-line" }),
5745
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: label[0], y: label[1] + 4, textAnchor: Math.abs(label[0] - panelCenter[0]) < 4 ? "middle" : label[0] > panelCenter[0] ? "start" : "end", style: { fill: panel.indicatorColor }, className: "sia-chart__radar-label", children: panel.indicatorFormatter?.(indicator.name) ?? indicator.name }),
5722
5746
  panel.showAxisLabels ? Array.from({ length: panelLevels + 1 }, (_, tick) => {
5723
5747
  const point = pointAt(index, tick / panelLevels), min = indicator.min ?? 0, value = min + (indicator.max - min) * tick / panelLevels;
5724
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: point[0] + 5, y: point[1] + 4, className: "sia-chart__radar-axis-label", style: { fill: panel.axisLabelColor ?? "#ccc", fontSize: 12 }, children: Number(value.toPrecision(12)) }, tick);
5748
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: point[0] + 5, y: point[1] + 4, className: "sia-chart__radar-axis-label", style: { fill: panel.axisLabelColor ?? "#ccc", fontSize: 12 }, children: Number(value.toPrecision(12)) }, tick);
5725
5749
  }) : null
5726
5750
  ] }, `${indicator.name}-${index}`);
5727
5751
  }),
@@ -5734,7 +5758,7 @@ var RadarChart = (0, import_react34.forwardRef)(function RadarChart2({ indicator
5734
5758
  const hoverKey = `${panelIndex}-${item.name}-${seriesIndex}`, emphasis = hoveredRadar === hoverKey ? item.emphasisAreaColor : void 0;
5735
5759
  const gradient = item.areaGradient, gradientId = `${radarPaintId}-${panelIndex}-${seriesIndex}`;
5736
5760
  const originalIndex = sourcePanels[panelIndex].series.indexOf(item), dragging = radarOffset?.panel === panelIndex && radarOffset.series === originalIndex;
5737
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { "data-radar-panel": panelIndex, "data-radar-series": originalIndex, transform: dragging ? `translate(${radarOffset.x} ${radarOffset.y})` : void 0, style: { cursor: calculable ? "move" : void 0, pointerEvents: dragging ? "none" : void 0 }, onPointerDown: (event) => {
5761
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { "data-radar-panel": panelIndex, "data-radar-series": originalIndex, transform: dragging ? `translate(${radarOffset.x} ${radarOffset.y})` : void 0, style: { cursor: calculable ? "move" : void 0, pointerEvents: dragging ? "none" : void 0 }, onPointerDown: (event) => {
5738
5762
  if (!calculable || event.button !== 0) return;
5739
5763
  event.stopPropagation();
5740
5764
  event.currentTarget.setPointerCapture(event.pointerId);
@@ -5752,9 +5776,9 @@ var RadarChart = (0, import_react34.forwardRef)(function RadarChart2({ indicator
5752
5776
  }, onPointerCancel: () => {
5753
5777
  radarDrag.current = null;
5754
5778
  setRadarOffset(null);
5755
- }, onPointerEnter: () => setHoveredRadar(hoverKey), onPointerLeave: () => setHoveredRadar(null), onFocus: () => setHoveredRadar(hoverKey), onBlur: () => setHoveredRadar(null), label: `${item.name}\uFF0C${item.data.join("\uFF0C")}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5756
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: item.name }),
5757
- panel.indicators.map((indicator, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
5779
+ }, onPointerEnter: () => setHoveredRadar(hoverKey), onPointerLeave: () => setHoveredRadar(null), onFocus: () => setHoveredRadar(hoverKey), onBlur: () => setHoveredRadar(null), label: `${item.name}\uFF0C${item.data.join("\uFF0C")}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5780
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: item.name }),
5781
+ panel.indicators.map((indicator, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
5758
5782
  indicator.name,
5759
5783
  "\uFF1A",
5760
5784
  item.data[index] ?? 0
@@ -5780,17 +5804,17 @@ var RadarChart = (0, import_react34.forwardRef)(function RadarChart2({ indicator
5780
5804
  } catch (error) {
5781
5805
  onTransferError?.(error instanceof Error ? error.message : "\u96F7\u8FBE\u6570\u636E\u62D6\u653E\u5931\u8D25");
5782
5806
  }
5783
- }, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPointMotion, { origin: legacy ? [panelCenter[0], panelCenter[1]] : void 0, points: [[panelCenter[0], panelCenter[1]], ...points], enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (frame) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
5784
- gradient ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("radialGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", cx: gradient.center[0], cy: gradient.center[1], r: gradient.radius, fx: gradient.focus?.[0] ?? gradient.center[0], fy: gradient.focus?.[1] ?? gradient.center[1], children: gradient.stops.map((stop, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, index)) }) }) : null,
5785
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { points: frame.slice(1).map((point) => point.join(",")).join(" "), fill: emphasis ?? (gradient ? `url(#${gradientId})` : color), fillOpacity: emphasis ? 1 : item.areaOpacity ?? (gradient ? 1 : 0.18), stroke: color, strokeDasharray: item.lineStyle === "dashed" ? "7 5" : item.lineStyle === "dotted" ? "2 4" : void 0, style: { strokeWidth: hoveredRadar === hoverKey ? item.emphasisLineWidth ?? item.lineWidth : item.lineWidth }, className: "sia-chart__radar-series" }),
5807
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPointMotion, { origin: legacy ? [panelCenter[0], panelCenter[1]] : void 0, points: [[panelCenter[0], panelCenter[1]], ...points], enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (frame) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
5808
+ gradient ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("radialGradient", { id: gradientId, gradientUnits: "userSpaceOnUse", cx: gradient.center[0], cy: gradient.center[1], r: gradient.radius, fx: gradient.focus?.[0] ?? gradient.center[0], fy: gradient.focus?.[1] ?? gradient.center[1], children: gradient.stops.map((stop, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, index)) }) }) : null,
5809
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { points: frame.slice(1).map((point) => point.join(",")).join(" "), fill: emphasis ?? (gradient ? `url(#${gradientId})` : color), fillOpacity: emphasis ? 1 : item.areaOpacity ?? (gradient ? 1 : 0.18), stroke: color, strokeDasharray: item.lineStyle === "dashed" ? "7 5" : item.lineStyle === "dotted" ? "2 4" : void 0, style: { strokeWidth: hoveredRadar === hoverKey ? item.emphasisLineWidth ?? item.lineWidth : item.lineWidth }, className: "sia-chart__radar-series" }),
5786
5810
  frame.slice(1).map((point, index) => {
5787
5811
  const value = item.data[index] ?? 0, pointColor = item.pointColor?.(value, index) ?? color, radius = item.pointRadius ?? (legacy ? 3 : 3.5);
5788
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
5789
- item.showPoints !== false ? item.pointSymbol === "star" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { className: "sia-chart__radar-point", "data-symbol": "star", points: Array.from({ length: 10 }, (_, vertex) => {
5812
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
5813
+ item.showPoints !== false ? item.pointSymbol === "star" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { className: "sia-chart__radar-point", "data-symbol": "star", points: Array.from({ length: 10 }, (_, vertex) => {
5790
5814
  const angle = -Math.PI / 2 + vertex * Math.PI / 5, r = vertex % 2 ? radius * 0.5 : radius;
5791
5815
  return `${point[0] + Math.cos(angle) * r},${point[1] + Math.sin(angle) * r}`;
5792
- }).join(" "), fill: pointColor }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { className: "sia-chart__radar-point", cx: point[0], cy: point[1], r: radius, fill: legacy ? "#fff" : pointColor, stroke: legacy ? pointColor : void 0, strokeWidth: legacy ? 2 : void 0 }) : null,
5793
- item.showValueLabels ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { className: "sia-chart__radar-value", x: point[0], y: point[1] - radius - 5, textAnchor: "middle", style: { fill: pointColor, fontSize: 12 }, children: item.valueLabelFormatter?.(value, index) ?? String(value) }) : null
5816
+ }).join(" "), fill: pointColor }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { className: "sia-chart__radar-point", cx: point[0], cy: point[1], r: radius, fill: legacy ? "#fff" : pointColor, stroke: legacy ? pointColor : void 0, strokeWidth: legacy ? 2 : void 0 }) : null,
5817
+ item.showValueLabels ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { className: "sia-chart__radar-value", x: point[0], y: point[1] - radius - 5, textAnchor: "middle", style: { fill: pointColor, fontSize: 12 }, children: item.valueLabelFormatter?.(value, index) ?? String(value) }) : null
5794
5818
  ] }, index);
5795
5819
  })
5796
5820
  ] }) }) }, `${item.name}-${seriesIndex}`);
@@ -5799,9 +5823,9 @@ var RadarChart = (0, import_react34.forwardRef)(function RadarChart2({ indicator
5799
5823
  })
5800
5824
  ] });
5801
5825
  });
5802
- var ChordChart = (0, import_react34.forwardRef)(function ChordChart2({ nodes, links, nodeGeometry, matrixAppearance, matrix, matrixSeries, showNodeLabels = false, rotateNodeLabels = false, matrixLinkLabel, matrixGeometry, legacySubSort = false, showScale = false, sortSub = "none", padAngle = 0.035, ribbon = true, clockwise = true, sort = "none", onNodeClick, onLinkClick, palette, toolbox, ...props }, ref) {
5826
+ var ChordChart = (0, import_react35.forwardRef)(function ChordChart2({ nodes, links, nodeGeometry, matrixAppearance, matrix, matrixSeries, showNodeLabels = false, rotateNodeLabels = false, matrixLinkLabel, matrixGeometry, legacySubSort = false, showScale = false, sortSub = "none", padAngle = 0.035, ribbon = true, clockwise = true, sort = "none", onNodeClick, onLinkClick, palette, toolbox, ...props }, ref) {
5803
5827
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u548C\u5F26");
5804
- if (/force|力导向|关系/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5828
+ if (/force|力导向|关系/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5805
5829
  GraphChart,
5806
5830
  {
5807
5831
  ...props,
@@ -5818,8 +5842,8 @@ var ChordChart = (0, import_react34.forwardRef)(function ChordChart2({ nodes, li
5818
5842
  }
5819
5843
  }
5820
5844
  );
5821
- if (matrix || matrixSeries) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SiaChart, { ...props, ref, palette, toolbox: resolvedToolbox, empty: !nodes.length || matrixSeries?.length === 0, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MatrixChordPlot, { appearance: matrixAppearance, linkLabel: matrixLinkLabel, rotateNodeLabels, series: matrixSeries, showNodeLabels, geometry: matrixGeometry, legacySubSort, showScale, names: nodes.map((n) => n.name), matrix: matrix ?? [], sort, sortSub, padAngle, clockwise, palette }) });
5822
- if (!ribbon && nodeGeometry) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SiaChart, { ...props, ref, palette, toolbox: resolvedToolbox, empty: !nodes.length, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(NodeChordPlot, { nodes, links, geometry: nodeGeometry, palette, sort, clockwise, padAngle, rotateLabels: rotateNodeLabels }) });
5845
+ if (matrix || matrixSeries) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SiaChart, { ...props, ref, palette, toolbox: resolvedToolbox, empty: !nodes.length || matrixSeries?.length === 0, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MatrixChordPlot, { appearance: matrixAppearance, linkLabel: matrixLinkLabel, rotateNodeLabels, series: matrixSeries, showNodeLabels, geometry: matrixGeometry, legacySubSort, showScale, names: nodes.map((n) => n.name), matrix: matrix ?? [], sort, sortSub, padAngle, clockwise, palette }) });
5846
+ if (!ribbon && nodeGeometry) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SiaChart, { ...props, ref, palette, toolbox: resolvedToolbox, empty: !nodes.length, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(NodeChordPlot, { nodes, links, geometry: nodeGeometry, palette, sort, clockwise, padAngle, rotateLabels: rotateNodeLabels }) });
5823
5847
  const center = [360, 182];
5824
5848
  const outerRadius = 128;
5825
5849
  const innerRadius = 108;
@@ -5839,7 +5863,7 @@ var ChordChart = (0, import_react34.forwardRef)(function ChordChart2({ nodes, li
5839
5863
  const arcById = new Map(arcs.map((arc) => [arc.node.id, arc]));
5840
5864
  const maxLink = Math.max(1, ...links.map((link) => link.value));
5841
5865
  const point = (arc, radius) => [center[0] + Math.cos(arc.middle) * radius, center[1] + Math.sin(arc.middle) * radius];
5842
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, ref, palette, toolbox: resolvedToolbox, empty: !nodes.length, ariaLabel: props.ariaLabel ?? "\u548C\u5F26\u56FE", children: [
5866
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, ref, palette, toolbox: resolvedToolbox, empty: !nodes.length, ariaLabel: props.ariaLabel ?? "\u548C\u5F26\u56FE", children: [
5843
5867
  links.map((link, index) => {
5844
5868
  const source = arcById.get(link.source);
5845
5869
  const target = arcById.get(link.target);
@@ -5853,30 +5877,30 @@ var ChordChart = (0, import_react34.forwardRef)(function ChordChart2({ nodes, li
5853
5877
  const sourceTangent = [-Math.sin(source.middle) * halfWidth, Math.cos(source.middle) * halfWidth];
5854
5878
  const targetTangent = [-Math.sin(target.middle) * halfWidth, Math.cos(target.middle) * halfWidth];
5855
5879
  const band = `M ${from[0] + sourceTangent[0]} ${from[1] + sourceTangent[1]} Q ${center[0]} ${center[1]} ${to[0] + targetTangent[0]} ${to[1] + targetTangent[1]} L ${to[0] - targetTangent[0]} ${to[1] - targetTangent[1]} Q ${center[0]} ${center[1]} ${from[0] - sourceTangent[0]} ${from[1] - sourceTangent[1]} Z`;
5856
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { label: `${sourceName} \u5230 ${targetName}\uFF0C${link.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5857
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("strong", { children: [
5880
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { label: `${sourceName} \u5230 ${targetName}\uFF0C${link.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5881
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("strong", { children: [
5858
5882
  sourceName,
5859
5883
  " \u2192 ",
5860
5884
  targetName
5861
5885
  ] }),
5862
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("b", { children: formatChartNumber(link.value) })
5863
- ] }), tooltipPoint: [(from[0] + to[0]) / 2, (from[1] + to[1]) / 2], onPointerUp: (event) => onLinkClick?.({ name: `${sourceName} \u2192 ${targetName}`, value: link.value, data: link, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: ribbon ? band : `M ${from[0]} ${from[1]} Q ${center[0]} ${center[1]} ${to[0]} ${to[1]}`, fill: ribbon ? color : "none", stroke: color, strokeWidth: ribbon ? 1 : 2 + link.value / maxLink * 5, className: "sia-chart__chord-link" }) }, `${link.source}-${link.target}-${index}`);
5886
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("b", { children: formatChartNumber(link.value) })
5887
+ ] }), tooltipPoint: [(from[0] + to[0]) / 2, (from[1] + to[1]) / 2], onPointerUp: (event) => onLinkClick?.({ name: `${sourceName} \u2192 ${targetName}`, value: link.value, data: link, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: ribbon ? band : `M ${from[0]} ${from[1]} Q ${center[0]} ${center[1]} ${to[0]} ${to[1]}`, fill: ribbon ? color : "none", stroke: color, strokeWidth: ribbon ? 1 : 2 + link.value / maxLink * 5, className: "sia-chart__chord-link" }) }, `${link.source}-${link.target}-${index}`);
5864
5888
  }),
5865
5889
  arcs.map((arc, index) => {
5866
5890
  const color = getColor(index, arc.node.color, palette);
5867
5891
  const label = point(arc, outerRadius + 17);
5868
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { label: `${arc.node.name}\uFF0C${formatChartNumber(arc.value)}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: arc.node.name, value: arc.value }), tooltipPoint: point(arc, outerRadius), onPointerUp: (event) => onNodeClick?.({ name: arc.node.name, value: arc.value, data: arc.node, nativeEvent: event }), children: [
5869
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: svgArcPath(center[0], center[1], outerRadius, arc.start, arc.end, innerRadius, clockwise), fill: color, className: "sia-chart__sector" }),
5870
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: label[0], y: label[1] + 4, textAnchor: label[0] > center[0] ? "start" : "end", className: "sia-chart__chord-label", children: arc.node.name })
5892
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { label: `${arc.node.name}\uFF0C${formatChartNumber(arc.value)}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: arc.node.name, value: arc.value }), tooltipPoint: point(arc, outerRadius), onPointerUp: (event) => onNodeClick?.({ name: arc.node.name, value: arc.value, data: arc.node, nativeEvent: event }), children: [
5893
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: svgArcPath(center[0], center[1], outerRadius, arc.start, arc.end, innerRadius, clockwise), fill: color, className: "sia-chart__sector" }),
5894
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: label[0], y: label[1] + 4, textAnchor: label[0] > center[0] ? "start" : "end", className: "sia-chart__chord-label", children: arc.node.name })
5871
5895
  ] }, arc.node.id);
5872
5896
  })
5873
5897
  ] });
5874
5898
  });
5875
- var GraphChart = (0, import_react34.forwardRef)(function GraphChart2({ nodes, links, roam = false, chordOptions, forceOptions, progressiveForce = false, layout = "circular", showLabels = true, draggable = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onNodeClick, palette, toolbox, ...props }, ref) {
5899
+ var GraphChart = (0, import_react35.forwardRef)(function GraphChart2({ nodes, links, roam = false, chordOptions, forceOptions, progressiveForce = false, layout = "circular", showLabels = true, draggable = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onNodeClick, palette, toolbox, ...props }, ref) {
5876
5900
  const categories = [...new Set(nodes.map((node) => node.category).filter((value) => Boolean(value)))];
5877
5901
  const legend = useLegendSelection(categories, legendSelected, onLegendSelectionChange);
5878
5902
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, layout === "force" ? "\u529B\u5BFC\u5411" : "\u5173\u7CFB");
5879
- const [roamReset, setRoamReset] = (0, import_react34.useState)(0);
5903
+ const [roamReset, setRoamReset] = (0, import_react35.useState)(0);
5880
5904
  const chartToolbox = typeof resolvedToolbox === "object" ? {
5881
5905
  ...resolvedToolbox,
5882
5906
  onRestore: () => {
@@ -5885,23 +5909,23 @@ var GraphChart = (0, import_react34.forwardRef)(function GraphChart2({ nodes, li
5885
5909
  resolvedToolbox.onRestore?.();
5886
5910
  }
5887
5911
  } : resolvedToolbox;
5888
- const activeNodes = (0, import_react34.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
5889
- const activeLinks = (0, import_react34.useMemo)(() => {
5912
+ const activeNodes = (0, import_react35.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
5913
+ const activeLinks = (0, import_react35.useMemo)(() => {
5890
5914
  const activeIds = new Set(activeNodes.map((node) => node.id));
5891
5915
  return links.filter((link) => activeIds.has(link.source) && activeIds.has(link.target));
5892
5916
  }, [activeNodes, links]);
5893
5917
  const progressive = progressiveForce && layout === "force" && props.animation !== false && !/chord|和弦/i.test(magicType);
5894
- const calculatedPositions = (0, import_react34.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
5895
- const [positions, setPositions] = (0, import_react34.useState)(calculatedPositions);
5896
- const [dragging, setDragging] = (0, import_react34.useState)(null);
5897
- const heldNode = (0, import_react34.useRef)(null);
5898
- const [forceRestart, setForceRestart] = (0, import_react34.useState)(0);
5899
- (0, import_react34.useEffect)(() => {
5918
+ const calculatedPositions = (0, import_react35.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
5919
+ const [positions, setPositions] = (0, import_react35.useState)(calculatedPositions);
5920
+ const [dragging, setDragging] = (0, import_react35.useState)(null);
5921
+ const heldNode = (0, import_react35.useRef)(null);
5922
+ const [forceRestart, setForceRestart] = (0, import_react35.useState)(0);
5923
+ (0, import_react35.useEffect)(() => {
5900
5924
  setPositions(calculatedPositions);
5901
5925
  setDragging(null);
5902
5926
  heldNode.current = null;
5903
5927
  }, [calculatedPositions, roamReset]);
5904
- (0, import_react34.useEffect)(() => {
5928
+ (0, import_react35.useEffect)(() => {
5905
5929
  if (!progressive || activeNodes.length > (forceOptions?.maxNodes ?? 80)) return;
5906
5930
  let frame = 0, remaining = Math.max(0, forceOptions?.iterations ?? 140), previous, carry = 0;
5907
5931
  const tick = (time) => {
@@ -5922,7 +5946,7 @@ var GraphChart = (0, import_react34.forwardRef)(function GraphChart2({ nodes, li
5922
5946
  if (remaining > 0) frame = requestAnimationFrame(tick);
5923
5947
  return () => cancelAnimationFrame(frame);
5924
5948
  }, [progressive, activeNodes, activeLinks, forceOptions, calculatedPositions, roamReset, forceRestart]);
5925
- if (/chord|和弦/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5949
+ if (/chord|和弦/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5926
5950
  ChordChart,
5927
5951
  {
5928
5952
  ...props,
@@ -5940,10 +5964,10 @@ var GraphChart = (0, import_react34.forwardRef)(function GraphChart2({ nodes, li
5940
5964
  );
5941
5965
  const indexById = new Map(activeNodes.map((node, index) => [node.id, index]));
5942
5966
  const maxValue = Math.max(1, ...activeNodes.map((node) => node.value ?? 1));
5943
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, ref, palette, toolbox: chartToolbox, empty: !nodes.length, ariaLabel: props.ariaLabel ?? "\u5173\u7CFB\u56FE", children: [
5944
- categories.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { items: categories.map((name, index) => ({ name, color: getColor(index, void 0, palette), disabled: !legend.isSelected(name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
5945
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartRoamGroup, { enabled: Boolean(roam), zoomEnabled: roam !== "move", ariaLabel: roam === "move" ? "\u5173\u7CFB\u56FE\u6F2B\u6E38\u753B\u5E03\uFF1A\u65B9\u5411\u952E\u5E73\u79FB\uFF0CHome \u8FD8\u539F" : "\u5173\u7CFB\u56FE\u6F2B\u6E38\u753B\u5E03\uFF1A\u65B9\u5411\u952E\u5E73\u79FB\uFF0C\u52A0\u51CF\u952E\u7F29\u653E\uFF0CHome \u8FD8\u539F", width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, resetSignal: roamReset, children: [
5946
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("g", { className: "sia-chart__graph-links", children: activeLinks.map((link, index) => {
5967
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, ref, palette, toolbox: chartToolbox, empty: !nodes.length, ariaLabel: props.ariaLabel ?? "\u5173\u7CFB\u56FE", children: [
5968
+ categories.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { items: categories.map((name, index) => ({ name, color: getColor(index, void 0, palette), disabled: !legend.isSelected(name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
5969
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartRoamGroup, { enabled: Boolean(roam), zoomEnabled: roam !== "move", ariaLabel: roam === "move" ? "\u5173\u7CFB\u56FE\u6F2B\u6E38\u753B\u5E03\uFF1A\u65B9\u5411\u952E\u5E73\u79FB\uFF0CHome \u8FD8\u539F" : "\u5173\u7CFB\u56FE\u6F2B\u6E38\u753B\u5E03\uFF1A\u65B9\u5411\u952E\u5E73\u79FB\uFF0C\u52A0\u51CF\u952E\u7F29\u653E\uFF0CHome \u8FD8\u539F", width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, resetSignal: roamReset, children: [
5970
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("g", { className: "sia-chart__graph-links", children: activeLinks.map((link, index) => {
5947
5971
  const sourceIndex = indexById.get(link.source);
5948
5972
  const targetIndex = indexById.get(link.target);
5949
5973
  if (sourceIndex == null || targetIndex == null) return null;
@@ -5954,9 +5978,9 @@ var GraphChart = (0, import_react34.forwardRef)(function GraphChart2({ nodes, li
5954
5978
  const targetRadius = targetNode.imageSource ? (targetNode.imageSize?.[0] ?? 60) / 2 : targetNode.radius ?? 11 + Math.sqrt(Math.max(0, targetNode.value ?? 1) / maxValue) * 18;
5955
5979
  const reciprocal = link.arrow && activeLinks.some((other) => other.source === link.target && other.target === link.source);
5956
5980
  const geometry = graphLinkGeometry(source, target, { curvature: link.curvature, offset: link.offset ?? (reciprocal ? 4 : 0), arrow: link.arrow, arrowSize: link.arrowSize, targetRadius });
5957
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { label: link.label ?? `${activeNodes[sourceIndex].name} \u2192 ${activeNodes[targetIndex].name}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: link.label ?? `${activeNodes[sourceIndex].name} \u2192 ${activeNodes[targetIndex].name}` }), tooltipPoint: [...geometry.center], children: [
5958
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { className: "sia-chart__graph-link", d: geometry.path, fill: "none", stroke: link.color ?? "var(--sia-chart-axis)", strokeWidth: link.width ?? Math.max(1, Math.sqrt(link.value ?? 1)), strokeDasharray: link.dashed ? "6 4" : void 0 }),
5959
- geometry.arrow ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { className: "sia-chart__graph-arrow", points: geometry.arrow, fill: link.color ?? "var(--sia-chart-axis)" }) : null
5981
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { label: link.label ?? `${activeNodes[sourceIndex].name} \u2192 ${activeNodes[targetIndex].name}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: link.label ?? `${activeNodes[sourceIndex].name} \u2192 ${activeNodes[targetIndex].name}` }), tooltipPoint: [...geometry.center], children: [
5982
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { className: "sia-chart__graph-link", d: geometry.path, fill: "none", stroke: link.color ?? "var(--sia-chart-axis)", strokeWidth: link.width ?? Math.max(1, Math.sqrt(link.value ?? 1)), strokeDasharray: link.dashed ? "6 4" : void 0 }),
5983
+ geometry.arrow ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { className: "sia-chart__graph-arrow", points: geometry.arrow, fill: link.color ?? "var(--sia-chart-axis)" }) : null
5960
5984
  ] }, `${link.source}-${link.target}-${index}`);
5961
5985
  }) }),
5962
5986
  activeNodes.map((node, index) => {
@@ -5967,11 +5991,11 @@ var GraphChart = (0, import_react34.forwardRef)(function GraphChart2({ nodes, li
5967
5991
  const halfWidth = node.imageSource ? (node.imageSize?.[0] ?? 60) / 2 : radius, halfHeight = node.imageSource ? (node.imageSize?.[1] ?? 60) / 2 : radius;
5968
5992
  const labelX = position.x + (node.labelPosition === "right" ? halfWidth + 5 : node.labelPosition === "left" ? -halfWidth - 5 : 0);
5969
5993
  const labelY = position.y + 4 + (node.labelPosition === "top" ? -halfHeight - 10 : node.labelPosition === "bottom" ? halfHeight + 10 : 0);
5970
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
5994
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5971
5995
  ChartMark,
5972
5996
  {
5973
5997
  label: `${node.name}\uFF0C${node.value ?? 0}`,
5974
- tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: node.name, series: node.category, value: node.value ?? 0 }),
5998
+ tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: node.name, series: node.category, value: node.value ?? 0 }),
5975
5999
  tooltipPoint: [position.x, position.y],
5976
6000
  onPointerDown: (event) => {
5977
6001
  if (!(node.draggable ?? draggable) || node.fixed) return;
@@ -6006,11 +6030,11 @@ var GraphChart = (0, import_react34.forwardRef)(function GraphChart2({ nodes, li
6006
6030
  setForceRestart((value) => value + 1);
6007
6031
  },
6008
6032
  children: [
6009
- node.imageSource ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("image", { className: "sia-chart__graph-node", href: node.imageSource, x: position.x - halfWidth, y: position.y - halfHeight, width: halfWidth * 2, height: halfHeight * 2, preserveAspectRatio: "none" }) : node.symbol === "star" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { "data-symbol": "star", points: Array.from({ length: 10 }, (_, i) => {
6033
+ node.imageSource ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("image", { className: "sia-chart__graph-node", href: node.imageSource, x: position.x - halfWidth, y: position.y - halfHeight, width: halfWidth * 2, height: halfHeight * 2, preserveAspectRatio: "none" }) : node.symbol === "star" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { "data-symbol": "star", points: Array.from({ length: 10 }, (_, i) => {
6010
6034
  const angle = -Math.PI / 2 + i * Math.PI / 5, r = i % 2 ? radius * 0.5 : radius;
6011
6035
  return `${position.x + Math.cos(angle) * r},${position.y + Math.sin(angle) * r}`;
6012
- }).join(" "), fill: color, className: "sia-chart__graph-node", style: { stroke: node.borderColor, strokeWidth: node.borderWidth } }) : node.symbol === "square" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: position.x - radius, y: position.y - radius, width: radius * 2, height: radius * 2, rx: 4, fill: color, className: "sia-chart__graph-node", style: { stroke: node.borderColor, strokeWidth: node.borderWidth } }) : node.symbol === "diamond" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: position.x - radius * 0.72, y: position.y - radius * 0.72, width: radius * 1.44, height: radius * 1.44, rx: 3, transform: `rotate(45 ${position.x} ${position.y})`, fill: color, className: "sia-chart__graph-node", style: { stroke: node.borderColor, strokeWidth: node.borderWidth } }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: position.x, cy: position.y, r: radius, fill: color, className: "sia-chart__graph-node", style: { stroke: node.borderColor, strokeWidth: node.borderWidth } }),
6013
- showLabels ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: labelX, y: labelY, textAnchor: node.labelPosition === "left" ? "end" : node.labelPosition === "right" ? "start" : "middle", className: "sia-chart__graph-label", style: node.labelColor ? { fill: node.labelColor, fontWeight: 400, textShadow: "none" } : void 0, children: (node.label ?? node.name).split("\n").map((line, i, lines) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tspan", { x: labelX, dy: i === 0 ? -(lines.length - 1) * 7 : 14, children: line }, i)) }) : null
6036
+ }).join(" "), fill: color, className: "sia-chart__graph-node", style: { stroke: node.borderColor, strokeWidth: node.borderWidth } }) : node.symbol === "square" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: position.x - radius, y: position.y - radius, width: radius * 2, height: radius * 2, rx: 4, fill: color, className: "sia-chart__graph-node", style: { stroke: node.borderColor, strokeWidth: node.borderWidth } }) : node.symbol === "diamond" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: position.x - radius * 0.72, y: position.y - radius * 0.72, width: radius * 1.44, height: radius * 1.44, rx: 3, transform: `rotate(45 ${position.x} ${position.y})`, fill: color, className: "sia-chart__graph-node", style: { stroke: node.borderColor, strokeWidth: node.borderWidth } }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: position.x, cy: position.y, r: radius, fill: color, className: "sia-chart__graph-node", style: { stroke: node.borderColor, strokeWidth: node.borderWidth } }),
6037
+ showLabels ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: labelX, y: labelY, textAnchor: node.labelPosition === "left" ? "end" : node.labelPosition === "right" ? "start" : "middle", className: "sia-chart__graph-label", style: node.labelColor ? { fill: node.labelColor, fontWeight: 400, textShadow: "none" } : void 0, children: (node.label ?? node.name).split("\n").map((line, i, lines) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tspan", { x: labelX, dy: i === 0 ? -(lines.length - 1) * 7 : 14, children: line }, i)) }) : null
6014
6038
  ]
6015
6039
  },
6016
6040
  node.id
@@ -6019,8 +6043,8 @@ var GraphChart = (0, import_react34.forwardRef)(function GraphChart2({ nodes, li
6019
6043
  ] })
6020
6044
  ] });
6021
6045
  });
6022
- var ForceGraphChart = (0, import_react34.forwardRef)(function ForceGraphChart2(props, ref) {
6023
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GraphChart, { ...props, layout: "force", ref });
6046
+ var ForceGraphChart = (0, import_react35.forwardRef)(function ForceGraphChart2(props, ref) {
6047
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(GraphChart, { ...props, layout: "force", ref });
6024
6048
  });
6025
6049
  var ForceChart = ForceGraphChart;
6026
6050
  var chartMaps = /* @__PURE__ */ new Map();
@@ -6048,12 +6072,12 @@ function colorBetween(start, end, ratio) {
6048
6072
  const to = read(end);
6049
6073
  return `rgb(${from.map((value, index) => Math.round(value + ((to[index] ?? value) - value) * Math.max(0, Math.min(1, ratio)))).join(" ")})`;
6050
6074
  }
6051
- var MapChart = (0, import_react34.forwardRef)(function MapChart2({ overlayProjection, bundledLines, largeMarkPoints, markLineEffectRenderer = "svg", insetStyle, insetLabelStyle, regionHoverable = true, markPointTooltipFormatter, emphasisValueRange, onRegionHover, coordinateTransform, specialAreas, labelCoordinates, labelOffsets, nameMap, wheelZoomFactors, clampVisualValues = false, showMap = true, visualMapLayout, labelStyle, emphasisLabelStyle, regionStyle, emphasisRegionStyle, outOfRangeColor, scaleLimit, roamController = false, map, geoJson, data, colors = ["#e6f4ff", "#1677ff"], nameProperty = "name", showLabels = true, showEmphasisLabels = false, tooltipFormatter, roam = false, selectedMode = false, selected, defaultSelected, onSelectionChange, calculableVisualMap = false, visualRange, defaultVisualRange, onVisualRangeChange, markPoints = [], markLines = [], onRegionClick, toolbox, plotBounds: sourcePlotBounds, longitudeRatio, geographicInsets = [], valueDomain, showVisualMap = true, seriesName, ...props }, ref) {
6052
- const [internalSelected, setInternalSelected] = (0, import_react34.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
6075
+ var MapChart = (0, import_react35.forwardRef)(function MapChart2({ overlayProjection, bundledLines, largeMarkPoints, markLineEffectRenderer = "svg", insetStyle, insetLabelStyle, regionHoverable = true, markPointTooltipFormatter, emphasisValueRange, onRegionHover, coordinateTransform, specialAreas, labelCoordinates, labelOffsets, nameMap, wheelZoomFactors, clampVisualValues = false, showMap = true, visualMapLayout, labelStyle, emphasisLabelStyle, regionStyle, emphasisRegionStyle, outOfRangeColor, scaleLimit, roamController = false, map, geoJson, data, colors = ["#e6f4ff", "#1677ff"], nameProperty = "name", showLabels = true, showEmphasisLabels = false, tooltipFormatter, roam = false, selectedMode = false, selected, defaultSelected, onSelectionChange, calculableVisualMap = false, visualRange, defaultVisualRange, onVisualRangeChange, markPoints = [], markLines = [], onRegionClick, toolbox, plotBounds: sourcePlotBounds, longitudeRatio, geographicInsets = [], valueDomain, showVisualMap = true, seriesName, ...props }, ref) {
6076
+ const [internalSelected, setInternalSelected] = (0, import_react35.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
6053
6077
  const selectedNames = selected ?? internalSelected;
6054
- const [hoveredRegion, setHoveredRegion] = (0, import_react34.useState)();
6055
- const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react34.useState)();
6056
- const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react34.useState)();
6078
+ const [hoveredRegion, setHoveredRegion] = (0, import_react35.useState)();
6079
+ const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react35.useState)();
6080
+ const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react35.useState)();
6057
6081
  const hoveredValueRange = emphasisValueRange ?? internalHoveredValueRange;
6058
6082
  const roamControl = useMapRoam(roam, scaleLimit, wheelZoomFactors);
6059
6083
  const { view } = roamControl;
@@ -6068,8 +6092,8 @@ var MapChart = (0, import_react34.forwardRef)(function MapChart2({ overlayProjec
6068
6092
  const values = data.map((item) => item.value);
6069
6093
  const minimum = valueDomain?.[0] ?? (values.length ? Math.min(...values) : 0);
6070
6094
  const maximum = valueDomain?.[1] ?? (values.length ? Math.max(...values) : 1);
6071
- const [internalVisualRange, setInternalVisualRange] = (0, import_react34.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
6072
- (0, import_react34.useEffect)(() => {
6095
+ const [internalVisualRange, setInternalVisualRange] = (0, import_react35.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
6096
+ (0, import_react35.useEffect)(() => {
6073
6097
  if (!visualRange && !defaultVisualRange) setInternalVisualRange([minimum, maximum]);
6074
6098
  }, [defaultVisualRange, maximum, minimum, visualRange]);
6075
6099
  const currentVisualRange = visualRange ?? internalVisualRange;
@@ -6095,10 +6119,10 @@ var MapChart = (0, import_react34.forwardRef)(function MapChart2({ overlayProjec
6095
6119
  linearScale(point[1], [bounds.minY, bounds.maxY], [plotBounds ? plotBounds.y + plotBounds.height : 306, plotBounds?.y ?? 44])
6096
6120
  ];
6097
6121
  };
6098
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, ref, toolbox: chartToolbox, empty: !collection?.features.length && !overlayProjection, ariaLabel: props.ariaLabel ?? "\u5730\u56FE", children: [
6099
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { ref: roamControl.host, ...roamControl.handlers, "data-map-viewport": true, tabIndex: roam ? 0 : void 0, role: roam ? "group" : void 0, "aria-label": roam ? "\u5730\u56FE\u6F2B\u6E38\uFF1A\u62D6\u52A8\u5E73\u79FB\u3001\u6EDA\u8F6E\u7F29\u653E\u3001Home \u8FD8\u539F" : void 0, style: { touchAction: roam ? "none" : void 0 }, children: [
6100
- roam ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: 0, y: 0, width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, fill: "transparent", className: "sia-chart__map-roam-surface" }) : null,
6101
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { "data-map-transform": true, style: { display: showMap ? void 0 : "none" }, transform: `translate(${view.x} ${view.y}) scale(${view.scale})`, children: [
6122
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, ref, toolbox: chartToolbox, empty: !collection?.features.length && !overlayProjection, ariaLabel: props.ariaLabel ?? "\u5730\u56FE", children: [
6123
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { ref: roamControl.host, ...roamControl.handlers, "data-map-viewport": true, tabIndex: roam ? 0 : void 0, role: roam ? "group" : void 0, "aria-label": roam ? "\u5730\u56FE\u6F2B\u6E38\uFF1A\u62D6\u52A8\u5E73\u79FB\u3001\u6EDA\u8F6E\u7F29\u653E\u3001Home \u8FD8\u539F" : void 0, style: { touchAction: roam ? "none" : void 0 }, children: [
6124
+ roam ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: 0, y: 0, width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, fill: "transparent", className: "sia-chart__map-roam-surface" }) : null,
6125
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { "data-map-transform": true, style: { display: showMap ? void 0 : "none" }, transform: `translate(${view.x} ${view.y}) scale(${view.scale})`, children: [
6102
6126
  collection?.features.map((feature, featureIndex) => {
6103
6127
  const originalName = String(feature.properties[nameProperty] ?? feature.properties.name ?? `\u533A\u57DF ${featureIndex + 1}`);
6104
6128
  const name = nameMap?.[originalName] ?? originalName;
@@ -6141,9 +6165,9 @@ var MapChart = (0, import_react34.forwardRef)(function MapChart2({ overlayProjec
6141
6165
  onSelectionChange?.(next);
6142
6166
  }
6143
6167
  };
6144
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { style: regionHoverable ? void 0 : { pointerEvents: "none" }, tabIndex: regionHoverable ? void 0 : -1, "data-map-region": name, "data-map-original-name": originalName, "aria-selected": selectedMode ? isSelected : void 0, label: `${name}\uFF0C${datum ? formatChartNumber(value) : "\u65E0\u6570\u636E"}`, tooltip: tooltipFormatter ? tooltipFormatter(name, datum) : datum ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name, series: seriesName, value }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6145
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: name }),
6146
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
6168
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { style: regionHoverable ? void 0 : { pointerEvents: "none" }, tabIndex: regionHoverable ? void 0 : -1, "data-map-region": name, "data-map-original-name": originalName, "aria-selected": selectedMode ? isSelected : void 0, label: `${name}\uFF0C${datum ? formatChartNumber(value) : "\u65E0\u6570\u636E"}`, tooltip: tooltipFormatter ? tooltipFormatter(name, datum) : datum ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name, series: seriesName, value }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6169
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: name }),
6170
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
6147
6171
  seriesName,
6148
6172
  "\uFF1A\u65E0\u6570\u636E"
6149
6173
  ] })
@@ -6168,20 +6192,20 @@ var MapChart = (0, import_react34.forwardRef)(function MapChart2({ overlayProjec
6168
6192
  toggleRegion();
6169
6193
  onRegionClick?.({ name, value, data: datum ?? feature, nativeEvent: event });
6170
6194
  }, children: [
6171
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: path, fill: color, style: appearance.regionStyle, opacity: outOfRangeColor || value >= currentVisualRange[0] && value <= currentVisualRange[1] ? 1 : 0.16, className: `sia-chart__map-region${isSelected ? " sia-chart__map-region--selected" : ""}`, fillRule: "evenodd" }),
6172
- appearance.showLabel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: center[0], y: center[1] + 4, textAnchor: "middle", style: appearance.labelStyle, className: "sia-chart__map-label", children: name }) : null,
6173
- datum?.legendSymbols?.map((symbol, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { "data-map-legend-symbol": symbol.name, cx: center[0] + 3 + 7 * index, cy: center[1] - 10, r: 3, fill: symbol.color, pointerEvents: "none" }, symbol.name))
6195
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: path, fill: color, style: appearance.regionStyle, opacity: outOfRangeColor || value >= currentVisualRange[0] && value <= currentVisualRange[1] ? 1 : 0.16, className: `sia-chart__map-region${isSelected ? " sia-chart__map-region--selected" : ""}`, fillRule: "evenodd" }),
6196
+ appearance.showLabel ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: center[0], y: center[1] + 4, textAnchor: "middle", style: appearance.labelStyle, className: "sia-chart__map-label", children: name }) : null,
6197
+ datum?.legendSymbols?.map((symbol, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { "data-map-legend-symbol": symbol.name, cx: center[0] + 3 + 7 * index, cy: center[1] - 10, r: 3, fill: symbol.color, pointerEvents: "none" }, symbol.name))
6174
6198
  ] }, `${name}-${featureIndex}`);
6175
6199
  }),
6176
6200
  geographicInsets.map((inset) => {
6177
6201
  const anchor = project(inset.coordinate), unit = project([inset.coordinate[0] + 1, inset.coordinate[1]]);
6178
6202
  const scale = (unit[0] - anchor[0]) / inset.unitsPerLongitude;
6179
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { "data-map-inset": inset.name, role: "img", "aria-label": inset.name, children: [
6180
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: inset.polygons.map((polygon) => polygon.map((point, index) => `${index ? "L" : "M"} ${anchor[0] + point[0] * scale} ${anchor[1] + point[1] * scale}`).join(" ") + " Z").join(" "), fill: "#ccc", style: insetStyle }),
6181
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: anchor[0] + inset.label[0] * scale, y: anchor[1] + inset.label[1] * scale, textAnchor: "middle", fontSize: 10, style: insetLabelStyle, children: inset.name })
6203
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { "data-map-inset": inset.name, role: "img", "aria-label": inset.name, children: [
6204
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: inset.polygons.map((polygon) => polygon.map((point, index) => `${index ? "L" : "M"} ${anchor[0] + point[0] * scale} ${anchor[1] + point[1] * scale}`).join(" ") + " Z").join(" "), fill: "#ccc", style: insetStyle }),
6205
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: anchor[0] + inset.label[0] * scale, y: anchor[1] + inset.label[1] * scale, textAnchor: "middle", fontSize: 10, style: insetLabelStyle, children: inset.name })
6182
6206
  ] }, inset.name);
6183
6207
  }),
6184
- bundledLines ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartBundledMapCanvas, { ...bundledLines, edges: bundledLines.edges.map((edge) => ({ source: project(edge.source), target: project(edge.target) })), points: bundledLines.points?.map(project), width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360 }) : null,
6208
+ bundledLines ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartBundledMapCanvas, { ...bundledLines, edges: bundledLines.edges.map((edge) => ({ source: project(edge.source), target: project(edge.target) })), points: bundledLines.points?.map(project), width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360 }) : null,
6185
6209
  markLines.map((line, index) => {
6186
6210
  if (line.visualMap && ((line.value ?? minimum) < currentVisualRange[0] || (line.value ?? minimum) > currentVisualRange[1])) return null;
6187
6211
  const source = project(line.source);
@@ -6192,24 +6216,24 @@ var MapChart = (0, import_react34.forwardRef)(function MapChart2({ overlayProjec
6192
6216
  const path = `M ${source[0]} ${source[1]} Q ${middleX} ${middleY} ${target[0]} ${target[1]}`;
6193
6217
  const color = line.color ?? (line.visualMap ? chartColorRamp(colors, ((line.value ?? minimum) - minimum) / Math.max(1, maximum - minimum)) : chartColor(index, props.palette ?? DEFAULT_CHART_PALETTE));
6194
6218
  const angle = Math.atan2(target[1] - middleY, target[0] - middleX) * 180 / Math.PI;
6195
- const content = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMapLineReveal, { source, control: [middleX, middleY], target, enabled: Boolean(line.reveal), ...line.reveal, children: (visibleControl, visibleTarget) => {
6219
+ const content = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMapLineReveal, { source, control: [middleX, middleY], target, enabled: Boolean(line.reveal), ...line.reveal, children: (visibleControl, visibleTarget) => {
6196
6220
  const visiblePath = `M ${source[0]} ${source[1]} Q ${visibleControl[0]} ${visibleControl[1]} ${visibleTarget[0]} ${visibleTarget[1]}`, visibleAngle = Math.atan2(visibleTarget[1] - visibleControl[1], visibleTarget[0] - visibleControl[0]) * 180 / Math.PI;
6197
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6198
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: visiblePath, style: { ...line.lineStyle, filter: line.shadowBlur ? `drop-shadow(0 0 ${line.shadowBlur}px ${color})` : line.lineStyle?.filter }, fill: "none", stroke: color, strokeWidth: line.width ?? 1.5, strokeDasharray: line.dashed ? "5 5" : void 0 }),
6199
- line.endpointSizes ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6200
- line.endpointSymbols?.[0] !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { style: line.endpointStyle, "data-map-line-start": true, cx: source[0], cy: source[1], r: line.endpointSizes[0], fill: color }) : null,
6201
- line.endpointSymbols?.[1] === "circle" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { style: line.endpointStyle, "data-map-line-end": true, cx: visibleTarget[0], cy: visibleTarget[1], r: line.endpointSizes[1], fill: color }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { style: line.endpointStyle, "data-map-line-end": true, transform: `translate(${visibleTarget[0]} ${visibleTarget[1]}) rotate(${visibleAngle})`, d: `M0 0 L${-line.endpointSizes[1] * 2} ${-line.endpointSizes[1]} L${-line.endpointSizes[1] * 2} ${line.endpointSizes[1]} Z`, fill: color })
6221
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6222
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: visiblePath, style: { ...line.lineStyle, filter: line.shadowBlur ? `drop-shadow(0 0 ${line.shadowBlur}px ${color})` : line.lineStyle?.filter }, fill: "none", stroke: color, strokeWidth: line.width ?? 1.5, strokeDasharray: line.dashed ? "5 5" : void 0 }),
6223
+ line.endpointSizes ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6224
+ line.endpointSymbols?.[0] !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { style: line.endpointStyle, "data-map-line-start": true, cx: source[0], cy: source[1], r: line.endpointSizes[0], fill: color }) : null,
6225
+ line.endpointSymbols?.[1] === "circle" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { style: line.endpointStyle, "data-map-line-end": true, cx: visibleTarget[0], cy: visibleTarget[1], r: line.endpointSizes[1], fill: color }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { style: line.endpointStyle, "data-map-line-end": true, transform: `translate(${visibleTarget[0]} ${visibleTarget[1]}) rotate(${visibleAngle})`, d: `M0 0 L${-line.endpointSizes[1] * 2} ${-line.endpointSizes[1]} L${-line.endpointSizes[1] * 2} ${line.endpointSizes[1]} Z`, fill: color })
6202
6226
  ] }) : null,
6203
- line.movingEffect ? markLineEffectRenderer === "canvas" ? null : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMapLineEffect, { source, control: [middleX, middleY], target, ...line.movingEffect }) : line.effect ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { r: 4, fill: color, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("animateMotion", { dur: "2s", repeatCount: "indefinite", path }) }) : null
6227
+ line.movingEffect ? markLineEffectRenderer === "canvas" ? null : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMapLineEffect, { source, control: [middleX, middleY], target, ...line.movingEffect }) : line.effect ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { r: 4, fill: color, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("animateMotion", { dur: "2s", repeatCount: "indefinite", path }) }) : null
6204
6228
  ] });
6205
6229
  } });
6206
- return line.tooltip ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { "data-map-line": line.name, "data-map-line-series": line.seriesName, className: "sia-chart__map-mark-line", label: line.name ?? "\u5730\u56FE\u6807\u7EBF", tooltip: line.tooltip, tooltipPoint: [middleX, middleY], children: content }, `${line.name ?? index}-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("g", { className: `sia-chart__map-mark-line${line.effect ? " sia-chart__map-effect" : ""}`, children: content }, `${line.name ?? index}-${index}`);
6230
+ return line.tooltip ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { "data-map-line": line.name, "data-map-line-series": line.seriesName, className: "sia-chart__map-mark-line", label: line.name ?? "\u5730\u56FE\u6807\u7EBF", tooltip: line.tooltip, tooltipPoint: [middleX, middleY], children: content }, `${line.name ?? index}-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("g", { className: `sia-chart__map-mark-line${line.effect ? " sia-chart__map-effect" : ""}`, children: content }, `${line.name ?? index}-${index}`);
6207
6231
  }),
6208
- markLineEffectRenderer === "canvas" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMapEffectCanvas, { width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, effects: markLines.filter((line) => line.movingEffect && (!line.visualMap || (line.value ?? minimum) >= currentVisualRange[0] && (line.value ?? minimum) <= currentVisualRange[1])).map((line) => {
6232
+ markLineEffectRenderer === "canvas" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMapEffectCanvas, { width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, effects: markLines.filter((line) => line.movingEffect && (!line.visualMap || (line.value ?? minimum) >= currentVisualRange[0] && (line.value ?? minimum) <= currentVisualRange[1])).map((line) => {
6209
6233
  const source = project(line.source), target = project(line.target), control = line.curveMode ? mapLineControl(source, target, line.curveness ?? 0.2) : [(source[0] + target[0]) / 2, (source[1] + target[1]) / 2 - (line.curveness ?? 0.2) * Math.hypot(target[0] - source[0], target[1] - source[1])];
6210
6234
  return { source, target, control, ...line.movingEffect };
6211
6235
  }) }) : null,
6212
- largeMarkPoints ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLargeMapPointCanvas, { width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, groups: largeMarkPoints.map((group) => ({ ...group, points: group.points.map(project) })) }) : null,
6236
+ largeMarkPoints ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLargeMapPointCanvas, { width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, groups: largeMarkPoints.map((group) => ({ ...group, points: group.points.map(project) })) }) : null,
6213
6237
  markPoints.map((point, index) => {
6214
6238
  const position = point.coordinateSpace === "svg" ? point.coordinate : project(point.coordinate);
6215
6239
  const markValue = point.value ?? minimum;
@@ -6217,38 +6241,38 @@ var MapChart = (0, import_react34.forwardRef)(function MapChart2({ overlayProjec
6217
6241
  const color = point.color ?? (point.visualMap ? chartColorRamp(colors, (markValue - minimum) / Math.max(1, maximum - minimum)) : chartColor(index, props.palette ?? DEFAULT_CHART_PALETTE));
6218
6242
  const size = point.size ?? 7, emphasized = hoveredMarkPoint === index;
6219
6243
  const style = { ...point.style, ...emphasized ? point.emphasisStyle : void 0 };
6220
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { "data-map-point": point.name, "data-map-point-series": point.seriesName, label: `${point.name}\uFF0C${point.value ?? ""}`, tooltip: markPointTooltipFormatter ? markPointTooltipFormatter(point) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6221
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("strong", { children: [
6244
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { "data-map-point": point.name, "data-map-point-series": point.seriesName, label: `${point.name}\uFF0C${point.value ?? ""}`, tooltip: markPointTooltipFormatter ? markPointTooltipFormatter(point) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6245
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("strong", { children: [
6222
6246
  point.seriesName,
6223
- point.seriesName ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("br", {}) : null,
6247
+ point.seriesName ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("br", {}) : null,
6224
6248
  point.name
6225
6249
  ] }),
6226
- point.value != null ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("b", { children: formatChartNumber(point.value) }) : null
6227
- ] }), tooltipPoint: position, onPointerMove: () => setHoveredMarkPoint(index), onPointerLeave: () => setHoveredMarkPoint(void 0), onFocus: () => setHoveredMarkPoint(index), onBlur: () => setHoveredMarkPoint(void 0), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMapPointEntrance, { enabled: point.entrance ?? false, x: position[0], y: position[1], children: [
6228
- point.imageSrc ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("image", { "data-map-point-image": true, href: point.imageSrc, x: position[0] - size, y: position[1] - size, width: size * 2, height: size * 2, preserveAspectRatio: "none", style }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6229
- point.effect ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("circle", { cx: position[0], cy: position[1], r: size, fill: "none", stroke: color, className: "sia-chart__map-ripple", children: [
6230
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("animate", { attributeName: "r", values: `${size};${size * 2.8}`, dur: "1.5s", repeatCount: "indefinite" }),
6231
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("animate", { attributeName: "opacity", values: ".9;0", dur: "1.5s", repeatCount: "indefinite" })
6250
+ point.value != null ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("b", { children: formatChartNumber(point.value) }) : null
6251
+ ] }), tooltipPoint: position, onPointerMove: () => setHoveredMarkPoint(index), onPointerLeave: () => setHoveredMarkPoint(void 0), onFocus: () => setHoveredMarkPoint(index), onBlur: () => setHoveredMarkPoint(void 0), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMapPointEntrance, { enabled: point.entrance ?? false, x: position[0], y: position[1], children: [
6252
+ point.imageSrc ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("image", { "data-map-point-image": true, href: point.imageSrc, x: position[0] - size, y: position[1] - size, width: size * 2, height: size * 2, preserveAspectRatio: "none", style }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6253
+ point.effect ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("circle", { cx: position[0], cy: position[1], r: size, fill: "none", stroke: color, className: "sia-chart__map-ripple", children: [
6254
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("animate", { attributeName: "r", values: `${size};${size * 2.8}`, dur: "1.5s", repeatCount: "indefinite" }),
6255
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("animate", { attributeName: "opacity", values: ".9;0", dur: "1.5s", repeatCount: "indefinite" })
6232
6256
  ] }) : null,
6233
- point.scaleEffect ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("circle", { className: "sia-chart__map-point", "data-map-scale-effect": point.scaleEffect.duration, cx: position[0], cy: position[1], r: size * (point.scaleEffect.scaleSize ?? 2) * 0.1, fill: "none", style: { stroke: color, strokeWidth: 0.1 }, children: [
6234
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("animate", { attributeName: "r", values: `${size * (point.scaleEffect.scaleSize ?? 2) * 0.1};${size * (point.scaleEffect.scaleSize ?? 2)}`, dur: `${point.scaleEffect.duration}ms`, repeatCount: "indefinite", calcMode: "linear" }),
6235
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("animate", { attributeName: "stroke-width", values: ".1;1", dur: `${point.scaleEffect.duration}ms`, repeatCount: "indefinite", calcMode: "linear" })
6236
- ] }) : point.symbol === "pin" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { className: "sia-chart__map-point", transform: `translate(${position[0]} ${position[1]})`, d: point.pinShape === "arc" ? `M${-Math.cos(Math.PI / 5) * size} ${(Math.sin(Math.PI / 5) - 1.5) * size} A${size} ${size} 0 1 1 ${Math.cos(Math.PI / 5) * size} ${(Math.sin(Math.PI / 5) - 1.5) * size} L0 0 Z` : `M0 0 C${-size / 2} ${-size} ${-size} ${-size} ${-size} ${-size * 1.5} A${size} ${size} 0 1 1 ${size} ${-size * 1.5} C${size} ${-size} ${size / 2} ${-size} 0 0 Z`, fill: color, style }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: position[0], cy: position[1], r: size, fill: point.symbol === "emptyCircle" ? "none" : color, stroke: point.symbol === "emptyCircle" ? color : void 0, style, className: "sia-chart__map-point" })
6257
+ point.scaleEffect ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("circle", { className: "sia-chart__map-point", "data-map-scale-effect": point.scaleEffect.duration, cx: position[0], cy: position[1], r: size * (point.scaleEffect.scaleSize ?? 2) * 0.1, fill: "none", style: { stroke: color, strokeWidth: 0.1 }, children: [
6258
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("animate", { attributeName: "r", values: `${size * (point.scaleEffect.scaleSize ?? 2) * 0.1};${size * (point.scaleEffect.scaleSize ?? 2)}`, dur: `${point.scaleEffect.duration}ms`, repeatCount: "indefinite", calcMode: "linear" }),
6259
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("animate", { attributeName: "stroke-width", values: ".1;1", dur: `${point.scaleEffect.duration}ms`, repeatCount: "indefinite", calcMode: "linear" })
6260
+ ] }) : point.symbol === "pin" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { className: "sia-chart__map-point", transform: `translate(${position[0]} ${position[1]})`, d: point.pinShape === "arc" ? `M${-Math.cos(Math.PI / 5) * size} ${(Math.sin(Math.PI / 5) - 1.5) * size} A${size} ${size} 0 1 1 ${Math.cos(Math.PI / 5) * size} ${(Math.sin(Math.PI / 5) - 1.5) * size} L0 0 Z` : `M0 0 C${-size / 2} ${-size} ${-size} ${-size} ${-size} ${-size * 1.5} A${size} ${size} 0 1 1 ${size} ${-size * 1.5} C${size} ${-size} ${size / 2} ${-size} 0 0 Z`, fill: color, style }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: position[0], cy: position[1], r: size, fill: point.symbol === "emptyCircle" ? "none" : color, stroke: point.symbol === "emptyCircle" ? color : void 0, style, className: "sia-chart__map-point" })
6237
6261
  ] }),
6238
- point.label != null ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { "data-map-point-value": true, x: position[0], y: position[1] - (point.symbol === "pin" ? size * 1.5 : 0), textAnchor: "middle", dominantBaseline: "central", style: { fill: "#fff", fontSize: 12, pointerEvents: "none", ...point.labelStyle }, children: point.label }) : null,
6239
- point.showEmphasisLabel && emphasized ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { "data-map-point-label": true, x: position[0], y: position[1] - size - 6, textAnchor: "middle", style: { fill: color, fontSize: 12 }, children: point.name }) : null
6262
+ point.label != null ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { "data-map-point-value": true, x: position[0], y: position[1] - (point.symbol === "pin" ? size * 1.5 : 0), textAnchor: "middle", dominantBaseline: "central", style: { fill: "#fff", fontSize: 12, pointerEvents: "none", ...point.labelStyle }, children: point.label }) : null,
6263
+ point.showEmphasisLabel && emphasized ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { "data-map-point-label": true, x: position[0], y: position[1] - size - 6, textAnchor: "middle", style: { fill: color, fontSize: 12 }, children: point.name }) : null
6240
6264
  ] }) }, `${point.name}-${index}`);
6241
6265
  })
6242
6266
  ] })
6243
6267
  ] }),
6244
- showVisualMap ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartVisualMap, { min: minimum, max: maximum, colors, x: 18, y: 260, width: 104, label: "\u6570\u503C", ...visualMapLayout, onHoverRange: setHoveredValueRange, indicatorValue: data.find((item) => item.name === hoveredRegion)?.value, calculable: calculableVisualMap, range: currentVisualRange, onRangeChange: updateVisualRange }) : null,
6245
- roamController ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartRoamController, { x: (props.viewBoxSize?.[0] ?? 720) - 90, y: 5, onPan: roamControl.pan, onZoom: (factor) => roamControl.zoom(factor, [(props.viewBoxSize?.[0] ?? 720) / 2, (props.viewBoxSize?.[1] ?? 360) / 2]) }) : null
6268
+ showVisualMap ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartVisualMap, { min: minimum, max: maximum, colors, x: 18, y: 260, width: 104, label: "\u6570\u503C", ...visualMapLayout, onHoverRange: setHoveredValueRange, indicatorValue: data.find((item) => item.name === hoveredRegion)?.value, calculable: calculableVisualMap, range: currentVisualRange, onRangeChange: updateVisualRange }) : null,
6269
+ roamController ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartRoamController, { x: (props.viewBoxSize?.[0] ?? 720) - 90, y: 5, onPan: roamControl.pan, onZoom: (factor) => roamControl.zoom(factor, [(props.viewBoxSize?.[0] ?? 720) / 2, (props.viewBoxSize?.[1] ?? 360) / 2]) }) : null
6246
6270
  ] });
6247
6271
  });
6248
- var GaugeChart = (0, import_react34.forwardRef)(function GaugeChart2({ tooltipFormatter, data, min = 0, max = 100, startAngle = 210, endAngle = -30, segments, splitNumber = 10, showAxisLabels = true, showProgress = true, detailOffset = 84, valueFormatter, onDataClick, palette, appearance = "sia", animationProgress, ...props }, ref) {
6272
+ var GaugeChart = (0, import_react35.forwardRef)(function GaugeChart2({ tooltipFormatter, data, min = 0, max = 100, startAngle = 210, endAngle = -30, segments, splitNumber = 10, showAxisLabels = true, showProgress = true, detailOffset = 84, valueFormatter, onDataClick, palette, appearance = "sia", animationProgress, ...props }, ref) {
6249
6273
  const count = Math.max(1, data.length);
6250
6274
  const legacy = appearance === "macarons";
6251
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, empty: !data.length, ariaLabel: props.ariaLabel ?? "\u4EEA\u8868\u76D8", children: [...data].sort((a, b) => (a.zIndex ?? 0) - (b.zIndex ?? 0)).map((item, index) => {
6275
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, empty: !data.length, ariaLabel: props.ariaLabel ?? "\u4EEA\u8868\u76D8", children: [...data].sort((a, b) => (a.zIndex ?? 0) - (b.zIndex ?? 0)).map((item, index) => {
6252
6276
  const centerX = item.center?.[0] ?? (count === 1 ? 360 : 150 + index * 420 / Math.max(1, count - 1));
6253
6277
  const centerY = item.center?.[1] ?? 194;
6254
6278
  const radius = item.radius ?? (count === 1 ? 122 : Math.min(96, 270 / count));
@@ -6272,68 +6296,68 @@ var GaugeChart = (0, import_react34.forwardRef)(function GaugeChart2({ tooltipFo
6272
6296
  const major = Math.max(1, item.splitNumber ?? splitNumber), minor = Math.max(1, item.tickCount ?? 5);
6273
6297
  const at = (angle, r) => [centerX + Math.cos(angle) * r, centerY + Math.sin(angle) * r];
6274
6298
  const titlePosition = item.nameOffset ?? [0, -radius * 0.4], detailPosition = item.detailPosition ?? [0, radius * 0.4];
6275
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { label: `${item.name}\uFF0C${item.value}`, tooltip: tooltipFormatter?.(item) ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: item.name, value: item.value }), tooltipPoint: [centerX, centerY], onPointerUp: (event) => onDataClick?.({ name: item.name, value: item.value, data: item, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { style: item.glow ? { filter: "drop-shadow(0 0 4px #fff)" } : void 0, children: [
6299
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { label: `${item.name}\uFF0C${item.value}`, tooltip: tooltipFormatter?.(item) ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: item.name, value: item.value }), tooltipPoint: [centerX, centerY], onPointerUp: (event) => onDataClick?.({ name: item.name, value: item.value, data: item, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { style: item.glow ? { filter: "drop-shadow(0 0 4px #fff)" } : void 0, children: [
6276
6300
  normalizedSegments.map((segment, i) => {
6277
6301
  const d = svgArcPath(centerX, centerY, radius, start + sweep * previous, start + sweep * segment.until, Math.max(0, radius - axisWidth));
6278
6302
  previous = segment.until;
6279
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d, fill: segment.color }, i);
6303
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d, fill: segment.color }, i);
6280
6304
  }),
6281
6305
  item.showTicks !== false ? Array.from({ length: major * minor + 1 }, (_, tick) => {
6282
6306
  const t = tick / (major * minor), angle = start + sweep * t, a = at(angle, radius), b = at(angle, radius - (item.tickLength ?? 8));
6283
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: a[0], y1: a[1], x2: b[0], y2: b[1], stroke: resolveColor(item.tickColor, t, "#eee"), strokeWidth: 1 }, tick);
6307
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: a[0], y1: a[1], x2: b[0], y2: b[1], stroke: resolveColor(item.tickColor, t, "#eee"), strokeWidth: 1 }, tick);
6284
6308
  }) : null,
6285
6309
  Array.from({ length: major + 1 }, (_, tick) => {
6286
6310
  const t = tick / major, angle = start + sweep * t, a = at(angle, radius), b = at(angle, radius - (item.splitLength ?? 30)), p = at(angle, radius - (item.splitLength ?? 30) - 5), value = Number((itemMin + (itemMax - itemMin) * t).toFixed(6));
6287
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
6288
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: a[0], y1: a[1], x2: b[0], y2: b[1], stroke: resolveColor(item.splitColor, t, "#eee"), strokeWidth: item.splitWidth ?? 2 }),
6289
- showAxisLabels ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: p[0], y: p[1] + 4, textAnchor: Math.cos(angle) < -0.34 ? "start" : Math.cos(angle) > 0.34 ? "end" : "middle", fill: resolveColor(item.labelColor, t, "#333"), fontSize: item.labelFontSize ?? 12, fontWeight: item.labelFontWeight, children: item.labelFormatter?.(value) ?? formatChartNumber(value) }) : null
6311
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
6312
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: a[0], y1: a[1], x2: b[0], y2: b[1], stroke: resolveColor(item.splitColor, t, "#eee"), strokeWidth: item.splitWidth ?? 2 }),
6313
+ showAxisLabels ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: p[0], y: p[1] + 4, textAnchor: Math.cos(angle) < -0.34 ? "start" : Math.cos(angle) > 0.34 ? "end" : "middle", fill: resolveColor(item.labelColor, t, "#333"), fontSize: item.labelFontSize ?? 12, fontWeight: item.labelFontWeight, children: item.labelFormatter?.(value) ?? formatChartNumber(value) }) : null
6290
6314
  ] }, tick);
6291
6315
  }),
6292
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPointMotion, { points: [[0, start], [0, valueAngle]], enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (points) => {
6316
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPointMotion, { points: [[0, start], [0, valueAngle]], enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (points) => {
6293
6317
  const angle = points[1]?.[1] ?? valueAngle, pointerPoints = gaugePointerPoints([centerX, centerY], angle, radius * pointerLength, item.pointerWidth ?? 8);
6294
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { points: pointerPoints.map((point) => point.join(",")).join(" "), fill: resolveColor(item.pointerColor, ratio, colorAt(ratio)) });
6318
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { points: pointerPoints.map((point) => point.join(",")).join(" "), fill: resolveColor(item.pointerColor, ratio, colorAt(ratio)) });
6295
6319
  } }),
6296
- item.showName !== false ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: centerX + titlePosition[0], y: centerY + titlePosition[1], textAnchor: "middle", dominantBaseline: "middle", fontSize: item.nameFontSize ?? 15, fontWeight: item.nameFontWeight, fontStyle: item.nameFontStyle, fill: item.nameColor ?? "#333", children: item.name }) : null,
6297
- item.showDetail !== false ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6298
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: centerX + detailPosition[0] - (item.detailBox?.width ?? 100) / 2, y: centerY + detailPosition[1], width: item.detailBox?.width ?? 100, height: item.detailBox?.height ?? 40, fill: item.detailBox?.background ?? "transparent", stroke: item.detailBox?.borderColor ?? "transparent", strokeWidth: item.detailBox?.borderWidth ?? 0 }),
6299
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: centerX + detailPosition[0], y: centerY + detailPosition[1] + (item.detailBox?.height ?? 40) / 2, dominantBaseline: "central", textAnchor: "middle", fontSize: item.detailFontSize ?? 30, fontWeight: item.detailFontWeight, fill: resolveColor(item.detailColor, ratio, colorAt(ratio)), children: valueFormatter ? valueFormatter(item.value) : `${formatChartNumber(item.value)}${item.unit ?? ""}` })
6320
+ item.showName !== false ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: centerX + titlePosition[0], y: centerY + titlePosition[1], textAnchor: "middle", dominantBaseline: "middle", fontSize: item.nameFontSize ?? 15, fontWeight: item.nameFontWeight, fontStyle: item.nameFontStyle, fill: item.nameColor ?? "#333", children: item.name }) : null,
6321
+ item.showDetail !== false ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6322
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: centerX + detailPosition[0] - (item.detailBox?.width ?? 100) / 2, y: centerY + detailPosition[1], width: item.detailBox?.width ?? 100, height: item.detailBox?.height ?? 40, fill: item.detailBox?.background ?? "transparent", stroke: item.detailBox?.borderColor ?? "transparent", strokeWidth: item.detailBox?.borderWidth ?? 0 }),
6323
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: centerX + detailPosition[0], y: centerY + detailPosition[1] + (item.detailBox?.height ?? 40) / 2, dominantBaseline: "central", textAnchor: "middle", fontSize: item.detailFontSize ?? 30, fontWeight: item.detailFontWeight, fill: resolveColor(item.detailColor, ratio, colorAt(ratio)), children: valueFormatter ? valueFormatter(item.value) : `${formatChartNumber(item.value)}${item.unit ?? ""}` })
6300
6324
  ] }) : null
6301
6325
  ] }) }, `${item.name}-${index}`);
6302
6326
  }
6303
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { label: `${item.name}\uFF0C${formatChartNumber(item.value)}`, tooltip: tooltipFormatter?.(item) ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: item.name, value: item.value, formatter: valueFormatter }), tooltipPoint: [centerX, centerY], onPointerUp: (event) => onDataClick?.({ name: item.name, value: item.value, data: item, nativeEvent: event }), children: [
6327
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { label: `${item.name}\uFF0C${formatChartNumber(item.value)}`, tooltip: tooltipFormatter?.(item) ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: item.name, value: item.value, formatter: valueFormatter }), tooltipPoint: [centerX, centerY], onPointerUp: (event) => onDataClick?.({ name: item.name, value: item.value, data: item, nativeEvent: event }), children: [
6304
6328
  normalizedSegments.map((segment, segmentIndex) => {
6305
6329
  const path = svgArcPath(centerX, centerY, radius, start + sweep * previous, start + sweep * Math.max(previous, Math.min(1, segment.until)), radius - 15);
6306
6330
  previous = Math.max(previous, Math.min(1, segment.until));
6307
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: path, fill: segment.color }, segmentIndex);
6331
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: path, fill: segment.color }, segmentIndex);
6308
6332
  }),
6309
- showProgress ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: svgArcPath(centerX, centerY, radius, start, valueAngle, radius - 15), fill: color, className: "sia-chart__gauge-progress" }) : null,
6333
+ showProgress ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: svgArcPath(centerX, centerY, radius, start, valueAngle, radius - 15), fill: color, className: "sia-chart__gauge-progress" }) : null,
6310
6334
  Array.from({ length: splitNumber + 1 }, (_, tick) => {
6311
6335
  const tickAngle = start + sweep * tick / Math.max(1, splitNumber);
6312
6336
  const inner = [centerX + Math.cos(tickAngle) * (radius - 25), centerY + Math.sin(tickAngle) * (radius - 25)];
6313
6337
  const outer = [centerX + Math.cos(tickAngle) * (radius - 17), centerY + Math.sin(tickAngle) * (radius - 17)];
6314
6338
  const label = [centerX + Math.cos(tickAngle) * (radius - 39), centerY + Math.sin(tickAngle) * (radius - 39)];
6315
6339
  const tickValue = itemMin + (itemMax - itemMin) * tick / Math.max(1, splitNumber);
6316
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
6317
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: inner[0], y1: inner[1], x2: outer[0], y2: outer[1], className: "sia-chart__gauge-tick" }),
6318
- showAxisLabels ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: label[0], y: label[1] + 3, textAnchor: "middle", className: "sia-chart__gauge-axis-label", children: formatChartNumber(tickValue) }) : null
6340
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
6341
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: inner[0], y1: inner[1], x2: outer[0], y2: outer[1], className: "sia-chart__gauge-tick" }),
6342
+ showAxisLabels ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: label[0], y: label[1] + 3, textAnchor: "middle", className: "sia-chart__gauge-axis-label", children: formatChartNumber(tickValue) }) : null
6319
6343
  ] }, tick);
6320
6344
  }),
6321
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("line", { x1: centerX, y1: centerY, x2: pointer[0], y2: pointer[1], stroke: color, strokeWidth: item.pointerWidth ?? 5, strokeLinecap: "round", className: "sia-chart__gauge-pointer", children: [
6322
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("animate", { attributeName: "x2", from: pointerStart[0], to: pointer[0], dur: "700ms", fill: "freeze" }),
6323
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("animate", { attributeName: "y2", from: pointerStart[1], to: pointer[1], dur: "700ms", fill: "freeze" })
6345
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("line", { x1: centerX, y1: centerY, x2: pointer[0], y2: pointer[1], stroke: color, strokeWidth: item.pointerWidth ?? 5, strokeLinecap: "round", className: "sia-chart__gauge-pointer", children: [
6346
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("animate", { attributeName: "x2", from: pointerStart[0], to: pointer[0], dur: "700ms", fill: "freeze" }),
6347
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("animate", { attributeName: "y2", from: pointerStart[1], to: pointer[1], dur: "700ms", fill: "freeze" })
6324
6348
  ] }),
6325
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: centerX, cy: centerY, r: 8, fill: color }),
6326
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: centerX, y: centerY + 54, textAnchor: "middle", className: "sia-chart__gauge-name", children: item.name }),
6327
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: centerX, y: centerY + detailOffset, textAnchor: "middle", className: "sia-chart__gauge-value", children: valueFormatter ? valueFormatter(item.value) : `${formatChartNumber(item.value)}${item.unit ?? ""}` })
6349
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: centerX, cy: centerY, r: 8, fill: color }),
6350
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: centerX, y: centerY + 54, textAnchor: "middle", className: "sia-chart__gauge-name", children: item.name }),
6351
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: centerX, y: centerY + detailOffset, textAnchor: "middle", className: "sia-chart__gauge-value", children: valueFormatter ? valueFormatter(item.value) : `${formatChartNumber(item.value)}${item.unit ?? ""}` })
6328
6352
  ] }, `${item.name}-${index}`);
6329
6353
  }) });
6330
6354
  });
6331
- var FunnelChart = (0, import_react34.forwardRef)(function FunnelChart2({ data = EMPTY_PIE_DATA, series, sort = "descending", gap = 4, align = "center", orientation = "vertical", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
6355
+ var FunnelChart = (0, import_react35.forwardRef)(function FunnelChart2({ data = EMPTY_PIE_DATA, series, sort = "descending", gap = 4, align = "center", orientation = "vertical", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
6332
6356
  const legacy = appearance === "macarons";
6333
- const [activeFunnel, setActiveFunnel] = (0, import_react34.useState)(null);
6334
- const initialFunnels = (0, import_react34.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
6335
- const [sourceFunnels, setSourceFunnels] = (0, import_react34.useState)(initialFunnels);
6336
- (0, import_react34.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
6357
+ const [activeFunnel, setActiveFunnel] = (0, import_react35.useState)(null);
6358
+ const initialFunnels = (0, import_react35.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
6359
+ const [sourceFunnels, setSourceFunnels] = (0, import_react35.useState)(initialFunnels);
6360
+ (0, import_react35.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
6337
6361
  const allData = sourceFunnels.flatMap((funnel) => funnel.data);
6338
6362
  const legendData = [...new Map(allData.map((item) => [item.name, item])).values()];
6339
6363
  const legend = useLegendSelection(legendData.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -6341,7 +6365,7 @@ var FunnelChart = (0, import_react34.forwardRef)(function FunnelChart2({ data =
6341
6365
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u6F0F\u6597");
6342
6366
  const chartToolbox = typeof resolvedToolbox === "object" ? {
6343
6367
  ...resolvedToolbox,
6344
- dataView: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { series: sourceFunnels.map((item, index) => ({ name: item.name ?? String(index + 1), data: item.data.map((d) => d.value) })), onApply: (values) => {
6368
+ dataView: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { series: sourceFunnels.map((item, index) => ({ name: item.name ?? String(index + 1), data: item.data.map((d) => d.value) })), onApply: (values) => {
6345
6369
  const next = sourceFunnels.map((item, index) => ({ ...item, data: item.data.map((d, i) => ({ ...d, value: values[index][i] })) }));
6346
6370
  setSourceFunnels(next);
6347
6371
  onDataChange?.(next);
@@ -6353,7 +6377,7 @@ var FunnelChart = (0, import_react34.forwardRef)(function FunnelChart2({ data =
6353
6377
  }
6354
6378
  } : resolvedToolbox;
6355
6379
  const funnels = sourceFunnels.map((funnel) => ({ ...funnel, data: funnel.data.filter((item) => legend.isSelected(item.name)) }));
6356
- if (/pie|饼/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6380
+ if (/pie|饼/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6357
6381
  PieChart,
6358
6382
  {
6359
6383
  ...props,
@@ -6370,8 +6394,8 @@ var FunnelChart = (0, import_react34.forwardRef)(function FunnelChart2({ data =
6370
6394
  toolbox: chartToolbox
6371
6395
  }
6372
6396
  );
6373
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, toolbox: chartToolbox, empty: !sourceFunnels.some((item) => item.data.length), ariaLabel: props.ariaLabel ?? "\u6F0F\u6597\u56FE", children: [
6374
- showLegend ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { x: legendLayout?.x ?? 360, y: legendLayout?.y ?? 20, orientation: legendLayout?.orientation, align: legendLayout?.orientation === "vertical" ? "start" : void 0, itemGap: legacy ? 10 : 18, items: legendData.map((item, index) => ({ name: item.name, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
6397
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, toolbox: chartToolbox, empty: !sourceFunnels.some((item) => item.data.length), ariaLabel: props.ariaLabel ?? "\u6F0F\u6597\u56FE", children: [
6398
+ showLegend ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { x: legendLayout?.x ?? 360, y: legendLayout?.y ?? 20, orientation: legendLayout?.orientation, align: legendLayout?.orientation === "vertical" ? "start" : void 0, itemGap: legacy ? 10 : 18, items: legendData.map((item, index) => ({ name: item.name, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
6375
6399
  funnels.flatMap((funnel, funnelIndex) => {
6376
6400
  if (legacy) {
6377
6401
  const shapes = layoutFunnelValues(funnel.data.map((d) => d.value), { left: funnel.left ?? 80, top: funnel.top ?? 60, width: funnel.width ?? 503, height: funnel.height ?? 259, gap: funnel.gap ?? 0, min: funnel.min, max: funnel.max, minSize: funnel.minSize, maxSize: funnel.maxSize, sort: funnel.sort, align: funnel.align });
@@ -6382,10 +6406,10 @@ var FunnelChart = (0, import_react34.forwardRef)(function FunnelChart2({ data =
6382
6406
  const emphasized = activeFunnel === markKey;
6383
6407
  const position = (emphasized ? funnel.emphasisLabelPosition : void 0) ?? funnel.labelPosition ?? "right";
6384
6408
  const labelX = position === "inside" ? shape.center[0] : position === "left" ? (shape.points[0][0] + shape.points[3][0]) / 2 - 20 : (shape.points[1][0] + shape.points[2][0]) / 2 + 20;
6385
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { onPointerMove: () => setActiveFunnel(markKey), onPointerLeave: () => setActiveFunnel(null), onFocus: () => setActiveFunnel(markKey), onBlur: () => setActiveFunnel(null), label: `${funnel.name ?? ""}\uFF0C${item.name}\uFF0C${item.value}`, tooltip: funnel.tooltipFormatter?.(item) ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: item.name, series: funnel.name, value: item.value }), tooltipPoint: shape.center, onPointerUp: (event) => onDataClick?.({ name: item.name, value: item.value, seriesName: funnel.name, data: item, nativeEvent: event }), children: [
6386
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPointMotion, { points: shape.points, enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (points) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { points: points.map((p) => p.join(",")).join(" "), fill: color, stroke: funnel.borderColor ?? "#fff", strokeWidth: funnel.borderWidth ?? 1 }) }),
6387
- position !== "inside" && funnel.showLabelLines !== false ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: position === "left" ? (shape.points[0][0] + shape.points[3][0]) / 2 : (shape.points[1][0] + shape.points[2][0]) / 2, y1: shape.center[1], x2: labelX, y2: shape.center[1], stroke: color }) : null,
6388
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: labelX, y: shape.center[1] + 4, textAnchor: position === "inside" ? "middle" : position === "left" ? "end" : "start", fontSize: 12, fill: position === "inside" ? "#fff" : color, children: (emphasized ? funnel.emphasisLabelFormatter?.(item) : void 0) ?? funnel.labelFormatter?.(item) ?? item.name })
6409
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { onPointerMove: () => setActiveFunnel(markKey), onPointerLeave: () => setActiveFunnel(null), onFocus: () => setActiveFunnel(markKey), onBlur: () => setActiveFunnel(null), label: `${funnel.name ?? ""}\uFF0C${item.name}\uFF0C${item.value}`, tooltip: funnel.tooltipFormatter?.(item) ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: item.name, series: funnel.name, value: item.value }), tooltipPoint: shape.center, onPointerUp: (event) => onDataClick?.({ name: item.name, value: item.value, seriesName: funnel.name, data: item, nativeEvent: event }), children: [
6410
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPointMotion, { points: shape.points, enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (points) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { points: points.map((p) => p.join(",")).join(" "), fill: color, stroke: funnel.borderColor ?? "#fff", strokeWidth: funnel.borderWidth ?? 1 }) }),
6411
+ position !== "inside" && funnel.showLabelLines !== false ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: position === "left" ? (shape.points[0][0] + shape.points[3][0]) / 2 : (shape.points[1][0] + shape.points[2][0]) / 2, y1: shape.center[1], x2: labelX, y2: shape.center[1], stroke: color }) : null,
6412
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: labelX, y: shape.center[1] + 4, textAnchor: position === "inside" ? "middle" : position === "left" ? "end" : "start", fontSize: 12, fill: position === "inside" ? "#fff" : color, children: (emphasized ? funnel.emphasisLabelFormatter?.(item) : void 0) ?? funnel.labelFormatter?.(item) ?? item.name })
6389
6413
  ] }, markKey);
6390
6414
  });
6391
6415
  }
@@ -6412,9 +6436,9 @@ var FunnelChart = (0, import_react34.forwardRef)(function FunnelChart2({ data =
6412
6436
  const color = getColor(index + funnelIndex, item.color, palette);
6413
6437
  const labelX = funnelOrientation === "vertical" ? funnelLeft + currentOffset + currentSize / 2 : funnelLeft + cursor + sectionSize / 2;
6414
6438
  const labelY = funnelOrientation === "vertical" ? funnelTop + cursor + sectionSize / 2 : funnelTop + currentOffset + currentSize / 2;
6415
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { label: `${item.name}\uFF0C${formatChartNumber(item.value)}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: item.name, series: funnel.name, value: item.value }), tooltipPoint: [labelX, labelY], onPointerUp: (event) => onDataClick?.({ name: item.name, value: item.value, seriesName: funnel.name, data: item, nativeEvent: event }), children: [
6416
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polygon", { points, fill: color, className: "sia-chart__funnel" }),
6417
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("text", { x: labelX, y: labelY + 5, textAnchor: "middle", className: "sia-chart__funnel-label", children: [
6439
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { label: `${item.name}\uFF0C${formatChartNumber(item.value)}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: item.name, series: funnel.name, value: item.value }), tooltipPoint: [labelX, labelY], onPointerUp: (event) => onDataClick?.({ name: item.name, value: item.value, seriesName: funnel.name, data: item, nativeEvent: event }), children: [
6440
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polygon", { points, fill: color, className: "sia-chart__funnel" }),
6441
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("text", { x: labelX, y: labelY + 5, textAnchor: "middle", className: "sia-chart__funnel-label", children: [
6418
6442
  item.name,
6419
6443
  "\u3000",
6420
6444
  formatChartNumber(item.value)
@@ -6424,7 +6448,7 @@ var FunnelChart = (0, import_react34.forwardRef)(function FunnelChart2({ data =
6424
6448
  })
6425
6449
  ] });
6426
6450
  });
6427
- var HeatmapChart = (0, import_react34.forwardRef)(function HeatmapChart2({ raster, xLabels = [], yLabels = [], data = [], points = [], colors = ["#e6f4ff", "#1677ff"], showValues = false, pointRadius = 30, blur = 16, minAlpha = 0.12, maxAlpha = 0.82, valueFormatter, onDataClick, ...props }, ref) {
6451
+ var HeatmapChart = (0, import_react35.forwardRef)(function HeatmapChart2({ raster, xLabels = [], yLabels = [], data = [], points = [], colors = ["#e6f4ff", "#1677ff"], showValues = false, pointRadius = 30, blur = 16, minAlpha = 0.12, maxAlpha = 0.82, valueFormatter, onDataClick, ...props }, ref) {
6428
6452
  const pointMode = points.length > 0;
6429
6453
  const values = pointMode ? points.map((point) => point.value) : data.flatMap((row) => [...row]);
6430
6454
  const minimum = values.length ? Math.min(...values) : 0;
@@ -6433,43 +6457,43 @@ var HeatmapChart = (0, import_react34.forwardRef)(function HeatmapChart2({ raste
6433
6457
  const cellHeight = PLOT.height / Math.max(1, yLabels.length);
6434
6458
  const pointXDomain = niceChartDomain(points.map((point) => point.x), false);
6435
6459
  const pointYDomain = niceChartDomain(points.map((point) => point.y), false);
6436
- const filterId = `sia-heat-${(0, import_react34.useId)().replaceAll(":", "")}`;
6437
- if (raster) return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, ref, empty: !points.length, ariaLabel: props.ariaLabel ?? "\u50CF\u7D20\u70ED\u529B\u56FE", children: [
6438
- raster.backgroundImage ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("image", { href: raster.backgroundImage, x: 0, y: 0, width: raster.width, height: raster.height, preserveAspectRatio: "none", pointerEvents: "none" }) : null,
6439
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(HeatmapRaster, { width: raster.width, height: raster.height, points, options: raster })
6460
+ const filterId = `sia-heat-${(0, import_react35.useId)().replaceAll(":", "")}`;
6461
+ if (raster) return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, ref, empty: !points.length, ariaLabel: props.ariaLabel ?? "\u50CF\u7D20\u70ED\u529B\u56FE", children: [
6462
+ raster.backgroundImage ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("image", { href: raster.backgroundImage, x: 0, y: 0, width: raster.width, height: raster.height, preserveAspectRatio: "none", pointerEvents: "none" }) : null,
6463
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(HeatmapRaster, { width: raster.width, height: raster.height, points, options: raster })
6440
6464
  ] });
6441
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, ref, empty: pointMode ? !points.length : !xLabels.length || !yLabels.length, ariaLabel: props.ariaLabel ?? "\u70ED\u529B\u56FE", children: [
6442
- pointMode ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("filter", { id: filterId, x: "-100%", y: "-100%", width: "300%", height: "300%", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("feGaussianBlur", { stdDeviation: blur }) }) }) : null,
6443
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartVisualMap, { min: minimum, max: maximum, colors, x: PLOT.x + PLOT.width - 120, y: 325, width: 120 }),
6444
- pointMode ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6445
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: PLOT.x, y: PLOT.y, width: PLOT.width, height: PLOT.height, rx: 4, fill: "var(--sia-chart-track)" }),
6446
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("g", { filter: `url(#${filterId})`, className: "sia-chart__heat-density", children: points.map((point, index) => {
6465
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, ref, empty: pointMode ? !points.length : !xLabels.length || !yLabels.length, ariaLabel: props.ariaLabel ?? "\u70ED\u529B\u56FE", children: [
6466
+ pointMode ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("filter", { id: filterId, x: "-100%", y: "-100%", width: "300%", height: "300%", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("feGaussianBlur", { stdDeviation: blur }) }) }) : null,
6467
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartVisualMap, { min: minimum, max: maximum, colors, x: PLOT.x + PLOT.width - 120, y: 325, width: 120 }),
6468
+ pointMode ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6469
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: PLOT.x, y: PLOT.y, width: PLOT.width, height: PLOT.height, rx: 4, fill: "var(--sia-chart-track)" }),
6470
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("g", { filter: `url(#${filterId})`, className: "sia-chart__heat-density", children: points.map((point, index) => {
6447
6471
  const ratio = (point.value - minimum) / Math.max(1, maximum - minimum);
6448
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: linearScale(point.x, [pointXDomain[0], pointXDomain[1]], [PLOT.x, PLOT.x + PLOT.width]), cy: linearScale(point.y, [pointYDomain[0], pointYDomain[1]], [PLOT_BOTTOM, PLOT.y]), r: pointRadius, fill: colorBetween(colors[0], colors[1], ratio), opacity: minAlpha + (maxAlpha - minAlpha) * ratio }, index);
6472
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: linearScale(point.x, [pointXDomain[0], pointXDomain[1]], [PLOT.x, PLOT.x + PLOT.width]), cy: linearScale(point.y, [pointYDomain[0], pointYDomain[1]], [PLOT_BOTTOM, PLOT.y]), r: pointRadius, fill: colorBetween(colors[0], colors[1], ratio), opacity: minAlpha + (maxAlpha - minAlpha) * ratio }, index);
6449
6473
  }) }),
6450
6474
  points.map((point, index) => {
6451
6475
  const x = linearScale(point.x, [pointXDomain[0], pointXDomain[1]], [PLOT.x, PLOT.x + PLOT.width]);
6452
6476
  const y = linearScale(point.y, [pointYDomain[0], pointYDomain[1]], [PLOT_BOTTOM, PLOT.y]);
6453
6477
  const name = point.name ?? `\u70ED\u70B9 ${index + 1}`;
6454
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { label: `${name}\uFF0C${point.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name, value: point.value, formatter: valueFormatter }), tooltipPoint: [x, y], onPointerUp: (event) => onDataClick?.({ name, value: point.value, data: point, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: x, cy: y, r: Math.max(8, pointRadius * 0.55), fill: "transparent" }) }, `hit-${index}`);
6478
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { label: `${name}\uFF0C${point.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name, value: point.value, formatter: valueFormatter }), tooltipPoint: [x, y], onPointerUp: (event) => onDataClick?.({ name, value: point.value, data: point, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: x, cy: y, r: Math.max(8, pointRadius * 0.55), fill: "transparent" }) }, `hit-${index}`);
6455
6479
  })
6456
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6457
- xLabels.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: PLOT.x + (index + 0.5) * cellWidth, y: PLOT_BOTTOM + 20, textAnchor: "middle", className: "sia-chart__axis-label", children: label }, `${label}-${index}`)),
6458
- yLabels.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: PLOT.x - 10, y: PLOT.y + (index + 0.5) * cellHeight + 4, textAnchor: "end", className: "sia-chart__axis-label", children: label }, `${label}-${index}`)),
6480
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6481
+ xLabels.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: PLOT.x + (index + 0.5) * cellWidth, y: PLOT_BOTTOM + 20, textAnchor: "middle", className: "sia-chart__axis-label", children: label }, `${label}-${index}`)),
6482
+ yLabels.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: PLOT.x - 10, y: PLOT.y + (index + 0.5) * cellHeight + 4, textAnchor: "end", className: "sia-chart__axis-label", children: label }, `${label}-${index}`)),
6459
6483
  yLabels.flatMap((yLabel, yIndex) => xLabels.map((xLabel, xIndex) => {
6460
6484
  const value = data[yIndex]?.[xIndex] ?? 0;
6461
6485
  const ratio = (value - minimum) / Math.max(1, maximum - minimum);
6462
6486
  const x = PLOT.x + xIndex * cellWidth;
6463
6487
  const y = PLOT.y + yIndex * cellHeight;
6464
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { label: `${yLabel}\uFF0C${xLabel}\uFF0C${formatChartNumber(value)}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: `${yLabel} / ${xLabel}`, value, formatter: valueFormatter }), tooltipPoint: [x + cellWidth / 2, y + cellHeight / 2], onPointerUp: (event) => onDataClick?.({ name: `${yLabel} / ${xLabel}`, value, data: value, nativeEvent: event }), children: [
6465
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: x + 1, y: y + 1, width: Math.max(0, cellWidth - 2), height: Math.max(0, cellHeight - 2), rx: 3, fill: colorBetween(colors[0], colors[1], ratio), className: "sia-chart__heat-cell" }),
6466
- showValues ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: x + cellWidth / 2, y: y + cellHeight / 2 + 4, textAnchor: "middle", className: "sia-chart__heat-label", children: formatChartNumber(value) }) : null
6488
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { label: `${yLabel}\uFF0C${xLabel}\uFF0C${formatChartNumber(value)}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: `${yLabel} / ${xLabel}`, value, formatter: valueFormatter }), tooltipPoint: [x + cellWidth / 2, y + cellHeight / 2], onPointerUp: (event) => onDataClick?.({ name: `${yLabel} / ${xLabel}`, value, data: value, nativeEvent: event }), children: [
6489
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: x + 1, y: y + 1, width: Math.max(0, cellWidth - 2), height: Math.max(0, cellHeight - 2), rx: 3, fill: colorBetween(colors[0], colors[1], ratio), className: "sia-chart__heat-cell" }),
6490
+ showValues ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: x + cellWidth / 2, y: y + cellHeight / 2 + 4, textAnchor: "middle", className: "sia-chart__heat-label", children: formatChartNumber(value) }) : null
6467
6491
  ] }, `${xLabel}-${yLabel}`);
6468
6492
  }))
6469
6493
  ] })
6470
6494
  ] });
6471
6495
  });
6472
- var ThemeRiverChart = (0, import_react34.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
6496
+ var ThemeRiverChart = (0, import_react35.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
6473
6497
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
6474
6498
  const activeSeries = series.filter((item) => legend.isSelected(item.name));
6475
6499
  const totals = categories.map((_, index) => activeSeries.reduce((sum, item) => sum + Math.max(0, item.data[index] ?? 0), 0));
@@ -6477,10 +6501,10 @@ var ThemeRiverChart = (0, import_react34.forwardRef)(function ThemeRiverChart2({
6477
6501
  const xAt = (index) => PLOT.x + index / Math.max(1, categories.length - 1) * PLOT.width;
6478
6502
  const scale = PLOT.height * 0.78 / maximum;
6479
6503
  const bottoms = totals.map((total) => 184 + total * scale / 2);
6480
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, ref, palette, empty: !categories.length || !series.length, ariaLabel: props.ariaLabel ?? "\u4E3B\u9898\u6CB3\u6D41\u56FE", children: [
6481
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { items: series.map((item, index) => ({ name: item.name, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0, y: 330 }),
6482
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT.x, y1: PLOT_BOTTOM, x2: PLOT.x + PLOT.width, y2: PLOT_BOTTOM, className: "sia-chart__axis-line" }),
6483
- categories.map((name, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: xAt(index), y: PLOT_BOTTOM + 19, textAnchor: "middle", className: "sia-chart__axis-label", children: name }, `${name}-${index}`)),
6504
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, ref, palette, empty: !categories.length || !series.length, ariaLabel: props.ariaLabel ?? "\u4E3B\u9898\u6CB3\u6D41\u56FE", children: [
6505
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { items: series.map((item, index) => ({ name: item.name, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0, y: 330 }),
6506
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT.x, y1: PLOT_BOTTOM, x2: PLOT.x + PLOT.width, y2: PLOT_BOTTOM, className: "sia-chart__axis-line" }),
6507
+ categories.map((name, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: xAt(index), y: PLOT_BOTTOM + 19, textAnchor: "middle", className: "sia-chart__axis-label", children: name }, `${name}-${index}`)),
6484
6508
  activeSeries.map((item) => {
6485
6509
  const seriesIndex = series.indexOf(item);
6486
6510
  const lower = categories.map((_, index) => [xAt(index), bottoms[index]]);
@@ -6491,12 +6515,12 @@ var ThemeRiverChart = (0, import_react34.forwardRef)(function ThemeRiverChart2({
6491
6515
  });
6492
6516
  const path = `${smoothSvgPath(upper)} ${smoothSvgPath([...lower].reverse()).replace(/^M/, "L")} Z`;
6493
6517
  const color = getColor(seriesIndex, item.color, palette);
6494
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
6495
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: path, fill: color, className: "sia-chart__river" }),
6518
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
6519
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: path, fill: color, className: "sia-chart__river" }),
6496
6520
  upper.map((point, index) => {
6497
6521
  const value = item.data[index] ?? 0;
6498
6522
  const name = categories[index] ?? `${index + 1}`;
6499
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name, series: item.name, value }), tooltipPoint: [point[0], (point[1] + lower[index][1]) / 2], onPointerUp: (event) => onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: point[0], cy: (point[1] + lower[index][1]) / 2, r: 8, fill: "transparent" }) }, `${name}-${index}`);
6523
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name, series: item.name, value }), tooltipPoint: [point[0], (point[1] + lower[index][1]) / 2], onPointerUp: (event) => onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: point[0], cy: (point[1] + lower[index][1]) / 2, r: 8, fill: "transparent" }) }, `${name}-${index}`);
6500
6524
  })
6501
6525
  ] }, `${item.name}-${seriesIndex}`);
6502
6526
  })
@@ -6507,8 +6531,8 @@ function eventTime(value) {
6507
6531
  if (typeof value === "number") return value;
6508
6532
  return Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value) ? value.replace(/-/g, "/") : value);
6509
6533
  }
6510
- var EventRiverChart = (0, import_react34.forwardRef)(function EventRiverChart2({ series, showLabels = true, draggable = true, appearance = "sia", plot = PLOT, animationProgress, boundaryGap = [0.05, 0.1], legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
6511
- const [restoreVersion, setRestoreVersion] = (0, import_react34.useState)(0);
6534
+ var EventRiverChart = (0, import_react35.forwardRef)(function EventRiverChart2({ series, showLabels = true, draggable = true, appearance = "sia", plot = PLOT, animationProgress, boundaryGap = [0.05, 0.1], legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
6535
+ const [restoreVersion, setRestoreVersion] = (0, import_react35.useState)(0);
6512
6536
  const area = plot;
6513
6537
  palette = palette ?? (appearance === "macarons" ? ["#2ec7c9", "#b6a2de"] : void 0);
6514
6538
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -6521,13 +6545,13 @@ var EventRiverChart = (0, import_react34.forwardRef)(function EventRiverChart2({
6521
6545
  const selectedSeries = series.map((item, seriesIndex) => ({ item, seriesIndex })).filter(({ item }) => legend.isSelected(item.name));
6522
6546
  const packed = layoutEventRiver(selectedSeries.map(({ item }) => ({ weight: item.weight, data: item.data.map((event) => ({ weight: event.weight, evolution: [...event.evolution].filter((point) => Number.isFinite(eventTime(point.time))).sort((a, b) => eventTime(a.time) - eventTime(b.time)).map((point) => ({ x: linearScale(eventTime(point.time), timeDomain, [area.x, area.x + area.width]), value: point.value })) })) })), Math.max(1, Math.round(area.width / 40)), area);
6523
6547
  const timeTicks = calendarReferenceTicks(timeDomain);
6524
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, className: `${props.className ?? ""}${appearance === "macarons" ? " sia-chart--macarons sia-chart--event-river-reference" : ""}`, toolbox: props.toolbox ? { ...props.toolbox === true ? {} : props.toolbox, onRestore: () => {
6548
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, className: `${props.className ?? ""}${appearance === "macarons" ? " sia-chart--macarons sia-chart--event-river-reference" : ""}`, toolbox: props.toolbox ? { ...props.toolbox === true ? {} : props.toolbox, onRestore: () => {
6525
6549
  setRestoreVersion((value) => value + 1);
6526
6550
  legend.replace(Object.fromEntries(series.map((item) => [item.name, legendSelected?.[item.name] !== false])));
6527
6551
  if (typeof props.toolbox === "object") props.toolbox.onRestore?.();
6528
6552
  } } : false, ref, palette, empty: !events.length || !times.length, ariaLabel: props.ariaLabel ?? "\u4E8B\u4EF6\u6CB3\u6D41\u56FE", children: [
6529
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { items: series.map((item, index) => ({ name: item.name, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }),
6530
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { orientation: "bottom", x: area.x, y: area.y + area.height, length: area.width, positions: timeTicks.map((tick) => (tick.value - timeDomain[0]) / (timeDomain[1] - timeDomain[0] || 1)), labels: timeTicks.map((tick) => tick.label), gridLength: area.height }),
6553
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { items: series.map((item, index) => ({ name: item.name, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }),
6554
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { orientation: "bottom", x: area.x, y: area.y + area.height, length: area.width, positions: timeTicks.map((tick) => (tick.value - timeDomain[0]) / (timeDomain[1] - timeDomain[0] || 1)), labels: timeTicks.map((tick) => tick.label), gridLength: area.height }),
6531
6555
  packed.map((geometry) => {
6532
6556
  const { item: eventSeries, seriesIndex } = selectedSeries[geometry.seriesIndex];
6533
6557
  const eventIndex = geometry.eventIndex, event = eventSeries.data[eventIndex];
@@ -6540,22 +6564,22 @@ var EventRiverChart = (0, import_react34.forwardRef)(function EventRiverChart2({
6540
6564
  const evolution = [...event.evolution].sort((left, right) => eventTime(left.time) - eventTime(right.time));
6541
6565
  const upper = geometry.points.map((point) => [point.x, centerY - point.thickness / 2]);
6542
6566
  const path = eventRiverOutline(geometry.points, centerY, geometry.tailX);
6543
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EventRiverBubble, { "data-event-id": event.id, "data-event-series": eventSeries.name, draggable, resetKey: `${restoreVersion}:${path}`, label: `${eventSeries.name}\uFF0C${event.name}\uFF0C${event.weight ?? ""}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6544
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: event.name }),
6545
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: eventSeries.name }),
6546
- evolution.map((point, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
6567
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EventRiverBubble, { "data-event-id": event.id, "data-event-series": eventSeries.name, draggable, resetKey: `${restoreVersion}:${path}`, label: `${eventSeries.name}\uFF0C${event.name}\uFF0C${event.weight ?? ""}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6568
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: event.name }),
6569
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: eventSeries.name }),
6570
+ evolution.map((point, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
6547
6571
  new Date(eventTime(point.time)).toLocaleDateString(),
6548
6572
  "\uFF1A",
6549
6573
  point.value,
6550
6574
  point.detail
6551
6575
  ] }, index))
6552
- ] }), tooltipPoint: [upper[0]?.[0] ?? PLOT.x, centerY], onPointerUp: (nativeEvent) => onDataClick?.({ name: event.name, value: event.weight ?? Math.max(...evolution.map((point) => point.value)), seriesName: eventSeries.name, data: event, nativeEvent }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EventRiverMotion, { geometry, enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (frame) => {
6576
+ ] }), tooltipPoint: [upper[0]?.[0] ?? PLOT.x, centerY], onPointerUp: (nativeEvent) => onDataClick?.({ name: event.name, value: event.weight ?? Math.max(...evolution.map((point) => point.value)), seriesName: eventSeries.name, data: event, nativeEvent }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EventRiverMotion, { geometry, enabled: props.animation !== false, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (frame) => {
6553
6577
  const start = frame.points[0]?.x ?? area.x, half = Math.max(0, ...frame.points.map((point) => point.thickness)) / 2;
6554
6578
  const x = appearance === "macarons" ? Math.round(start) + (frame.tailX - start) / 2 : (start + frame.tailX) / 2;
6555
6579
  const y = appearance === "macarons" ? Math.round(frame.y - half) + half : frame.y;
6556
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { "data-event-scale": frame.scale, transform: `translate(${x} ${y}) scale(${frame.scale}) translate(${-x} ${-y})`, children: [
6557
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { style: { "--sia-event-emphasis": emphasisColor }, d: eventRiverOutline(frame.points, frame.y, frame.tailX, appearance === "macarons"), fill: color, "data-event-center": frame.y, "data-event-importance": geometry.importance, "data-event-tail": frame.tailX, className: "sia-chart__event-river" }),
6558
- showLabels && evolution.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: appearance === "macarons" ? x : (frame.points[0]?.x ?? area.x) + 6, textAnchor: appearance === "macarons" ? "middle" : void 0, y: frame.y + 4, className: "sia-chart__event-label", children: event.name }) : null
6580
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { "data-event-scale": frame.scale, transform: `translate(${x} ${y}) scale(${frame.scale}) translate(${-x} ${-y})`, children: [
6581
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { style: { "--sia-event-emphasis": emphasisColor }, d: eventRiverOutline(frame.points, frame.y, frame.tailX, appearance === "macarons"), fill: color, "data-event-center": frame.y, "data-event-importance": geometry.importance, "data-event-tail": frame.tailX, className: "sia-chart__event-river" }),
6582
+ showLabels && evolution.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: appearance === "macarons" ? x : (frame.points[0]?.x ?? area.x) + 6, textAnchor: appearance === "macarons" ? "middle" : void 0, y: frame.y + 4, className: "sia-chart__event-label", children: event.name }) : null
6559
6583
  ] });
6560
6584
  } }, restoreVersion) }, event.id ? `${eventSeries.name}-${event.id}` : `${eventSeries.name}-${event.name}-${eventIndex}`);
6561
6585
  })
@@ -6581,9 +6605,9 @@ function vennDistance(radiusA, radiusB, overlap) {
6581
6605
  }
6582
6606
  return (low + high) / 2;
6583
6607
  }
6584
- var VennChart = (0, import_react34.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
6585
- const [sets, setSets] = (0, import_react34.useState)(initialSets), [intersection, setIntersection] = (0, import_react34.useState)(initialIntersection), [active, setActive] = (0, import_react34.useState)();
6586
- (0, import_react34.useEffect)(() => {
6608
+ var VennChart = (0, import_react35.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
6609
+ const [sets, setSets] = (0, import_react35.useState)(initialSets), [intersection, setIntersection] = (0, import_react35.useState)(initialIntersection), [active, setActive] = (0, import_react35.useState)();
6610
+ (0, import_react35.useEffect)(() => {
6587
6611
  setSets(initialSets);
6588
6612
  setIntersection(initialIntersection);
6589
6613
  }, [initialSets, initialIntersection]);
@@ -6602,7 +6626,7 @@ var VennChart = (0, import_react34.forwardRef)(function VennChart2({ sets: initi
6602
6626
  const centerB = [centerA[0] + distance3, centerA[1]];
6603
6627
  const colorA = getColor(0, sets[0].color, palette);
6604
6628
  const colorB = getColor(1, sets[1].color, palette);
6605
- const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { series: [{ name: sets[0].name, data: [first] }, { name: sets[1].name, data: [second] }, { name: intersection.name ?? "\u516C\u5171", data: [overlap] }], onApply: (values) => {
6629
+ const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { series: [{ name: sets[0].name, data: [first] }, { name: sets[1].name, data: [second] }, { name: intersection.name ?? "\u516C\u5171", data: [overlap] }], onApply: (values) => {
6606
6630
  setSets([{ ...sets[0], value: values[0][0] }, { ...sets[1], value: values[1][0] }]);
6607
6631
  setIntersection({ ...intersection, value: values[2][0] });
6608
6632
  } }), onRestore: () => {
@@ -6613,21 +6637,21 @@ var VennChart = (0, import_react34.forwardRef)(function VennChart2({ sets: initi
6613
6637
  } } : toolbox;
6614
6638
  const markStyle = (index, color) => ({ fill: active === index ? emphasisColor ?? color : color, stroke: active === index ? emphasisBorderColor : void 0, strokeWidth: active === index ? emphasisBorderWidth : void 0, opacity: legacy ? 1 : void 0 });
6615
6639
  const lens = vennLensPath(centerA[0], centerA[1], radiusA, radiusB, distance3);
6616
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, toolbox: chartToolbox, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, empty: first <= 0 && second <= 0, ariaLabel: props.ariaLabel ?? "\u97E6\u6069\u56FE", children: [
6617
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { onPointerMove: () => setActive(0), onPointerLeave: () => setActive(void 0), onFocus: () => setActive(0), onBlur: () => setActive(void 0), label: `${sets[0].name}\uFF0C${first}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: sets[0].name, value: first }), tooltipPoint: centerA, onPointerUp: (event) => onDataClick?.({ name: sets[0].name, value: first, data: sets[0], nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: centerA[0], cy: centerA[1], r: radiusA, fill: colorA, style: markStyle(0, colorA), className: "sia-chart__venn-circle" }) }),
6618
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { onPointerMove: () => setActive(1), onPointerLeave: () => setActive(void 0), onFocus: () => setActive(1), onBlur: () => setActive(void 0), label: `${sets[1].name}\uFF0C${second}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: sets[1].name, value: second }), tooltipPoint: centerB, onPointerUp: (event) => onDataClick?.({ name: sets[1].name, value: second, data: sets[1], nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: centerB[0], cy: centerB[1], r: radiusB, fill: colorB, style: markStyle(1, colorB), className: "sia-chart__venn-circle" }) }),
6619
- !legacy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6640
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, toolbox: chartToolbox, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, empty: first <= 0 && second <= 0, ariaLabel: props.ariaLabel ?? "\u97E6\u6069\u56FE", children: [
6641
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { onPointerMove: () => setActive(0), onPointerLeave: () => setActive(void 0), onFocus: () => setActive(0), onBlur: () => setActive(void 0), label: `${sets[0].name}\uFF0C${first}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: sets[0].name, value: first }), tooltipPoint: centerA, onPointerUp: (event) => onDataClick?.({ name: sets[0].name, value: first, data: sets[0], nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: centerA[0], cy: centerA[1], r: radiusA, fill: colorA, style: markStyle(0, colorA), className: "sia-chart__venn-circle" }) }),
6642
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { onPointerMove: () => setActive(1), onPointerLeave: () => setActive(void 0), onFocus: () => setActive(1), onBlur: () => setActive(void 0), label: `${sets[1].name}\uFF0C${second}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: sets[1].name, value: second }), tooltipPoint: centerB, onPointerUp: (event) => onDataClick?.({ name: sets[1].name, value: second, data: sets[1], nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: centerB[0], cy: centerB[1], r: radiusB, fill: colorB, style: markStyle(1, colorB), className: "sia-chart__venn-circle" }) }),
6643
+ !legacy ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6620
6644
  " ",
6621
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("text", { x: centerA[0] - Math.min(radiusA * 0.34, distance3 * 0.24), y: 178, textAnchor: "middle", className: "sia-chart__venn-label", children: [
6622
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tspan", { x: centerA[0] - Math.min(radiusA * 0.34, distance3 * 0.24), children: sets[0].name }),
6623
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tspan", { x: centerA[0] - Math.min(radiusA * 0.34, distance3 * 0.24), dy: 22, children: first })
6645
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("text", { x: centerA[0] - Math.min(radiusA * 0.34, distance3 * 0.24), y: 178, textAnchor: "middle", className: "sia-chart__venn-label", children: [
6646
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tspan", { x: centerA[0] - Math.min(radiusA * 0.34, distance3 * 0.24), children: sets[0].name }),
6647
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tspan", { x: centerA[0] - Math.min(radiusA * 0.34, distance3 * 0.24), dy: 22, children: first })
6624
6648
  ] }),
6625
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("text", { x: centerB[0] + Math.min(radiusB * 0.34, distance3 * 0.24), y: 178, textAnchor: "middle", className: "sia-chart__venn-label", children: [
6626
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tspan", { x: centerB[0] + Math.min(radiusB * 0.34, distance3 * 0.24), children: sets[1].name }),
6627
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tspan", { x: centerB[0] + Math.min(radiusB * 0.34, distance3 * 0.24), dy: 22, children: second })
6649
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("text", { x: centerB[0] + Math.min(radiusB * 0.34, distance3 * 0.24), y: 178, textAnchor: "middle", className: "sia-chart__venn-label", children: [
6650
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tspan", { x: centerB[0] + Math.min(radiusB * 0.34, distance3 * 0.24), children: sets[1].name }),
6651
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tspan", { x: centerB[0] + Math.min(radiusB * 0.34, distance3 * 0.24), dy: 22, children: second })
6628
6652
  ] })
6629
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: [centerA, centerB].map((center, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: center[0], y: center[1] - (i === 0 ? radiusA : radiusB) - 16, textAnchor: "middle", style: { fill: i === 0 ? colorA : colorB, fontFamily: "Arial, Verdana, sans-serif", fontSize: 16, fontStyle: "italic", fontWeight: "bolder" }, children: sets[i].name }, i)) }),
6630
- overlap > 0 && lens && (!legacy || overlap < Math.min(first, second)) ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { onPointerMove: () => setActive(2), onPointerLeave: () => setActive(void 0), onFocus: () => setActive(2), onBlur: () => setActive(void 0), label: `${intersection.name ?? "\u4EA4\u96C6"}\uFF0C${overlap}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: intersection.name ?? "\u4EA4\u96C6", value: overlap }), tooltipPoint: [(centerA[0] + radiusA + centerB[0] - radiusB) / 2, centerA[1]], onPointerUp: (event) => onDataClick?.({ name: intersection.name ?? "\u4EA4\u96C6", value: overlap, data: intersection, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: lens, className: "sia-chart__venn-overlap", style: markStyle(2, intersection.color ?? getColor(2, void 0, palette)) }) }) : null
6653
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: [centerA, centerB].map((center, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: center[0], y: center[1] - (i === 0 ? radiusA : radiusB) - 16, textAnchor: "middle", style: { fill: i === 0 ? colorA : colorB, fontFamily: "Arial, Verdana, sans-serif", fontSize: 16, fontStyle: "italic", fontWeight: "bolder" }, children: sets[i].name }, i)) }),
6654
+ overlap > 0 && lens && (!legacy || overlap < Math.min(first, second)) ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { onPointerMove: () => setActive(2), onPointerLeave: () => setActive(void 0), onFocus: () => setActive(2), onBlur: () => setActive(void 0), label: `${intersection.name ?? "\u4EA4\u96C6"}\uFF0C${overlap}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: intersection.name ?? "\u4EA4\u96C6", value: overlap }), tooltipPoint: [(centerA[0] + radiusA + centerB[0] - radiusB) / 2, centerA[1]], onPointerUp: (event) => onDataClick?.({ name: intersection.name ?? "\u4EA4\u96C6", value: overlap, data: intersection, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: lens, className: "sia-chart__venn-overlap", style: markStyle(2, intersection.color ?? getColor(2, void 0, palette)) }) }) : null
6631
6655
  ] });
6632
6656
  });
6633
6657
  function treemapValue(node) {
@@ -6646,18 +6670,18 @@ function layoutTreemap(nodes, x, y, width, height, gap, maxDepth, depth = 0, see
6646
6670
  });
6647
6671
  return result;
6648
6672
  }
6649
- var TreemapChart = (0, import_react34.forwardRef)(function TreemapChart2({ data, gap = 4, maxDepth = 2, drilldown = false, showBreadcrumb = true, bounds, itemStyle, emphasis, cornerRadius = 5, showChildBoundaries = false, breadcrumbPosition = "top", breadcrumbRootName = "\u5168\u90E8", valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
6650
- const [path, setPath] = (0, import_react34.useState)([]);
6651
- const [sourceData, setSourceData] = (0, import_react34.useState)(data);
6652
- const [active, setActive] = (0, import_react34.useState)();
6653
- (0, import_react34.useEffect)(() => {
6673
+ var TreemapChart = (0, import_react35.forwardRef)(function TreemapChart2({ data, gap = 4, maxDepth = 2, drilldown = false, showBreadcrumb = true, bounds, itemStyle, emphasis, cornerRadius = 5, showChildBoundaries = false, breadcrumbPosition = "top", breadcrumbRootName = "\u5168\u90E8", valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
6674
+ const [path, setPath] = (0, import_react35.useState)([]);
6675
+ const [sourceData, setSourceData] = (0, import_react35.useState)(data);
6676
+ const [active, setActive] = (0, import_react35.useState)();
6677
+ (0, import_react35.useEffect)(() => {
6654
6678
  setSourceData(data);
6655
6679
  setPath([]);
6656
6680
  }, [data]);
6657
6681
  const currentData = path.reduce((nodes, name) => nodes.find((node) => node.name === name)?.children ?? nodes, sourceData);
6658
6682
  const top = drilldown && showBreadcrumb ? 52 : 28;
6659
- const rectangles = (0, import_react34.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
6660
- const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: currentData.map((node) => ({ name: node.name, data: [treemapValue(node)] })), onApply: (values) => {
6683
+ const rectangles = (0, import_react35.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
6684
+ const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: currentData.map((node) => ({ name: node.name, data: [treemapValue(node)] })), onApply: (values) => {
6661
6685
  const update = (nodes, depth) => nodes.map((node, i) => depth === path.length ? { ...node, value: values[i][0] } : node.name === path[depth] ? { ...node, children: update(node.children ?? [], depth + 1) } : node);
6662
6686
  setSourceData(update(sourceData, 0));
6663
6687
  } }), onRestore: () => {
@@ -6666,15 +6690,15 @@ var TreemapChart = (0, import_react34.forwardRef)(function TreemapChart2({ data,
6666
6690
  setActive(void 0);
6667
6691
  toolbox.onRestore?.();
6668
6692
  } } : toolbox;
6669
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, toolbox: chartToolbox, ref, palette, empty: !rectangles.length, ariaLabel: props.ariaLabel ?? "\u77E9\u5F62\u6811\u56FE", children: [
6670
- drilldown && showBreadcrumb ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("g", { className: "sia-chart__treemap-breadcrumb", children: [breadcrumbRootName, ...path].map((name, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { transform: `translate(${(bounds?.x ?? 24) + index * 96} ${breadcrumbPosition === "bottom" ? (bounds?.y ?? 28) + (bounds?.height ?? 308) + 4 : 28})`, role: "button", tabIndex: 0, onPointerUp: () => setPath(path.slice(0, index)), onKeyDown: (event) => {
6693
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, toolbox: chartToolbox, ref, palette, empty: !rectangles.length, ariaLabel: props.ariaLabel ?? "\u77E9\u5F62\u6811\u56FE", children: [
6694
+ drilldown && showBreadcrumb ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("g", { className: "sia-chart__treemap-breadcrumb", children: [breadcrumbRootName, ...path].map((name, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { transform: `translate(${(bounds?.x ?? 24) + index * 96} ${breadcrumbPosition === "bottom" ? (bounds?.y ?? 28) + (bounds?.height ?? 308) + 4 : 28})`, role: "button", tabIndex: 0, onPointerUp: () => setPath(path.slice(0, index)), onKeyDown: (event) => {
6671
6695
  if (event.key === "Enter" || event.key === " ") {
6672
6696
  event.preventDefault();
6673
6697
  setPath(path.slice(0, index));
6674
6698
  }
6675
6699
  }, children: [
6676
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { width: 86, height: 24, rx: 5, style: breadcrumbPosition === "bottom" ? { fill: "transparent", stroke: "none" } : void 0 }),
6677
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("text", { x: breadcrumbPosition === "bottom" ? 0 : 43, y: 16, textAnchor: breadcrumbPosition === "bottom" ? "start" : "middle", children: [
6700
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { width: 86, height: 24, rx: 5, style: breadcrumbPosition === "bottom" ? { fill: "transparent", stroke: "none" } : void 0 }),
6701
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("text", { x: breadcrumbPosition === "bottom" ? 0 : 43, y: 16, textAnchor: breadcrumbPosition === "bottom" ? "start" : "middle", children: [
6678
6702
  name,
6679
6703
  index < path.length ? " >" : ""
6680
6704
  ] })
@@ -6691,20 +6715,20 @@ var TreemapChart = (0, import_react34.forwardRef)(function TreemapChart2({ data,
6691
6715
  setActive(void 0);
6692
6716
  }
6693
6717
  };
6694
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { onPointerMove: () => setActive(index), onPointerLeave: () => setActive(void 0), onFocus: () => setActive(index), onBlur: () => setActive(void 0), onKeyDown: (event) => {
6718
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { onPointerMove: () => setActive(index), onPointerLeave: () => setActive(void 0), onFocus: () => setActive(index), onBlur: () => setActive(void 0), onKeyDown: (event) => {
6695
6719
  if (event.key === "Enter" || event.key === " ") {
6696
6720
  event.preventDefault();
6697
6721
  enter();
6698
6722
  }
6699
- }, label: `${rectangle.node.name}\uFF0C${formatChartNumber(rectangle.value)}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: rectangle.node.name, value: rectangle.value, formatter: valueFormatter }), tooltipPoint: [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height / 2], onPointerUp: (event) => {
6723
+ }, label: `${rectangle.node.name}\uFF0C${formatChartNumber(rectangle.value)}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: rectangle.node.name, value: rectangle.value, formatter: valueFormatter }), tooltipPoint: [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height / 2], onPointerUp: (event) => {
6700
6724
  enter();
6701
6725
  onDataClick?.({ name: rectangle.node.name, value: rectangle.value, data: rectangle.node, nativeEvent: event });
6702
6726
  }, children: [
6703
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: rectangle.x, y: rectangle.y, width: rectangle.width, height: rectangle.height, rx: cornerRadius, fill: color, style: { stroke: style.borderColor, strokeWidth: style.borderWidth }, className: `sia-chart__treemap-node sia-chart__treemap-node--depth-${rectangle.depth}` }),
6704
- showChildBoundaries && rectangle.node.children?.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("g", { pointerEvents: "none", children: layoutTreemap(rectangle.node.children, rectangle.x, rectangle.y, rectangle.width, rectangle.height, 0, 0).map((child) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: child.x, y: child.y, width: child.width, height: child.height, fill: "none", stroke: style.borderColor ?? "#ccc", strokeWidth: 1 }, child.node.name)) }) : null,
6705
- showLabel && style.label?.show !== false ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("text", { x: rectangle.x + (style.label?.x ?? 9), y: rectangle.y + (style.label?.y ?? 18), className: "sia-chart__treemap-label", style: { fill: style.label?.color, fontSize: style.label?.fontSize, fontFamily: style.label?.fontFamily, fontWeight: style.label?.fontWeight, fontStyle: style.label?.fontStyle }, children: [
6706
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tspan", { children: (style.label?.formatter ?? "{b}").replaceAll("{b}", rectangle.node.name).replaceAll("{c}", String(rectangle.value)) }),
6707
- !itemStyle?.label?.formatter && rectangle.height > 44 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tspan", { x: rectangle.x + 9, dy: 17, children: valueFormatter ? valueFormatter(rectangle.value) : formatChartNumber(rectangle.value) }) : null
6727
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: rectangle.x, y: rectangle.y, width: rectangle.width, height: rectangle.height, rx: cornerRadius, fill: color, style: { stroke: style.borderColor, strokeWidth: style.borderWidth }, className: `sia-chart__treemap-node sia-chart__treemap-node--depth-${rectangle.depth}` }),
6728
+ showChildBoundaries && rectangle.node.children?.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("g", { pointerEvents: "none", children: layoutTreemap(rectangle.node.children, rectangle.x, rectangle.y, rectangle.width, rectangle.height, 0, 0).map((child) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: child.x, y: child.y, width: child.width, height: child.height, fill: "none", stroke: style.borderColor ?? "#ccc", strokeWidth: 1 }, child.node.name)) }) : null,
6729
+ showLabel && style.label?.show !== false ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("text", { x: rectangle.x + (style.label?.x ?? 9), y: rectangle.y + (style.label?.y ?? 18), className: "sia-chart__treemap-label", style: { fill: style.label?.color, fontSize: style.label?.fontSize, fontFamily: style.label?.fontFamily, fontWeight: style.label?.fontWeight, fontStyle: style.label?.fontStyle }, children: [
6730
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tspan", { children: (style.label?.formatter ?? "{b}").replaceAll("{b}", rectangle.node.name).replaceAll("{c}", String(rectangle.value)) }),
6731
+ !itemStyle?.label?.formatter && rectangle.height > 44 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tspan", { x: rectangle.x + 9, dy: 17, children: valueFormatter ? valueFormatter(rectangle.value) : formatChartNumber(rectangle.value) }) : null
6708
6732
  ] }) : null
6709
6733
  ] }, `${path.join("/")}/${rectangle.node.name}-${index}`);
6710
6734
  })
@@ -6724,15 +6748,15 @@ function flattenTree(root, collapsed) {
6724
6748
  visit(root, 0);
6725
6749
  return { nodes, leafCount: Math.max(1, leafOrder), maxDepth: Math.max(0, ...nodes.map((item) => item.depth)) };
6726
6750
  }
6727
- var TreeChart = (0, import_react34.forwardRef)(function TreeChart2({ data, itemStyle, emphasis, orientation = "horizontal", radial = false, nodeSize = 8, rootPosition, nodePadding, layerPadding, showLabels = true, emphasisShowLabels = true, nodeColor, edgeColor, edgeWidth, edgeShadow, roam = false, hoverable = true, labelFontSize, labelColor, linkStyle = "curve", collapsible = false, onToggle, onDataClick, palette, toolbox, ...props }, ref) {
6728
- const [sourceData, setSourceData] = (0, import_react34.useState)(data);
6729
- const [roamReset, setRoamReset] = (0, import_react34.useState)(0);
6730
- const [active, setActive] = (0, import_react34.useState)();
6731
- (0, import_react34.useEffect)(() => {
6751
+ var TreeChart = (0, import_react35.forwardRef)(function TreeChart2({ data, itemStyle, emphasis, orientation = "horizontal", radial = false, nodeSize = 8, rootPosition, nodePadding, layerPadding, showLabels = true, emphasisShowLabels = true, nodeColor, edgeColor, edgeWidth, edgeShadow, roam = false, hoverable = true, labelFontSize, labelColor, linkStyle = "curve", collapsible = false, onToggle, onDataClick, palette, toolbox, ...props }, ref) {
6752
+ const [sourceData, setSourceData] = (0, import_react35.useState)(data);
6753
+ const [roamReset, setRoamReset] = (0, import_react35.useState)(0);
6754
+ const [active, setActive] = (0, import_react35.useState)();
6755
+ (0, import_react35.useEffect)(() => {
6732
6756
  setSourceData(data);
6733
6757
  setActive(void 0);
6734
6758
  }, [data]);
6735
- const [collapsed, setCollapsed] = (0, import_react34.useState)(() => {
6759
+ const [collapsed, setCollapsed] = (0, import_react35.useState)(() => {
6736
6760
  const result = /* @__PURE__ */ new Set();
6737
6761
  const visit = (node) => {
6738
6762
  if (node.collapsed) result.add(node.name);
@@ -6741,8 +6765,8 @@ var TreeChart = (0, import_react34.forwardRef)(function TreeChart2({ data, itemS
6741
6765
  visit(data);
6742
6766
  return result;
6743
6767
  });
6744
- const layout = (0, import_react34.useMemo)(() => flattenTree(sourceData, collapsed), [collapsed, sourceData]);
6745
- const fixedLayout = (0, import_react34.useMemo)(() => {
6768
+ const layout = (0, import_react35.useMemo)(() => flattenTree(sourceData, collapsed), [collapsed, sourceData]);
6769
+ const fixedLayout = (0, import_react35.useMemo)(() => {
6746
6770
  const visible = (node) => ({ ...node, children: collapsed.has(node.name) ? [] : node.children?.map(visible) });
6747
6771
  return rootPosition ? layoutTreeNodes(visible(sourceData), { nodeSize, nodePadding, layerPadding, rootPosition, orientation }) : void 0;
6748
6772
  }, [sourceData, collapsed, rootPosition, nodeSize, nodePadding, layerPadding, orientation]);
@@ -6756,7 +6780,7 @@ var TreeChart = (0, import_react34.forwardRef)(function TreeChart2({ data, itemS
6756
6780
  const main = 76 + item.depth / Math.max(1, layout.maxDepth) * 560;
6757
6781
  return orientation === "horizontal" ? [main, cross] : [cross + 155, main - 30];
6758
6782
  }).map((point, index) => fixedLayout ? [fixedLayout[index].x, fixedLayout[index].y] : point);
6759
- const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: flattenTree(sourceData, /* @__PURE__ */ new Set()).nodes.map((item) => ({ name: item.node.name, data: [item.node.value ?? 0] })), onApply: (values) => {
6783
+ const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: flattenTree(sourceData, /* @__PURE__ */ new Set()).nodes.map((item) => ({ name: item.node.name, data: [item.node.value ?? 0] })), onApply: (values) => {
6760
6784
  let cursor = 0;
6761
6785
  const update = (node) => {
6762
6786
  const value = values[cursor++][0];
@@ -6770,14 +6794,14 @@ var TreeChart = (0, import_react34.forwardRef)(function TreeChart2({ data, itemS
6770
6794
  setRoamReset((n) => n + 1);
6771
6795
  toolbox.onRestore?.();
6772
6796
  } } : toolbox;
6773
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SiaChart, { ...props, toolbox: chartToolbox, ref, palette, empty: !layout.nodes.length, ariaLabel: props.ariaLabel ?? "\u6811\u56FE", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartRoamGroup, { enabled: roam, width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, resetSignal: roamReset, children: [
6774
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("g", { className: "sia-chart__tree-links", style: edgeShadow ? { filter: `drop-shadow(${edgeShadow.offsetX}px ${edgeShadow.offsetY}px ${edgeShadow.blur}px ${edgeShadow.color})` } : void 0, children: layout.nodes.map((item, index) => {
6797
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SiaChart, { ...props, toolbox: chartToolbox, ref, palette, empty: !layout.nodes.length, ariaLabel: props.ariaLabel ?? "\u6811\u56FE", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartRoamGroup, { enabled: roam, width: props.viewBoxSize?.[0] ?? 720, height: props.viewBoxSize?.[1] ?? 360, resetSignal: roamReset, children: [
6798
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("g", { className: "sia-chart__tree-links", style: edgeShadow ? { filter: `drop-shadow(${edgeShadow.offsetX}px ${edgeShadow.offsetY}px ${edgeShadow.blur}px ${edgeShadow.color})` } : void 0, children: layout.nodes.map((item, index) => {
6775
6799
  if (item.parent == null) return null;
6776
6800
  const source = positions[item.parent];
6777
6801
  const target = positions[index];
6778
6802
  const bend = fixedLayout ? 0.618 : 0.5;
6779
6803
  const path = radial || linkStyle === "straight" ? `M ${source[0]} ${source[1]} L ${target[0]} ${target[1]}` : linkStyle === "broken" && orientation === "horizontal" ? `M ${source[0]} ${source[1]} H ${(source[0] + target[0]) / 2} V ${target[1]} H ${target[0]}` : linkStyle === "broken" ? `M ${source[0]} ${source[1]} V ${(source[1] + target[1]) / 2} H ${target[0]} V ${target[1]}` : orientation === "horizontal" ? `M ${source[0]} ${source[1]} C ${source[0] + (target[0] - source[0]) * bend} ${source[1]}, ${source[0] + (target[0] - source[0]) * (1 - bend)} ${target[1]}, ${target[0]} ${target[1]}` : `M ${source[0]} ${source[1]} C ${source[0]} ${source[1] + (target[1] - source[1]) * bend}, ${target[0]} ${source[1] + (target[1] - source[1]) * (1 - bend)}, ${target[0]} ${target[1]}`;
6780
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: path, style: { stroke: edgeColor, strokeWidth: edgeWidth } }, index);
6804
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: path, style: { stroke: edgeColor, strokeWidth: edgeWidth } }, index);
6781
6805
  }) }),
6782
6806
  layout.nodes.map((item, index) => {
6783
6807
  const position = positions[index];
@@ -6788,11 +6812,11 @@ var TreeChart = (0, import_react34.forwardRef)(function TreeChart2({ data, itemS
6788
6812
  const labelPosition = resolved.label?.position ?? (orientation === "vertical" && !radial ? "bottom" : "right");
6789
6813
  const labelX = position[0] + (labelPosition === "right" ? radius + 5 : labelPosition === "left" ? -radius - 5 : 0);
6790
6814
  const labelY = position[1] + (labelPosition === "bottom" ? glyphHeight / 2 + 14 : labelPosition === "top" ? -glyphHeight / 2 - 5 : (resolved.label?.fontSize ?? labelFontSize ?? 12) / 3);
6791
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { onPointerMove: () => {
6815
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { onPointerMove: () => {
6792
6816
  if (hoverable) setActive(index);
6793
6817
  }, onPointerLeave: () => setActive(void 0), onFocus: () => {
6794
6818
  if (hoverable) setActive(index);
6795
- }, onBlur: () => setActive(void 0), label: `${item.node.name}${item.node.value == null ? "" : `\uFF0C${item.node.value}`}`, tooltip: hoverable ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: item.node.name, value: item.node.value ?? 0 }) : void 0, tooltipPoint: position, onPointerUp: (event) => {
6819
+ }, onBlur: () => setActive(void 0), label: `${item.node.name}${item.node.value == null ? "" : `\uFF0C${item.node.value}`}`, tooltip: hoverable ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: item.node.name, value: item.node.value ?? 0 }) : void 0, tooltipPoint: position, onPointerUp: (event) => {
6796
6820
  if (collapsible && item.node.children?.length) {
6797
6821
  const nextCollapsed = !collapsed.has(item.node.name);
6798
6822
  setCollapsed((current) => {
@@ -6805,54 +6829,54 @@ var TreeChart = (0, import_react34.forwardRef)(function TreeChart2({ data, itemS
6805
6829
  }
6806
6830
  onDataClick?.({ name: item.node.name, value: item.node.value ?? 0, data: item.node, nativeEvent: event });
6807
6831
  }, children: [
6808
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TreeNodeGlyph, { symbol: item.node.symbol, x: position[0], y: position[1], width: radius * 2, height: glyphHeight, color, itemStyle: resolved }),
6809
- collapsible && item.node.children?.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: position[0], y: position[1] + 4, textAnchor: "middle", className: "sia-chart__tree-toggle", children: collapsed.has(item.node.name) ? "+" : "\u2212" }) : null,
6810
- resolved.label?.show ?? (active === index ? emphasisShowLabels : showLabels) ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: labelX, y: labelY, textAnchor: labelPosition === "left" ? "end" : labelPosition === "right" ? "start" : "middle", style: { fontSize: resolved.label?.fontSize ?? labelFontSize, fill: resolved.label?.color ?? labelColor, fontWeight: resolved.label?.fontWeight }, className: "sia-chart__tree-label", children: (resolved.label?.formatter ?? "{b}").replaceAll("{b}", item.node.name).replaceAll("{c}", String(item.node.value ?? "")) }) : null
6832
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TreeNodeGlyph, { symbol: item.node.symbol, x: position[0], y: position[1], width: radius * 2, height: glyphHeight, color, itemStyle: resolved }),
6833
+ collapsible && item.node.children?.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: position[0], y: position[1] + 4, textAnchor: "middle", className: "sia-chart__tree-toggle", children: collapsed.has(item.node.name) ? "+" : "\u2212" }) : null,
6834
+ resolved.label?.show ?? (active === index ? emphasisShowLabels : showLabels) ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: labelX, y: labelY, textAnchor: labelPosition === "left" ? "end" : labelPosition === "right" ? "start" : "middle", style: { fontSize: resolved.label?.fontSize ?? labelFontSize, fill: resolved.label?.color ?? labelColor, fontWeight: resolved.label?.fontWeight }, className: "sia-chart__tree-label", children: (resolved.label?.formatter ?? "{b}").replaceAll("{b}", item.node.name).replaceAll("{c}", String(item.node.value ?? "")) }) : null
6811
6835
  ] }, `${item.node.name}-${index}`);
6812
6836
  })
6813
6837
  ] }) });
6814
6838
  });
6815
- var WordCloudChart = (0, import_react34.forwardRef)(function WordCloudChart2({ data, bounds, areaSizing = false, autoFit = false, onLayout, minFontSize = 14, maxFontSize = 52, rotations = [0, 0, -28, 28, 0], spiralStep = 9, shape = "ellipse", padding = 4, fontFamily, fontWeight = 650, onDataClick, palette, ...props }, ref) {
6816
- const placements = (0, import_react34.useMemo)(() => {
6839
+ var WordCloudChart = (0, import_react35.forwardRef)(function WordCloudChart2({ data, bounds, areaSizing = false, autoFit = false, onLayout, minFontSize = 14, maxFontSize = 52, rotations = [0, 0, -28, 28, 0], spiralStep = 9, shape = "ellipse", padding = 4, fontFamily, fontWeight = 650, onDataClick, palette, ...props }, ref) {
6840
+ const placements = (0, import_react35.useMemo)(() => {
6817
6841
  const context = typeof document === "undefined" ? null : document.createElement("canvas").getContext("2d");
6818
6842
  return layoutCloudWords(data, { bounds: bounds ?? { x: 18, y: 18, width: 684, height: 324 }, minFontSize, maxFontSize, rotations, spiralStep, shape, padding, autoFit, areaSizing, measure: context ? (word, size) => {
6819
6843
  context.font = `${word.fontWeight ?? fontWeight} ${size}px ${word.fontFamily ?? fontFamily ?? "Arial"}`;
6820
6844
  return context.measureText(word.name).width;
6821
6845
  } : void 0 });
6822
6846
  }, [data, bounds, autoFit, areaSizing, maxFontSize, minFontSize, padding, rotations, shape, spiralStep, fontFamily, fontWeight]);
6823
- (0, import_react34.useEffect)(() => {
6847
+ (0, import_react35.useEffect)(() => {
6824
6848
  const present = new Set(placements.map((p) => p.index));
6825
6849
  onLayout?.({ placed: placements.length, unplaced: data.filter((_, i) => !present.has(i)).map((item) => item.name) });
6826
6850
  }, [placements, data, onLayout]);
6827
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SiaChart, { ...props, ref, palette, empty: !placements.length, ariaLabel: props.ariaLabel ?? "\u5B57\u7B26\u4E91", children: placements.map((placement) => {
6851
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SiaChart, { ...props, ref, palette, empty: !placements.length, ariaLabel: props.ariaLabel ?? "\u5B57\u7B26\u4E91", children: placements.map((placement) => {
6828
6852
  const color = getColor(placement.index, placement.item.color, palette);
6829
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { label: `${placement.item.name}\uFF0C${placement.item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name: placement.item.name, value: placement.item.value }), tooltipPoint: [placement.x, placement.y], transform: `rotate(${placement.rotation} ${placement.x} ${placement.y})`, onPointerUp: (event) => onDataClick?.({ name: placement.item.name, value: placement.item.value, data: placement.item, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: placement.x, y: placement.y + placement.fontSize * 0.34, textAnchor: "middle", fill: color, style: { fontSize: placement.fontSize, fontFamily: placement.item.fontFamily ?? fontFamily, fontWeight: placement.item.fontWeight ?? fontWeight }, className: "sia-chart__word", children: placement.item.name }) }, `${placement.item.name}-${placement.index}`);
6853
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { label: `${placement.item.name}\uFF0C${placement.item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name: placement.item.name, value: placement.item.value }), tooltipPoint: [placement.x, placement.y], transform: `rotate(${placement.rotation} ${placement.x} ${placement.y})`, onPointerUp: (event) => onDataClick?.({ name: placement.item.name, value: placement.item.value, data: placement.item, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: placement.x, y: placement.y + placement.fontSize * 0.34, textAnchor: "middle", fill: color, style: { fontSize: placement.fontSize, fontFamily: placement.item.fontFamily ?? fontFamily, fontWeight: placement.item.fontWeight ?? fontWeight }, className: "sia-chart__word", children: placement.item.name }) }, `${placement.item.name}-${placement.index}`);
6830
6854
  }) });
6831
6855
  });
6832
- var MixedChart = (0, import_react34.forwardRef)(function MixedChart2({ axisPointer, categoryAxisLabels, axisLayering = "inline", barSpacing, renderAxes, coordinateAnimation = false, animationProgress, animationDurationUpdate = 500, boundaryGap = true, categories, activeIndex, onActiveIndexChange, showCategoryLabels = true, categoryLabelInterval = 0, clipPlot = false, series: sourceSeries, valueAxes, stacked: sourceStacked = false, plotBounds, tooltipTrigger = "item", calculable = false, onTransferError, onDataChange, transferId, onValueTransfer, toolbox, legendNames, axisTooltipFormatter, legendLayout, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, ...props }, ref) {
6833
- const plotClipId = `sia-mixed-plot-${(0, import_react34.useId)().replaceAll(":", "")}`;
6834
- const [editableSeries, setEditableSeries] = (0, import_react34.useState)(sourceSeries);
6835
- const [geometry, setGeometry] = (0, import_react34.useState)();
6836
- const [pointerIndex, setPointerIndex] = (0, import_react34.useState)(null);
6837
- const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react34.useState)(0);
6838
- const [motionRevision, setMotionRevision] = (0, import_react34.useState)(0);
6839
- const [stackMode, setStackMode] = (0, import_react34.useState)();
6840
- const lastPublished = (0, import_react34.useRef)(null);
6856
+ var MixedChart = (0, import_react35.forwardRef)(function MixedChart2({ axisPointer, categoryAxisLabels, axisLayering = "inline", barSpacing, renderAxes, coordinateAnimation = false, animationProgress, animationDurationUpdate = 500, boundaryGap = true, categories, activeIndex, onActiveIndexChange, showCategoryLabels = true, categoryLabelInterval = 0, clipPlot = false, series: sourceSeries, valueAxes, stacked: sourceStacked = false, plotBounds, tooltipTrigger = "item", calculable = false, onTransferError, onDataChange, transferId, onValueTransfer, toolbox, legendNames, axisTooltipFormatter, legendLayout, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, ...props }, ref) {
6857
+ const plotClipId = `sia-mixed-plot-${(0, import_react35.useId)().replaceAll(":", "")}`;
6858
+ const [editableSeries, setEditableSeries] = (0, import_react35.useState)(sourceSeries);
6859
+ const [geometry, setGeometry] = (0, import_react35.useState)();
6860
+ const [pointerIndex, setPointerIndex] = (0, import_react35.useState)(null);
6861
+ const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react35.useState)(0);
6862
+ const [motionRevision, setMotionRevision] = (0, import_react35.useState)(0);
6863
+ const [stackMode, setStackMode] = (0, import_react35.useState)();
6864
+ const lastPublished = (0, import_react35.useRef)(null);
6841
6865
  const publishData = (next) => {
6842
6866
  lastPublished.current = next;
6843
6867
  onDataChange?.(next);
6844
6868
  };
6845
- const [islands, setIslands] = (0, import_react34.useState)([]);
6846
- const drag = (0, import_react34.useRef)(null);
6847
- const [dragOffset, setDragOffset] = (0, import_react34.useState)();
6848
- (0, import_react34.useEffect)(() => {
6869
+ const [islands, setIslands] = (0, import_react35.useState)([]);
6870
+ const drag = (0, import_react35.useRef)(null);
6871
+ const [dragOffset, setDragOffset] = (0, import_react35.useState)();
6872
+ (0, import_react35.useEffect)(() => {
6849
6873
  if (sourceSeries === lastPublished.current) return;
6850
6874
  setEditableSeries(sourceSeries);
6851
6875
  setIslands([]);
6852
6876
  drag.current = null;
6853
6877
  setDragOffset(void 0);
6854
6878
  }, [sourceSeries]);
6855
- const series = (0, import_react34.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
6879
+ const series = (0, import_react35.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
6856
6880
  const stacked = stackMode ?? sourceStacked;
6857
6881
  const PLOT2 = plotBounds ?? { x: 62, y: 48, width: 628, height: 250 }, PLOT_BOTTOM2 = PLOT2.y + PLOT2.height;
6858
6882
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -6879,7 +6903,7 @@ var MixedChart = (0, import_react34.forwardRef)(function MixedChart2({ axisPoint
6879
6903
  legend.replace(Object.fromEntries(sourceSeries.map((item) => [item.name, legendSelected?.[item.name] ?? true])));
6880
6904
  options.onRestore?.();
6881
6905
  },
6882
- dataView: options.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartDataEditor, { allowNull: true, readOnly: options.dataViewReadOnly, series: editableSeries, onApply: (values) => {
6906
+ dataView: options.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartDataEditor, { allowNull: true, readOnly: options.dataViewReadOnly, series: editableSeries, onApply: (values) => {
6883
6907
  const next = editableSeries.map((item, index) => ({ ...item, data: values[index] }));
6884
6908
  setEditableSeries(next);
6885
6909
  publishData(next);
@@ -6894,9 +6918,9 @@ var MixedChart = (0, import_react34.forwardRef)(function MixedChart2({ axisPoint
6894
6918
  const categoryName = (index, axisIndex = 0) => categoryAxisLabels?.[axisIndex]?.[index] ?? categories[index] ?? `${index + 1}`;
6895
6919
  const axisTooltip = (index, axisIndex = 0) => {
6896
6920
  const rows = activeSeries.filter((item) => (item.categoryAxisIndex ?? 0) === axisIndex);
6897
- return axisTooltipFormatter ? axisTooltipFormatter(index, rows, axisIndex) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6898
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("strong", { children: categoryName(index, axisIndex).trim() }),
6899
- rows.map((item) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
6921
+ return axisTooltipFormatter ? axisTooltipFormatter(index, rows, axisIndex) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6922
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: categoryName(index, axisIndex).trim() }),
6923
+ rows.map((item) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
6900
6924
  item.name,
6901
6925
  "\uFF1A",
6902
6926
  item.data[index] == null ? "-" : valueFormatter ? valueFormatter(item.data[index]) : item.data[index]
@@ -7002,24 +7026,24 @@ var MixedChart = (0, import_react34.forwardRef)(function MixedChart2({ axisPoint
7002
7026
  }
7003
7027
  };
7004
7028
  }
7005
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(SiaChart, { ...props, toolbox: chartToolbox, ref, palette, empty: !categories.length || !series.length, ariaLabel: props.ariaLabel ?? "\u6DF7\u642D\u56FE", children: [
7006
- showLegend ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartLegend, { ...legendLayout, symbol: legendLayout?.symbol === "auto" ? "rect" : legendLayout?.symbol, items: series.map((item, index) => ({ name: item.name, symbol: legendLayout?.symbol === "auto" ? item.type === "line" ? "line" : "rect" : void 0, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })).filter((item) => !legendNames || legendNames.includes(item.name)), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
7007
- renderAxes ? renderAxes({ layer: axisLayering === "overlay" ? "base" : "all", plot: PLOT2, categoryPositions: categories.map((_, index) => (categoryAt(index) - PLOT2.x) / PLOT2.width), valueDomains: axisDomains ?? [domain] }) : valueAxes?.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
7008
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { orientation: "bottom", x: PLOT2.x, y: PLOT_BOTTOM2, length: PLOT2.width, showLabels: showCategoryLabels, tickInterval: labelStep, labels: categories.map((name, index) => index % labelStep === 0 ? name : ""), positions: categories.map((_, index) => (categoryAt(index) - PLOT2.x) / PLOT2.width), boundaryGap: categoryGap }),
7029
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, toolbox: chartToolbox, ref, palette, empty: !categories.length || !series.length, ariaLabel: props.ariaLabel ?? "\u6DF7\u642D\u56FE", children: [
7030
+ showLegend ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { ...legendLayout, symbol: legendLayout?.symbol === "auto" ? "rect" : legendLayout?.symbol, items: series.map((item, index) => ({ name: item.name, symbol: legendLayout?.symbol === "auto" ? item.type === "line" ? "line" : "rect" : void 0, color: getColor(index, item.color, palette), disabled: !legend.isSelected(item.name) })).filter((item) => !legendNames || legendNames.includes(item.name)), selected: legend.selected, onItemClick: legendInteractive ? legend.toggle : void 0 }) : null,
7031
+ renderAxes ? renderAxes({ layer: axisLayering === "overlay" ? "base" : "all", plot: PLOT2, categoryPositions: categories.map((_, index) => (categoryAt(index) - PLOT2.x) / PLOT2.width), valueDomains: axisDomains ?? [domain] }) : valueAxes?.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7032
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { orientation: "bottom", x: PLOT2.x, y: PLOT_BOTTOM2, length: PLOT2.width, showLabels: showCategoryLabels, tickInterval: labelStep, labels: categories.map((name, index) => index % labelStep === 0 ? name : ""), positions: categories.map((_, index) => (categoryAt(index) - PLOT2.x) / PLOT2.width), boundaryGap: categoryGap }),
7009
7033
  valueAxes.map((axis, index) => {
7010
7034
  const position = axis.position ?? (index === 0 ? "left" : "right");
7011
7035
  const x = position === "left" ? PLOT2.x : PLOT2.x + PLOT2.width;
7012
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { "data-value-axis": index, children: [
7013
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartAxis, { boundaryGap: false, orientation: position, x, y: PLOT_BOTTOM2, length: PLOT2.height, labels: chartTicks(axisDomains[index]).map(axis.formatter ?? formatChartNumber), gridLength: index === 0 ? PLOT2.width : void 0, axisColor: axis.axisColor, gridColor: axis.gridColor, showTicks: axis.showTicks }),
7014
- axis.name ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x, y: PLOT2.y - 12, textAnchor: position === "left" ? "start" : "end", className: "sia-chart__axis-name", style: axis.nameStyle, children: axis.name }) : null
7036
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { "data-value-axis": index, children: [
7037
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartAxis, { boundaryGap: false, orientation: position, x, y: PLOT_BOTTOM2, length: PLOT2.height, labels: chartTicks(axisDomains[index]).map(axis.formatter ?? formatChartNumber), gridLength: index === 0 ? PLOT2.width : void 0, axisColor: axis.axisColor, gridColor: axis.gridColor, showTicks: axis.showTicks }),
7038
+ axis.name ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x, y: PLOT2.y - 12, textAnchor: position === "left" ? "start" : "end", className: "sia-chart__axis-name", style: axis.nameStyle, children: axis.name }) : null
7015
7039
  ] }, index);
7016
7040
  })
7017
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CartesianAxes, { categories, domain, band: categoryGap }),
7018
- activeIndex != null && activeIndex >= 0 && activeIndex < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { "data-mixed-active-index": activeIndex, x: Math.max(PLOT2.x, categoryAt(activeIndex) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(activeIndex) + band / 2) - Math.max(PLOT2.x, categoryAt(activeIndex) - band / 2), height: PLOT2.height, fill: "currentColor", opacity: 0.06, pointerEvents: "none" }) : null,
7019
- tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react35.createElement)(ChartMark, { ...activeProps(index), key: `axis-${index}`, "data-mixed-axis-tooltip": index, label: `${name.trim()} \u5404\u6307\u6807`, tooltip: axisTooltip(index), tooltipPoint: [categoryAt(index), PLOT2.y + PLOT2.height / 2] }, /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: Math.max(PLOT2.x, categoryAt(index) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(index) + band / 2) - Math.max(PLOT2.x, categoryAt(index) - band / 2), height: PLOT2.height, fill: "transparent" }))) : null,
7020
- calculable ? activeSeries.flatMap((item) => item.data.map((value, index) => value === null ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartMark, { ...dragProps(series.indexOf(item), index), label: `${item.name}\uFF0C${categories[index]}\uFF0C\u7A7A\u69FD`, tooltip: "\u62D6\u5165\u6570\u636E\u4EE5\u586B\u5145", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: PLOT2.x + index * band + band * activeSeries.indexOf(item) / Math.max(1, activeSeries.length), y: PLOT_BOTTOM2 - 14, width: Math.max(4, band / Math.max(1, activeSeries.length) - 2), height: 14, fill: "transparent", stroke: getColor(series.indexOf(item), item.color, palette), strokeDasharray: "3 2" }) }, `empty-${item.name}-${index}`) : null)) : null,
7021
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("clipPath", { id: plotClipId, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { x: PLOT2.x, y: PLOT2.y, width: PLOT2.width, height: PLOT2.height }) }) }),
7022
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("g", { "data-mixed-plot": "", clipPath: clipPlot ? `url(#${plotClipId})` : void 0, children: renderSeries.map((item) => {
7041
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CartesianAxes, { categories, domain, band: categoryGap }),
7042
+ activeIndex != null && activeIndex >= 0 && activeIndex < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { "data-mixed-active-index": activeIndex, x: Math.max(PLOT2.x, categoryAt(activeIndex) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(activeIndex) + band / 2) - Math.max(PLOT2.x, categoryAt(activeIndex) - band / 2), height: PLOT2.height, fill: "currentColor", opacity: 0.06, pointerEvents: "none" }) : null,
7043
+ tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react36.createElement)(ChartMark, { ...activeProps(index), key: `axis-${index}`, "data-mixed-axis-tooltip": index, label: `${name.trim()} \u5404\u6307\u6807`, tooltip: axisTooltip(index), tooltipPoint: [categoryAt(index), PLOT2.y + PLOT2.height / 2] }, /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: Math.max(PLOT2.x, categoryAt(index) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(index) + band / 2) - Math.max(PLOT2.x, categoryAt(index) - band / 2), height: PLOT2.height, fill: "transparent" }))) : null,
7044
+ calculable ? activeSeries.flatMap((item) => item.data.map((value, index) => value === null ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { ...dragProps(series.indexOf(item), index), label: `${item.name}\uFF0C${categories[index]}\uFF0C\u7A7A\u69FD`, tooltip: "\u62D6\u5165\u6570\u636E\u4EE5\u586B\u5145", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: PLOT2.x + index * band + band * activeSeries.indexOf(item) / Math.max(1, activeSeries.length), y: PLOT_BOTTOM2 - 14, width: Math.max(4, band / Math.max(1, activeSeries.length) - 2), height: 14, fill: "transparent", stroke: getColor(series.indexOf(item), item.color, palette), strokeDasharray: "3 2" }) }, `empty-${item.name}-${index}`) : null)) : null,
7045
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("clipPath", { id: plotClipId, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: PLOT2.x, y: PLOT2.y, width: PLOT2.width, height: PLOT2.height }) }) }),
7046
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("g", { "data-mixed-plot": "", clipPath: clipPlot ? `url(#${plotClipId})` : void 0, children: renderSeries.map((item) => {
7023
7047
  const seriesIndex = series.indexOf(item);
7024
7048
  const color = getColor(seriesIndex, item.color, palette);
7025
7049
  const valueDomain = axisDomains?.[item.valueAxisIndex ?? 0] ?? domain;
@@ -7027,10 +7051,10 @@ var MixedChart = (0, import_react34.forwardRef)(function MixedChart2({ axisPoint
7027
7051
  const finiteValues = item.data.filter((value) => value !== null && Number.isFinite(value));
7028
7052
  const average = finiteValues.reduce((sum, value) => sum + value, 0) / Math.max(1, finiteValues.length);
7029
7053
  const averageY = linearScale(average, [valueDomain[0], valueDomain[1]], [PLOT_BOTTOM2, PLOT2.y]);
7030
- const averageMark = item.markAverage && finiteValues.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { className: "sia-chart__mark-line", "data-mixed-average": item.name, children: [
7031
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: averageY, y2: averageY, style: { stroke: item.markColor ?? color } }),
7032
- item.markSymbol !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: `M ${PLOT2.x + 8} ${averageY - 4} L ${PLOT2.x} ${averageY} L ${PLOT2.x + 8} ${averageY + 4} Z`, fill: item.markColor ?? color }) : null,
7033
- !clipPlot && item.showMarkLabel !== false ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: PLOT2.x - 8, y: averageY + 4, textAnchor: "end", style: { fill: item.markColor ?? color }, children: item.markFormatter ? item.markFormatter(average) : Number(average.toFixed(2)) }) : null
7054
+ const averageMark = item.markAverage && finiteValues.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { className: "sia-chart__mark-line", "data-mixed-average": item.name, children: [
7055
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: PLOT2.x, x2: PLOT2.x + PLOT2.width, y1: averageY, y2: averageY, style: { stroke: item.markColor ?? color } }),
7056
+ item.markSymbol !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: `M ${PLOT2.x + 8} ${averageY - 4} L ${PLOT2.x} ${averageY} L ${PLOT2.x + 8} ${averageY + 4} Z`, fill: item.markColor ?? color }) : null,
7057
+ !clipPlot && item.showMarkLabel !== false ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: PLOT2.x - 8, y: averageY + 4, textAnchor: "end", style: { fill: item.markColor ?? color }, children: item.markFormatter ? item.markFormatter(average) : Number(average.toFixed(2)) }) : null
7034
7058
  ] }) : null;
7035
7059
  if (item.type === "bar") {
7036
7060
  const axisBars = barSeries.filter((candidate) => (candidate.categoryAxisIndex ?? 0) === (item.categoryAxisIndex ?? 0));
@@ -7042,7 +7066,7 @@ var MixedChart = (0, import_react34.forwardRef)(function MixedChart2({ axisPoint
7042
7066
  const customSlot = barSpacing ? mixedBarSlots(band, barGroups.map((group2) => barSeries.find((candidate) => layout.rows[activeSeries.indexOf(candidate)]?.find(Boolean)?.group === group2 && candidate.barWidth !== void 0)?.barWidth), barSpacing)[barIndex] : void 0;
7043
7067
  const rawWidth = customSlot?.width ?? Math.min(slotWidth, Math.max(0, requestedWidth ?? slotWidth));
7044
7068
  const width = barSpacing?.pixelAlign ? Math.ceil(rawWidth) : rawWidth;
7045
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
7069
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
7046
7070
  averageMark,
7047
7071
  categories.map((_, index) => {
7048
7072
  const name = categoryName(index, item.categoryAxisIndex);
@@ -7055,9 +7079,9 @@ var MixedChart = (0, import_react34.forwardRef)(function MixedChart2({ axisPoint
7055
7079
  const zero = linearScale(placement.start, [valueDomain[0], valueDomain[1]], [PLOT_BOTTOM2, PLOT2.y]);
7056
7080
  const rectY = barSpacing?.pixelAlign ? Math.floor(Math.min(y, zero)) : Math.min(y, zero);
7057
7081
  const rectHeight = barSpacing?.pixelAlign ? Math.ceil(Math.abs(zero - y)) : Math.abs(zero - y);
7058
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPointMotion, { points: [[x, value >= 0 ? rectY + rectHeight : rectY], [x, rectY], [x + width, rectY + rectHeight]], enabled: coordinateAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: coordinateAnimation ? animationProgress : void 0, children: (frame) => /* @__PURE__ */ (0, import_react35.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
7082
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPointMotion, { points: [[x, value >= 0 ? rectY + rectHeight : rectY], [x, rectY], [x + width, rectY + rectHeight]], enabled: coordinateAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: coordinateAnimation ? animationProgress : void 0, children: (frame) => /* @__PURE__ */ (0, import_react36.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
7059
7083
  if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
7060
- } }, /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("rect", { style: { animation: coordinateAnimation ? "none" : void 0 }, x: frame[1][0], y: Math.min(frame[1][1], frame[2][1]), width: Math.max(0, frame[2][0] - frame[1][0]), height: Math.abs(frame[2][1] - frame[1][1]), rx: item.barRadius ?? 4, fill: item.pointColors?.[index] ?? color, className: "sia-chart__bar" })) }, `${item.name}-${index}-${motionRevision}`);
7084
+ } }, /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { style: { animation: coordinateAnimation ? "none" : void 0 }, x: frame[1][0], y: Math.min(frame[1][1], frame[2][1]), width: Math.max(0, frame[2][0] - frame[1][0]), height: Math.abs(frame[2][1] - frame[1][1]), rx: item.barRadius ?? 4, fill: item.pointColors?.[index] ?? color, className: "sia-chart__bar" })) }, `${item.name}-${index}-${motionRevision}`);
7061
7085
  })
7062
7086
  ] }, `${item.name}-${seriesIndex}`);
7063
7087
  }
@@ -7069,35 +7093,35 @@ var MixedChart = (0, import_react34.forwardRef)(function MixedChart2({ axisPoint
7069
7093
  if (index === 0 || !placements[index - 1]) segments.push([]);
7070
7094
  segments.at(-1).push(index);
7071
7095
  });
7072
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChartPointMotion, { points: [...points, ...baseline], enabled: coordinateAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: coordinateAnimation ? animationProgress : void 0, children: (frame) => {
7096
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPointMotion, { points: [...points, ...baseline], enabled: coordinateAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: coordinateAnimation ? animationProgress : void 0, children: (frame) => {
7073
7097
  const points2 = frame.slice(0, categories.length), baseline2 = frame.slice(categories.length);
7074
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
7098
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
7075
7099
  averageMark,
7076
- segments.map((segment) => item.sampling === "pixel" ? chartPixelSample(segment, PLOT2.width) : segment).map((segment, segmentIndex) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
7077
- item.area ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: `${linePath(segment.map((index) => points2[index]), item.curve)} ${[...segment].reverse().map((index) => {
7100
+ segments.map((segment) => item.sampling === "pixel" ? chartPixelSample(segment, PLOT2.width) : segment).map((segment, segmentIndex) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
7101
+ item.area ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: `${linePath(segment.map((index) => points2[index]), item.curve)} ${[...segment].reverse().map((index) => {
7078
7102
  const point = baseline2[categories.length - 1 - index];
7079
7103
  return `L ${point[0]} ${point[1]}`;
7080
7104
  }).join(" ")} Z`, fill: color, style: item.areaOpacity === void 0 ? void 0 : { opacity: item.areaOpacity }, className: "sia-chart__area" }) : null,
7081
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: linePath(segment.map((index) => points2[index]), item.curve), fill: "none", stroke: color, pathLength: item.lineStyle && item.lineStyle !== "solid" ? void 0 : 1, strokeDasharray: item.lineStyle === "dashed" ? "7 5" : item.lineStyle === "dotted" ? "2 4" : void 0, style: { strokeWidth: item.lineWidth, animation: coordinateAnimation ? "none" : void 0 }, className: `sia-chart__line${coordinateAnimation || item.lineStyle && item.lineStyle !== "solid" ? "" : " sia-chart__line--draw"}` })
7105
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: linePath(segment.map((index) => points2[index]), item.curve), fill: "none", stroke: color, pathLength: item.lineStyle && item.lineStyle !== "solid" ? void 0 : 1, strokeDasharray: item.lineStyle === "dashed" ? "7 5" : item.lineStyle === "dotted" ? "2 4" : void 0, style: { strokeWidth: item.lineWidth, animation: coordinateAnimation ? "none" : void 0 }, className: `sia-chart__line${coordinateAnimation || item.lineStyle && item.lineStyle !== "solid" ? "" : " sia-chart__line--draw"}` })
7082
7106
  ] }, segmentIndex)),
7083
7107
  item.showPoints === false ? null : points2.map((point, index) => {
7084
7108
  if (!placements[index]) return null;
7085
7109
  const name = categoryName(index, item.categoryAxisIndex);
7086
7110
  const value = item.data[index] ?? 0;
7087
- return /* @__PURE__ */ (0, import_react35.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
7111
+ return /* @__PURE__ */ (0, import_react36.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
7088
7112
  if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
7089
- } }, /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { className: item.hollowSymbol ? "sia-chart__mixed-hollow-symbol" : void 0, cx: point[0], cy: point[1], r: Math.max(0, item.symbolSize ?? 9) / 2, fill: item.hollowSymbol ? "#fff" : color, stroke: item.hollowSymbol ? color : "var(--sia-color-surface)", strokeWidth: 2 }));
7113
+ } }, /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { className: item.hollowSymbol ? "sia-chart__mixed-hollow-symbol" : void 0, cx: point[0], cy: point[1], r: Math.max(0, item.symbolSize ?? 9) / 2, fill: item.hollowSymbol ? "#fff" : color, stroke: item.hollowSymbol ? color : "var(--sia-color-surface)", strokeWidth: 2 }));
7090
7114
  })
7091
7115
  ] });
7092
7116
  } }, `${item.name}-${seriesIndex}-${motionRevision}`);
7093
7117
  }) }),
7094
7118
  axisLayering === "overlay" ? renderAxes?.({ layer: "line", plot: PLOT2, categoryPositions: categories.map((_, index) => (categoryAt(index) - PLOT2.x) / PLOT2.width), valueDomains: axisDomains ?? [domain] }) : null,
7095
- axisPointer && shownPointer != null && shownPointer >= 0 && shownPointer < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { "data-mixed-axis-pointer": shownPointer, x1: pointerX, x2: pointerX, y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: pointerStyle.color ?? "var(--sia-color-primary)", strokeWidth: pointerWidth, strokeDasharray: pointerStyle.lineStyle === "dashed" ? "5 4" : pointerStyle.lineStyle === "dotted" ? "2 2" : void 0, pointerEvents: "none" }) : null,
7119
+ axisPointer && shownPointer != null && shownPointer >= 0 && shownPointer < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { "data-mixed-axis-pointer": shownPointer, x1: pointerX, x2: pointerX, y1: PLOT2.y, y2: PLOT_BOTTOM2, stroke: pointerStyle.color ?? "var(--sia-color-primary)", strokeWidth: pointerWidth, strokeDasharray: pointerStyle.lineStyle === "dashed" ? "5 4" : pointerStyle.lineStyle === "dotted" ? "2 2" : void 0, pointerEvents: "none" }) : null,
7096
7120
  axisPointer && pointerStyle.linkedEmphasis && shownPointer != null && shownPointer >= 0 && shownPointer < categories.length ? activeSeries.filter((item) => item.type === "line" && item.showPoints !== false && (item.categoryAxisIndex ?? 0) === pointerAxisIndex).map((item) => {
7097
7121
  const placement = layout.rows[activeSeries.indexOf(item)]?.[shownPointer];
7098
7122
  if (!placement) return null;
7099
7123
  const range = axisDomains?.[item.valueAxisIndex ?? 0] ?? domain, color = getColor(series.indexOf(item), item.color, palette);
7100
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { "data-mixed-axis-emphasis": item.name, cx: categoryAt(shownPointer), cy: linearScale(placement.end, [range[0], range[1]], [PLOT_BOTTOM2, PLOT2.y]), r: Math.max(0, item.symbolSize ?? 9) / 2, fill: item.hollowSymbol ? "#fff" : color, stroke: item.hollowSymbol ? color : "var(--sia-color-surface)", strokeWidth: 4, pointerEvents: "none" }, item.name);
7124
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { "data-mixed-axis-emphasis": item.name, cx: categoryAt(shownPointer), cy: linearScale(placement.end, [range[0], range[1]], [PLOT_BOTTOM2, PLOT2.y]), r: Math.max(0, item.symbolSize ?? 9) / 2, fill: item.hollowSymbol ? "#fff" : color, stroke: item.hollowSymbol ? color : "var(--sia-color-surface)", strokeWidth: 4, pointerEvents: "none" }, item.name);
7101
7125
  }) : null,
7102
7126
  clipPlot ? activeSeries.map((item) => {
7103
7127
  if (!item.markAverage || item.showMarkLabel === false) return null;
@@ -7107,27 +7131,27 @@ var MixedChart = (0, import_react34.forwardRef)(function MixedChart2({ axisPoint
7107
7131
  const range = axisDomains?.[item.valueAxisIndex ?? 0] ?? domain;
7108
7132
  if (average < range[0] || average > range[1]) return null;
7109
7133
  const y = linearScale(average, [range[0], range[1]], [PLOT_BOTTOM2, PLOT2.y]);
7110
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { "data-mixed-average-label": item.name, x: PLOT2.x - 8, y: y + 4, textAnchor: "end", fontSize: 12, fill: item.markColor ?? getColor(series.indexOf(item), item.color, palette), children: item.markFormatter ? item.markFormatter(average) : Number(average.toFixed(2)) }, item.name);
7134
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { "data-mixed-average-label": item.name, x: PLOT2.x - 8, y: y + 4, textAnchor: "end", fontSize: 12, fill: item.markColor ?? getColor(series.indexOf(item), item.color, palette), children: item.markFormatter ? item.markFormatter(average) : Number(average.toFixed(2)) }, item.name);
7111
7135
  }) : null,
7112
- calculable ? islands.map((island, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ChartMark, { ...dragProps(-1, index), label: `\u5B64\u5C9B ${island.name} ${island.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
7136
+ calculable ? islands.map((island, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartMark, { ...dragProps(-1, index), label: `\u5B64\u5C9B ${island.name} ${island.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7113
7137
  island.seriesName,
7114
7138
  " / ",
7115
7139
  island.name,
7116
7140
  "\uFF1A",
7117
7141
  island.value
7118
7142
  ] }), onPointerUp: finishDrag, children: [
7119
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: island.x, cy: island.y, r: 20, fill: "#fff", stroke: "#2ec7c9", strokeWidth: 2 }),
7120
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("text", { x: island.x, y: island.y + 4, textAnchor: "middle", style: { fontSize: 11 }, children: island.value })
7143
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: island.x, cy: island.y, r: 20, fill: "#fff", stroke: "#2ec7c9", strokeWidth: 2 }),
7144
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("text", { x: island.x, y: island.y + 4, textAnchor: "middle", style: { fontSize: 11 }, children: island.value })
7121
7145
  ] }, `island-${index}`)) : null
7122
7146
  ] });
7123
7147
  });
7124
7148
  var KLineChart = CandlestickChart;
7125
7149
 
7126
7150
  // src/components/LineShareChart.tsx
7127
- var import_jsx_runtime33 = require("react/jsx-runtime");
7128
- var LineShareChart = (0, import_react36.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
7129
- const [selected, setSelected] = (0, import_react36.useState)(null);
7130
- const [maskHovered, setMaskHovered] = (0, import_react36.useState)(false);
7151
+ var import_jsx_runtime34 = require("react/jsx-runtime");
7152
+ var LineShareChart = (0, import_react37.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
7153
+ const [selected, setSelected] = (0, import_react37.useState)(null);
7154
+ const [maskHovered, setMaskHovered] = (0, import_react37.useState)(false);
7131
7155
  const width = props.viewBoxSize?.[0] ?? 900, height = props.viewBoxSize?.[1] ?? 450;
7132
7156
  const total = data.reduce((sum, item2) => sum + item2.value, 0), gap = data.length ? Math.round(Math.max(...data.map((item2) => item2.value)) - Math.min(...data.map((item2) => item2.value))) : 0;
7133
7157
  const maximum = data.reduce((best, item2, i) => item2.value >= data[best].value ? i : best, 0);
@@ -7138,53 +7162,53 @@ var LineShareChart = (0, import_react36.forwardRef)(function LineShareChart2({ d
7138
7162
  const path = linePath(points, "smooth"), center = [width / 2, height / 2];
7139
7163
  const ratio = item && total ? item.value / total : 0, angle = ratio * Math.PI * 2;
7140
7164
  const percent = Number((ratio * 100).toFixed(2));
7141
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SiaChart, { ...props, ref, width, height, viewBoxSize: [width, height], animation: false, empty: !data.length, children: [
7142
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartLegend, { x: 10, y: 20, align: "start", orientation: "vertical", items: [{ name: "\u9500\u91CF", color: lineColor }, { name: "\u5360\u6BD4", color: shareColor }] }),
7143
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x: left, y: top, width: right - left, height: bottom - top, fill: "#ccc" }),
7144
- points.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7145
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: `${path} L ${right} ${bottom} L ${left} ${bottom} Z`, fill: lineColor, fillOpacity: 0.5 }),
7146
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: path, fill: "none", stroke: lineColor, strokeWidth: 2 })
7165
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(SiaChart, { ...props, ref, width, height, viewBoxSize: [width, height], animation: false, empty: !data.length, children: [
7166
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChartLegend, { x: 10, y: 20, align: "start", orientation: "vertical", items: [{ name: "\u9500\u91CF", color: lineColor }, { name: "\u5360\u6BD4", color: shareColor }] }),
7167
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("rect", { x: left, y: top, width: right - left, height: bottom - top, fill: "#ccc" }),
7168
+ points.length ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7169
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: `${path} L ${right} ${bottom} L ${left} ${bottom} Z`, fill: lineColor, fillOpacity: 0.5 }),
7170
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: path, fill: "none", stroke: lineColor, strokeWidth: 2 })
7147
7171
  ] }) : null,
7148
7172
  data.map((datum, i) => {
7149
7173
  const point = points[i + 1];
7150
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { label: `\u9500\u91CF\uFF0C${datum.name}\uFF0C${display[i]}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7151
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("strong", { children: "\u9500\u91CF" }),
7152
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
7174
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChartMark, { label: `\u9500\u91CF\uFF0C${datum.name}\uFF0C${display[i]}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7175
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("strong", { children: "\u9500\u91CF" }),
7176
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { children: [
7153
7177
  datum.name,
7154
7178
  " : ",
7155
7179
  display[i]
7156
7180
  ] })
7157
- ] }), tooltipPoint: point, onPointerMove: () => setSelected(i), onFocus: () => setSelected(i), children: i === active ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { "data-share-active": datum.name, d: `M ${point[0]} ${point[1] - 10} l 10 10 -10 10 -10 -10 Z`, fill: "#fff", stroke: lineColor, strokeWidth: 2 }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: point[0], cy: point[1], r: 6, fill: "#fff", stroke: lineColor, strokeWidth: 2 }) }, datum.name);
7181
+ ] }), tooltipPoint: point, onPointerMove: () => setSelected(i), onFocus: () => setSelected(i), children: i === active ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { "data-share-active": datum.name, d: `M ${point[0]} ${point[1] - 10} l 10 10 -10 10 -10 -10 Z`, fill: "#fff", stroke: lineColor, strokeWidth: 2 }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: point[0], cy: point[1], r: 6, fill: "#fff", stroke: lineColor, strokeWidth: 2 }) }, datum.name);
7158
7182
  }),
7159
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { "data-share-mask": "", d: svgArcPath(center[0], center[1], 180, 0, Math.PI * 2, 100), fill: maskHovered ? "rgba(0,0,0,0)" : "#fff", pointerEvents: "all", onPointerEnter: () => setMaskHovered(true), onPointerLeave: () => setMaskHovered(false) }),
7160
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: svgArcPath(center[0], center[1], 125, 0, Math.PI * 2, 110), fill: "#fff", pointerEvents: "none" }),
7161
- item ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7162
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartMark, { label: `\u5360\u6BD4\uFF0C${item.name}\uFF0C${item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7163
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
7183
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { "data-share-mask": "", d: svgArcPath(center[0], center[1], 180, 0, Math.PI * 2, 100), fill: maskHovered ? "rgba(0,0,0,0)" : "#fff", pointerEvents: "all", onPointerEnter: () => setMaskHovered(true), onPointerLeave: () => setMaskHovered(false) }),
7184
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: svgArcPath(center[0], center[1], 125, 0, Math.PI * 2, 110), fill: "#fff", pointerEvents: "none" }),
7185
+ item ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7186
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChartMark, { label: `\u5360\u6BD4\uFF0C${item.name}\uFF0C${item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7187
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { children: [
7164
7188
  "\u603B\u91CF : ",
7165
7189
  total
7166
7190
  ] }),
7167
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
7191
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { children: [
7168
7192
  item.name,
7169
7193
  " : ",
7170
7194
  item.value
7171
7195
  ] }),
7172
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { children: [
7196
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { children: [
7173
7197
  "\u5360\u6BD4 : ",
7174
7198
  percent,
7175
7199
  "%"
7176
7200
  ] })
7177
- ] }), tooltipPoint: [center[0], center[1] + 120], children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChartPointMotion, { points: [[0, angle]], enabled: props.animation !== false, animateInitial: false, duration: 0, updateDuration: 500, children: (frame) => {
7201
+ ] }), tooltipPoint: [center[0], center[1] + 120], children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChartPointMotion, { points: [[0, angle]], enabled: props.animation !== false, animateInitial: false, duration: 0, updateDuration: 500, children: (frame) => {
7178
7202
  const shownAngle = frame[0]?.[1] ?? angle;
7179
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { "data-share-ring": "", "data-share-angle": shownAngle, d: svgArcPath(center[0], center[1], 125, Math.PI / 2 - shownAngle / 2, Math.PI / 2 + shownAngle / 2, 110), fill: shareColor });
7203
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { "data-share-ring": "", "data-share-angle": shownAngle, d: svgArcPath(center[0], center[1], 125, Math.PI / 2 - shownAngle / 2, Math.PI / 2 + shownAngle / 2, 110), fill: shareColor });
7180
7204
  } }) }),
7181
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("text", { "data-share-label": "", x: center[0], y: center[1] + 145, textAnchor: "middle", fontSize: 15, fill: "#1e90ff", pointerEvents: "none", children: [
7182
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("tspan", { x: center[0], children: [
7205
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("text", { "data-share-label": "", x: center[0], y: center[1] + 145, textAnchor: "middle", fontSize: 15, fill: "#1e90ff", pointerEvents: "none", children: [
7206
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("tspan", { x: center[0], children: [
7183
7207
  item.name,
7184
7208
  " : ",
7185
7209
  item.value
7186
7210
  ] }),
7187
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("tspan", { x: center[0], dy: 26, children: [
7211
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("tspan", { x: center[0], dy: 26, children: [
7188
7212
  "( ",
7189
7213
  percent,
7190
7214
  "% )"
@@ -7205,16 +7229,16 @@ function paddedValueExtent(values, padding = 0.05) {
7205
7229
  }
7206
7230
 
7207
7231
  // src/components/XYChart.tsx
7208
- var import_react37 = require("react");
7209
- var import_jsx_runtime34 = require("react/jsx-runtime");
7210
- var XYChart = (0, import_react37.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
7211
- const [series, setSeries] = (0, import_react37.useState)(source);
7212
- const [hidden, setHidden] = (0, import_react37.useState)([]);
7213
- const [crosshair, setCrosshair] = (0, import_react37.useState)();
7214
- const [drag, setDrag] = (0, import_react37.useState)();
7215
- const [geometry, setGeometry] = (0, import_react37.useState)();
7216
- const [zoom, setZoom] = (0, import_react37.useState)(defaultZoom);
7217
- (0, import_react37.useEffect)(() => setSeries(source), [source]);
7232
+ var import_react38 = require("react");
7233
+ var import_jsx_runtime35 = require("react/jsx-runtime");
7234
+ var XYChart = (0, import_react38.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
7235
+ const [series, setSeries] = (0, import_react38.useState)(source);
7236
+ const [hidden, setHidden] = (0, import_react38.useState)([]);
7237
+ const [crosshair, setCrosshair] = (0, import_react38.useState)();
7238
+ const [drag, setDrag] = (0, import_react38.useState)();
7239
+ const [geometry, setGeometry] = (0, import_react38.useState)();
7240
+ const [zoom, setZoom] = (0, import_react38.useState)(defaultZoom);
7241
+ (0, import_react38.useEffect)(() => setSeries(source), [source]);
7218
7242
  const window2 = dataZoom || xAxisType === "time" ? scatterValueWindow(series.flatMap((item) => item.data.map((point) => point[0])), dataZoom ? zoom : [0, 100]) : void 0;
7219
7243
  const active = series.filter((item) => !hidden.includes(item.name)).map((item) => ({ ...item, data: window2 ? item.data.filter((point) => point[0] >= window2[0] && point[0] <= window2[1]) : item.data }));
7220
7244
  const width = props.viewBoxSize?.[0] ?? 663, height = props.viewBoxSize?.[1] ?? 379;
@@ -7234,7 +7258,7 @@ var XYChart = (0, import_react37.forwardRef)(function XYChart2({ series: source,
7234
7258
  const point = new DOMPoint(event.clientX, event.clientY).matrixTransform(matrix.inverse());
7235
7259
  return [Math.max(plot.left, Math.min(plot.right, point.x)), Math.max(plot.top, Math.min(plot.bottom, point.y))];
7236
7260
  }
7237
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(SiaChart, { ...props, ref, width: props.width ?? width, height: props.height ?? height, viewBoxSize: [width, height], className: `sia-chart--macarons ${props.className ?? ""}`, toolbox: options ? {
7261
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(SiaChart, { ...props, ref, width: props.width ?? width, height: props.height ?? height, viewBoxSize: [width, height], className: `sia-chart--macarons ${props.className ?? ""}`, toolbox: options ? {
7238
7262
  ...options,
7239
7263
  activeMagicType: geometry ?? source[0]?.geometry ?? "line",
7240
7264
  onMagicTypeChange: (type) => {
@@ -7250,7 +7274,7 @@ var XYChart = (0, import_react37.forwardRef)(function XYChart2({ series: source,
7250
7274
  onZoomChange?.(defaultZoom);
7251
7275
  options.onRestore?.();
7252
7276
  },
7253
- dataView: options.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChartDataEditor, { readOnly: options.dataViewReadOnly, series: series.map((item) => ({ name: `${item.name}\uFF08${item.data.some((point) => point.length === 3) ? "x,y,value" : "x,y"}\uFF09`, data: item.data.flatMap((point) => point.filter((value) => value !== void 0)) })), onApply: (values) => update(series.map((item, index) => {
7277
+ dataView: options.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChartDataEditor, { readOnly: options.dataViewReadOnly, series: series.map((item) => ({ name: `${item.name}\uFF08${item.data.some((point) => point.length === 3) ? "x,y,value" : "x,y"}\uFF09`, data: item.data.flatMap((point) => point.filter((value) => value !== void 0)) })), onApply: (values) => update(series.map((item, index) => {
7254
7278
  let offset = 0;
7255
7279
  return { ...item, data: item.data.map((point) => {
7256
7280
  const next = values[index].slice(offset, offset + point.length);
@@ -7259,37 +7283,37 @@ var XYChart = (0, import_react37.forwardRef)(function XYChart2({ series: source,
7259
7283
  }) };
7260
7284
  })) })
7261
7285
  } : void 0, children: [
7262
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChartLegend, { symbol: (geometry ?? source[0]?.geometry ?? "line") === "line" ? "line" : "rect", x: width / 2, y: 14, itemGap: 10, items: series.map((item, index) => ({ name: item.name, color: item.color ?? ["#2ec7c9", "#b6a2de"][index % 2], disabled: hidden.includes(item.name) })), onItemClick: (name) => setHidden((current) => current.includes(name) ? current.filter((item) => item !== name) : [...current, name]) }),
7263
- chartTicks(yd).map((value, index, ticks) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("g", { children: [
7264
- index < ticks.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("rect", { x: plot.left, y: sy(ticks[index + 1]), width: plot.right - plot.left, height: sy(value) - sy(ticks[index + 1]), fill: index % 2 ? "rgba(200,200,200,.1)" : "rgba(250,250,250,.1)" }) : null,
7265
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: plot.left, x2: plot.right, y1: sy(value), y2: sy(value), stroke: "#eee" }),
7266
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("text", { x: plot.left - 8, y: sy(value) + 4, textAnchor: "end", className: "sia-chart__axis-label", children: value })
7286
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChartLegend, { symbol: (geometry ?? source[0]?.geometry ?? "line") === "line" ? "line" : "rect", x: width / 2, y: 14, itemGap: 10, items: series.map((item, index) => ({ name: item.name, color: item.color ?? ["#2ec7c9", "#b6a2de"][index % 2], disabled: hidden.includes(item.name) })), onItemClick: (name) => setHidden((current) => current.includes(name) ? current.filter((item) => item !== name) : [...current, name]) }),
7287
+ chartTicks(yd).map((value, index, ticks) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("g", { children: [
7288
+ index < ticks.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("rect", { x: plot.left, y: sy(ticks[index + 1]), width: plot.right - plot.left, height: sy(value) - sy(ticks[index + 1]), fill: index % 2 ? "rgba(200,200,200,.1)" : "rgba(250,250,250,.1)" }) : null,
7289
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("line", { x1: plot.left, x2: plot.right, y1: sy(value), y2: sy(value), stroke: "#eee" }),
7290
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("text", { x: plot.left - 8, y: sy(value) + 4, textAnchor: "end", className: "sia-chart__axis-label", children: value })
7267
7291
  ] }, value)),
7268
- (xAxisType === "time" ? chartTimeTicks([xd[0], xd[1]], 10) : chartTicks(xd)).map((value, index, ticks) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("g", { children: [
7269
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: sx(value), x2: sx(value), y1: plot.top, y2: plot.bottom, stroke: "#eee" }),
7270
- xAxisType !== "time" || index === 0 || index === ticks.length - 1 || index % 2 === 0 && index < ticks.length - 2 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("text", { x: sx(value), y: plot.bottom + 19, textAnchor: "middle", className: "sia-chart__axis-label", children: xFormatter ? xFormatter(value) : xAxisType === "time" ? new Date(value).toLocaleDateString() : value }) : null
7292
+ (xAxisType === "time" ? chartTimeTicks([xd[0], xd[1]], 10) : chartTicks(xd)).map((value, index, ticks) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("g", { children: [
7293
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("line", { x1: sx(value), x2: sx(value), y1: plot.top, y2: plot.bottom, stroke: "#eee" }),
7294
+ xAxisType !== "time" || index === 0 || index === ticks.length - 1 || index % 2 === 0 && index < ticks.length - 2 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("text", { x: sx(value), y: plot.bottom + 19, textAnchor: "middle", className: "sia-chart__axis-label", children: xFormatter ? xFormatter(value) : xAxisType === "time" ? new Date(value).toLocaleDateString() : value }) : null
7271
7295
  ] }, value)),
7272
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: plot.left, x2: plot.left, y1: plot.top, y2: plot.bottom, stroke: "#dc143c", strokeWidth: 2 }),
7273
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: plot.left, x2: plot.right, y1: plot.bottom, y2: plot.bottom, stroke: "#008acd", strokeWidth: 2 }),
7274
- crosshair ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("g", { pointerEvents: "none", stroke: "#999", strokeDasharray: "5 5", children: [
7275
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: crosshair[0], x2: crosshair[0], y1: plot.top, y2: plot.bottom }),
7276
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: plot.left, x2: plot.right, y1: crosshair[1], y2: crosshair[1] })
7296
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("line", { x1: plot.left, x2: plot.left, y1: plot.top, y2: plot.bottom, stroke: "#dc143c", strokeWidth: 2 }),
7297
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("line", { x1: plot.left, x2: plot.right, y1: plot.bottom, y2: plot.bottom, stroke: "#008acd", strokeWidth: 2 }),
7298
+ crosshair ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("g", { pointerEvents: "none", stroke: "#999", strokeDasharray: "5 5", children: [
7299
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("line", { x1: crosshair[0], x2: crosshair[0], y1: plot.top, y2: plot.bottom }),
7300
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("line", { x1: plot.left, x2: plot.right, y1: crosshair[1], y2: crosshair[1] })
7277
7301
  ] }) : null,
7278
7302
  active.map((item) => {
7279
7303
  const seriesIndex = series.findIndex((candidate) => candidate.name === item.name), color = item.color ?? ["#2ec7c9", "#b6a2de"][seriesIndex % 2];
7280
7304
  const shape = geometry ?? item.geometry ?? "line";
7281
7305
  const points = item.data.map((point) => [sx(point[0]), sy(point[1])]);
7282
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("g", { children: [
7283
- shape === "line" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChartPointMotion, { points, enabled: props.animation !== false && !drag, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (frame) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: linePath(frame, item.curve ?? "smooth"), fill: "none", stroke: color, strokeWidth: 2 }) }) : null,
7306
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("g", { children: [
7307
+ shape === "line" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChartPointMotion, { points, enabled: props.animation !== false && !drag, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (frame) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: linePath(frame, item.curve ?? "smooth"), fill: "none", stroke: color, strokeWidth: 2 }) }) : null,
7284
7308
  points.map((point, index) => {
7285
7309
  const datum = item.data[index];
7286
7310
  const dataIndex = series[seriesIndex].data.indexOf(datum);
7287
7311
  const horizontal = shape === "bar" && item.barOrientation === "horizontal";
7288
7312
  const origin = shape === "line" ? [point[0], points[0][1]] : horizontal ? [sx(0), point[1]] : [point[0], sy(0)];
7289
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChartPointMotion, { points: [origin, point], horizontal, enabled: props.animation !== false && !drag, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (frame) => {
7313
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChartPointMotion, { points: [origin, point], horizontal, enabled: props.animation !== false && !drag, duration: props.animationDuration ?? 2e3, progress: animationProgress, children: (frame) => {
7290
7314
  const end = frame[1];
7291
7315
  const size = item.barSize ?? 10;
7292
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChartMark, { label: `${item.name}\uFF0C[${datum.join("\uFF0C")}]`, tooltip: tooltipFormatter ? tooltipFormatter(datum, item) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7316
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChartMark, { label: `${item.name}\uFF0C[${datum.join("\uFF0C")}]`, tooltip: tooltipFormatter ? tooltipFormatter(datum, item) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
7293
7317
  item.name,
7294
7318
  "\uFF1A[ ",
7295
7319
  datum.join(", "),
@@ -7311,7 +7335,7 @@ var XYChart = (0, import_react37.forwardRef)(function XYChart2({ series: source,
7311
7335
  }, onPointerUp: (event) => {
7312
7336
  if (drag) event.currentTarget.releasePointerCapture(event.pointerId);
7313
7337
  setDrag(void 0);
7314
- }, onPointerCancel: () => setDrag(void 0), children: shape === "line" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: end[0], cy: end[1], r: Math.max(0, typeof item.symbolRadius === "function" ? item.symbolRadius(datum) : item.symbolRadius ?? 3), fill: "#fff", stroke: color, strokeWidth: 2 }) : horizontal ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("rect", { x: Math.min(origin[0], end[0]), y: end[1] - size / 2, width: Math.abs(end[0] - origin[0]), height: size, fill: color, rx: 5 }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("rect", { x: end[0] - size / 2, y: Math.min(origin[1], end[1]), width: size, height: Math.abs(end[1] - origin[1]), fill: color, rx: 5 }) });
7338
+ }, onPointerCancel: () => setDrag(void 0), children: shape === "line" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("circle", { cx: end[0], cy: end[1], r: Math.max(0, typeof item.symbolRadius === "function" ? item.symbolRadius(datum) : item.symbolRadius ?? 3), fill: "#fff", stroke: color, strokeWidth: 2 }) : horizontal ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("rect", { x: Math.min(origin[0], end[0]), y: end[1] - size / 2, width: Math.abs(end[0] - origin[0]), height: size, fill: color, rx: 5 }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("rect", { x: end[0] - size / 2, y: Math.min(origin[1], end[1]), width: size, height: Math.abs(end[1] - origin[1]), fill: color, rx: 5 }) });
7315
7339
  } }, index);
7316
7340
  }),
7317
7341
  item.statistics && item.data.length > 0 ? [0, 1].flatMap((axis) => {
@@ -7321,21 +7345,21 @@ var XYChart = (0, import_react37.forwardRef)(function XYChart2({ series: source,
7321
7345
  return stats.map((value, stat) => {
7322
7346
  const coordinate = axis === 0 ? sx(value) : sy(value);
7323
7347
  const point = item.data[values.indexOf(value)];
7324
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("g", { style: { color: color2 }, className: "sia-chart__mark-line", children: [
7325
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: axis === 0 ? coordinate : plot.left, x2: axis === 0 ? coordinate : plot.right, y1: axis === 0 ? plot.top : coordinate, y2: axis === 0 ? plot.bottom : coordinate, stroke: color2 }),
7326
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: axis === 0 ? coordinate : plot.left, cy: axis === 0 ? plot.bottom : coordinate, r: 2, fill: color2 }),
7327
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: axis === 0 ? `M ${coordinate - 5} ${plot.top + 7} L ${coordinate} ${plot.top - 3} L ${coordinate + 5} ${plot.top + 7} L ${coordinate} ${plot.top + 4} Z` : `M ${plot.right - 5} ${coordinate - 5} L ${plot.right + 5} ${coordinate} L ${plot.right - 5} ${coordinate + 5} L ${plot.right - 2} ${coordinate} Z`, fill: color2 }),
7328
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("text", { x: axis === 0 ? coordinate : plot.right + 5, y: axis === 0 ? plot.top - 8 : coordinate + 4, textAnchor: axis === 0 ? "middle" : "start", children: Number(value.toFixed(2)) }),
7329
- point && stat !== 1 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7330
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: sx(point[0]), cy: sy(point[1]), r: 10, fill: "none", stroke: color2, strokeWidth: 2 }),
7331
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("text", { x: sx(point[0]) + (axis === 0 ? stat === 0 ? -15 : 15 : 0), y: sy(point[1]) + (axis === 0 ? 4 : stat === 0 ? 22 : -17), textAnchor: axis === 0 ? stat === 0 ? "end" : "start" : "middle", children: value })
7348
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("g", { style: { color: color2 }, className: "sia-chart__mark-line", children: [
7349
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("line", { x1: axis === 0 ? coordinate : plot.left, x2: axis === 0 ? coordinate : plot.right, y1: axis === 0 ? plot.top : coordinate, y2: axis === 0 ? plot.bottom : coordinate, stroke: color2 }),
7350
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("circle", { cx: axis === 0 ? coordinate : plot.left, cy: axis === 0 ? plot.bottom : coordinate, r: 2, fill: color2 }),
7351
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: axis === 0 ? `M ${coordinate - 5} ${plot.top + 7} L ${coordinate} ${plot.top - 3} L ${coordinate + 5} ${plot.top + 7} L ${coordinate} ${plot.top + 4} Z` : `M ${plot.right - 5} ${coordinate - 5} L ${plot.right + 5} ${coordinate} L ${plot.right - 5} ${coordinate + 5} L ${plot.right - 2} ${coordinate} Z`, fill: color2 }),
7352
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("text", { x: axis === 0 ? coordinate : plot.right + 5, y: axis === 0 ? plot.top - 8 : coordinate + 4, textAnchor: axis === 0 ? "middle" : "start", children: Number(value.toFixed(2)) }),
7353
+ point && stat !== 1 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
7354
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("circle", { cx: sx(point[0]), cy: sy(point[1]), r: 10, fill: "none", stroke: color2, strokeWidth: 2 }),
7355
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("text", { x: sx(point[0]) + (axis === 0 ? stat === 0 ? -15 : 15 : 0), y: sy(point[1]) + (axis === 0 ? 4 : stat === 0 ? 22 : -17), textAnchor: axis === 0 ? stat === 0 ? "end" : "start" : "middle", children: value })
7332
7356
  ] }) : null
7333
7357
  ] }, `${axis}-${stat}`);
7334
7358
  });
7335
7359
  }) : null
7336
7360
  ] }, item.name);
7337
7361
  }),
7338
- dataZoom ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("foreignObject", { className: "sia-chart__inline-zoom", x: plot.left, y: plot.bottom + 35, width: plot.right - plot.left, height: 30, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChartDataZoom, { value: zoom, dataShadow: series[0]?.data.map((point) => point[1]), onChange: (value) => {
7362
+ dataZoom ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("foreignObject", { className: "sia-chart__inline-zoom", x: plot.left, y: plot.bottom + 35, width: plot.right - plot.left, height: 30, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChartDataZoom, { value: zoom, dataShadow: series[0]?.data.map((point) => point[1]), onChange: (value) => {
7339
7363
  setZoom(value);
7340
7364
  onZoomChange?.(value);
7341
7365
  } }) }) : null
@@ -7343,7 +7367,7 @@ var XYChart = (0, import_react37.forwardRef)(function XYChart2({ series: source,
7343
7367
  });
7344
7368
 
7345
7369
  // src/components/ChartMapOverlay.tsx
7346
- var import_react38 = require("react");
7370
+ var import_react39 = require("react");
7347
7371
 
7348
7372
  // src/components/mapOverlayHost.ts
7349
7373
  function observeMapOverlayHost(host, onChange) {
@@ -7380,13 +7404,13 @@ function observeMapOverlayHost(host, onChange) {
7380
7404
  }
7381
7405
 
7382
7406
  // src/components/ChartMapOverlay.tsx
7383
- var import_jsx_runtime35 = require("react/jsx-runtime");
7407
+ var import_jsx_runtime36 = require("react/jsx-runtime");
7384
7408
  function ChartMapOverlay({ createHost, children, className, style, ariaLabel = "\u5730\u56FE\u53E0\u52A0\u56FE\u8868", onError }) {
7385
- const container = (0, import_react38.useRef)(null);
7386
- const errorHandler = (0, import_react38.useRef)(onError);
7409
+ const container = (0, import_react39.useRef)(null);
7410
+ const errorHandler = (0, import_react39.useRef)(onError);
7387
7411
  errorHandler.current = onError;
7388
- const [snapshot, setSnapshot] = (0, import_react38.useState)();
7389
- (0, import_react38.useEffect)(() => {
7412
+ const [snapshot, setSnapshot] = (0, import_react39.useState)();
7413
+ (0, import_react39.useEffect)(() => {
7390
7414
  setSnapshot(void 0);
7391
7415
  if (!container.current) return;
7392
7416
  try {
@@ -7395,9 +7419,9 @@ function ChartMapOverlay({ createHost, children, className, style, ariaLabel = "
7395
7419
  errorHandler.current?.(error);
7396
7420
  }
7397
7421
  }, [createHost]);
7398
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className, "aria-label": ariaLabel, style: { position: "relative", width: "100%", height: 500, ...style }, children: [
7399
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { ref: container, "data-map-overlay-host": true, style: { position: "absolute", inset: 0 } }),
7400
- snapshot ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { "data-map-overlay-content": true, style: { position: "absolute", left: 0, top: 0, width: snapshot.width, height: snapshot.height, pointerEvents: "none" }, children: children(snapshot) }) : null
7422
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className, "aria-label": ariaLabel, style: { position: "relative", width: "100%", height: 500, ...style }, children: [
7423
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { ref: container, "data-map-overlay-host": true, style: { position: "absolute", inset: 0 } }),
7424
+ snapshot ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { "data-map-overlay-content": true, style: { position: "absolute", left: 0, top: 0, width: snapshot.width, height: snapshot.height, pointerEvents: "none" }, children: children(snapshot) }) : null
7401
7425
  ] });
7402
7426
  }
7403
7427