vvplot 0.5.1 → 0.5.3

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.
@@ -1957,6 +1957,16 @@ const numutils = {
1957
1957
  if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
1958
1958
  return Array.from(arr).reduce((a, b) => a > b ? a : b, -Infinity);
1959
1959
  },
1960
+ sum(arr, { na_rm = true, infinity_rm = true } = {}) {
1961
+ if (na_rm) arr = arr.filter(is_continuous);
1962
+ if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
1963
+ return Array.from(arr).reduce((a, b) => a + b, 0);
1964
+ },
1965
+ diff(arr, { na_rm = true, infinity_rm = true } = {}) {
1966
+ if (na_rm) arr = arr.filter(is_continuous);
1967
+ if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
1968
+ return Array.from(arr).slice(1).map((v, i) => v - arr[i]);
1969
+ },
1960
1970
  mean(arr, { na_rm = true, infinity_rm = true } = {}) {
1961
1971
  if (na_rm) arr = arr.filter(is_continuous);
1962
1972
  if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
@@ -1988,6 +1998,14 @@ const numutils = {
1988
1998
  }
1989
1999
  };
1990
2000
  const vecutils = {
2001
+ coalesce(value, defaultValue) {
2002
+ if (Array.isArray(defaultValue)) {
2003
+ if (!Array.isArray(value) || value.length != defaultValue.length) throw new Error("Value and defaultValue must be arrays of the same length");
2004
+ return value.map((v, i) => v == null ? defaultValue[i] : v);
2005
+ }
2006
+ if (Array.isArray(value)) return value.map((v) => v ?? defaultValue);
2007
+ return value ?? defaultValue;
2008
+ },
1991
2009
  /* vectorized summation of numbers */
1992
2010
  sum(...values) {
1993
2011
  if (values.some((x2) => x2 == null)) return null;
@@ -1997,12 +2015,10 @@ const vecutils = {
1997
2015
  values = values.filter((x2) => Array.isArray(x2));
1998
2016
  if (values.length == 0)
1999
2017
  return [nums];
2000
- if (values.some((v) => v.length == 0))
2001
- return [];
2002
2018
  let length = values[0].length;
2003
2019
  if (values.some((v) => v.length != length))
2004
2020
  throw new Error("Arrays must have the same length");
2005
- return Array.from({ length }, (_, i) => values.reduce((s, a) => +(a[i] ?? 0) + s, nums));
2021
+ return Array.from({ length }, (_, i) => values.reduce((s, a) => +(a[i] ?? void 0) + s, nums));
2006
2022
  },
2007
2023
  /* vectorized opposite of numbers */
2008
2024
  opposite(value) {
@@ -2256,7 +2272,7 @@ const theme_base = {
2256
2272
  },
2257
2273
  axis_v: {
2258
2274
  title_offset: 30,
2259
- title_angle: 90
2275
+ title_angle: -90
2260
2276
  },
2261
2277
  axis_left: {
2262
2278
  tick_position: "left",
@@ -2342,7 +2358,8 @@ const theme_classic = {
2342
2358
  line_color: "black",
2343
2359
  tick_color: "black",
2344
2360
  label_color: "black",
2345
- title_color: "black"
2361
+ title_color: "black",
2362
+ grid_color: null
2346
2363
  }
2347
2364
  };
2348
2365
  const theme_void = {
@@ -2463,11 +2480,11 @@ const blank$1 = {
2463
2480
  return null;
2464
2481
  }
2465
2482
  };
2466
- let psum$a = vecutils.sum;
2483
+ let { sum: psum$a, coalesce: coalesce$a } = vecutils;
2467
2484
  const boxplot$1 = {
2468
2485
  scale_attrs: ["fill", "color", "linewidth", "linetype", "alpha"],
2469
2486
  coord_scale(ds, levels) {
2470
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0;
2487
+ let xnudge = coalesce$a(ds.xnudge, 0), ynudge = coalesce$a(ds.ynudge, 0);
2471
2488
  if (ds.x) {
2472
2489
  let x2 = psum$a(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), xmin = psum$a(x2, ds.width?.map?.((x3) => -x3 / 2) ?? -0.5), xmax = psum$a(x2, ds.width?.map?.((x3) => +x3 / 2) ?? 0.5), lwisker = psum$a(ds.lwisker, ynudge), Q1 = psum$a(ds.Q1, ynudge), median = psum$a(ds.median, ynudge), Q3 = psum$a(ds.Q3, ynudge), uwisker = psum$a(ds.uwisker, ynudge), outliers = vecutils.apply(
2473
2490
  ($x, { y: ys, $raw }, nudge) => psum$a(ys, nudge).map(($y, i) => ({ x: $x, y: $y, $raw: $raw[i] })),
@@ -2542,12 +2559,12 @@ const curve$1 = {
2542
2559
  return d;
2543
2560
  }
2544
2561
  };
2545
- let psum$9 = vecutils.sum;
2562
+ let { sum: psum$9, coalesce: coalesce$9 } = vecutils;
2546
2563
  const ellipse$1 = {
2547
2564
  scale_attrs: ["fill", "color", "linewidth", "linetype", "alpha"],
2548
2565
  coord_scale(ds, levels) {
2549
2566
  let { A, B, C } = ds;
2550
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0, cx = psum$9(levels.x?.apply?.(ds.cx) ?? ds.cx, xnudge), cy = psum$9(levels.y?.apply?.(ds.cy) ?? ds.cy, ynudge);
2567
+ let xnudge = coalesce$9(ds.xnudge, 0), ynudge = coalesce$9(ds.ynudge, 0), cx = psum$9(levels.x?.apply?.(ds.cx) ?? ds.cx, xnudge), cy = psum$9(levels.y?.apply?.(ds.cy) ?? ds.cy, ynudge);
2551
2568
  return { cx, cy, A, B, C };
2552
2569
  },
2553
2570
  get_range(ds, orientation) {
@@ -2565,11 +2582,11 @@ const ellipse$1 = {
2565
2582
  return d;
2566
2583
  }
2567
2584
  };
2568
- let psum$8 = vecutils.sum;
2585
+ let { sum: psum$8, coalesce: coalesce$8 } = vecutils;
2569
2586
  const line$2 = {
2570
2587
  scale_attrs: ["color", "linewidth", "linetype", "alpha"],
2571
2588
  coord_scale(ds, levels) {
2572
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0, x2 = psum$8(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$8(levels.y?.apply?.(ds.y) ?? ds.y, ynudge), xend = psum$8(levels.x?.apply?.(ds.xend) ?? ds.xend, xnudge), yend = psum$8(levels.y?.apply?.(ds.yend) ?? ds.yend, ynudge);
2589
+ let xnudge = coalesce$8(ds.xnudge, 0), ynudge = coalesce$8(ds.ynudge, 0), x2 = psum$8(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$8(levels.y?.apply?.(ds.y) ?? ds.y, ynudge), xend = psum$8(levels.x?.apply?.(ds.xend) ?? ds.xend, xnudge), yend = psum$8(levels.y?.apply?.(ds.yend) ?? ds.yend, ynudge);
2573
2590
  return { x: x2, y: y2, xend, yend };
2574
2591
  },
2575
2592
  get_range(ds, orientation) {
@@ -2581,11 +2598,11 @@ const line$2 = {
2581
2598
  return d;
2582
2599
  }
2583
2600
  };
2584
- let psum$7 = vecutils.sum;
2601
+ let { sum: psum$7, coalesce: coalesce$7 } = vecutils;
2585
2602
  const markdown = {
2586
2603
  scale_attrs: ["size", "color", "stroke", "linewidth", "linetype", "alpha"],
2587
2604
  coord_scale(ds, levels) {
2588
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0, x2 = psum$7(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$7(levels.y?.apply?.(ds.y) ?? ds.y, ynudge);
2605
+ let xnudge = coalesce$7(ds.xnudge, 0), ynudge = coalesce$7(ds.ynudge, 0), x2 = psum$7(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$7(levels.y?.apply?.(ds.y) ?? ds.y, ynudge);
2589
2606
  return { x: x2, y: y2 };
2590
2607
  },
2591
2608
  get_range(ds, orientation) {
@@ -2597,11 +2614,11 @@ const markdown = {
2597
2614
  return d;
2598
2615
  }
2599
2616
  };
2600
- let psum$6 = vecutils.sum;
2617
+ let { sum: psum$6, coalesce: coalesce$6 } = vecutils;
2601
2618
  const markdownsegment = {
2602
2619
  scale_attrs: ["size", "color", "stroke", "linewidth", "linetype", "alpha"],
2603
2620
  coord_scale(ds, levels) {
2604
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0, x2 = psum$6(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$6(levels.y?.apply?.(ds.y) ?? ds.y, ynudge), xend = psum$6(levels.x?.apply?.(ds.xend) ?? ds.xend, xnudge), yend = psum$6(levels.y?.apply?.(ds.yend) ?? ds.yend, ynudge);
2621
+ let xnudge = coalesce$6(ds.xnudge, 0), ynudge = coalesce$6(ds.ynudge, 0), x2 = psum$6(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$6(levels.y?.apply?.(ds.y) ?? ds.y, ynudge), xend = psum$6(levels.x?.apply?.(ds.xend) ?? ds.xend, xnudge), yend = psum$6(levels.y?.apply?.(ds.yend) ?? ds.yend, ynudge);
2605
2622
  return { x: x2, y: y2, xend, yend };
2606
2623
  },
2607
2624
  get_range(ds, orientation) {
@@ -2613,11 +2630,11 @@ const markdownsegment = {
2613
2630
  return d;
2614
2631
  }
2615
2632
  };
2616
- let psum$5 = vecutils.sum;
2633
+ let { sum: psum$5, coalesce: coalesce$5 } = vecutils;
2617
2634
  const point$3 = {
2618
2635
  scale_attrs: ["shape", "size", "color", "stroke", "linewidth", "linetype", "alpha"],
2619
2636
  coord_scale(ds, levels) {
2620
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0, x2 = psum$5(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$5(levels.y?.apply?.(ds.y) ?? ds.y, ynudge);
2637
+ let xnudge = coalesce$5(ds.xnudge, 0), ynudge = coalesce$5(ds.ynudge, 0), x2 = psum$5(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$5(levels.y?.apply?.(ds.y) ?? ds.y, ynudge);
2621
2638
  return { x: x2, y: y2 };
2622
2639
  },
2623
2640
  get_range(ds, orientation) {
@@ -2647,11 +2664,11 @@ const polygon$1 = {
2647
2664
  return d;
2648
2665
  }
2649
2666
  };
2650
- let psum$4 = vecutils.sum;
2667
+ let { sum: psum$4, coalesce: coalesce$4 } = vecutils;
2651
2668
  const rect$2 = {
2652
2669
  scale_attrs: ["fill", "color", "linewidth", "linetype", "alpha"],
2653
2670
  coord_scale(ds, levels) {
2654
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0, xmin = psum$4(levels.x?.apply?.(ds.xmin) ?? ds.xmin, xnudge), xmax = psum$4(levels.x?.apply?.(ds.xmax) ?? ds.xmax, xnudge), ymin = psum$4(levels.y?.apply?.(ds.ymin) ?? ds.ymin, ynudge), ymax = psum$4(levels.y?.apply?.(ds.ymax) ?? ds.ymax, ynudge);
2671
+ let xnudge = coalesce$4(ds.xnudge, 0), ynudge = coalesce$4(ds.ynudge, 0), xmin = psum$4(levels.x?.apply?.(ds.xmin) ?? ds.xmin, xnudge), xmax = psum$4(levels.x?.apply?.(ds.xmax) ?? ds.xmax, xnudge), ymin = psum$4(levels.y?.apply?.(ds.ymin) ?? ds.ymin, ynudge), ymax = psum$4(levels.y?.apply?.(ds.ymax) ?? ds.ymax, ynudge);
2655
2672
  return { xmin, xmax, ymin, ymax };
2656
2673
  },
2657
2674
  get_range(ds, orientation) {
@@ -2685,11 +2702,11 @@ const shape$1 = {
2685
2702
  return d;
2686
2703
  }
2687
2704
  };
2688
- let psum$3 = vecutils.sum;
2705
+ let { sum: psum$3, coalesce: coalesce$3 } = vecutils;
2689
2706
  const stick$1 = {
2690
2707
  scale_attrs: ["color", "linewidth", "linetype", "alpha"],
2691
2708
  coord_scale(ds, levels) {
2692
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0, x2 = psum$3(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$3(levels.y?.apply?.(ds.y) ?? ds.y, ynudge), xend = psum$3(x2, ds.dx), yend = psum$3(y2, ds.dy);
2709
+ let xnudge = coalesce$3(ds.xnudge, 0), ynudge = coalesce$3(ds.ynudge, 0), x2 = psum$3(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$3(levels.y?.apply?.(ds.y) ?? ds.y, ynudge), xend = psum$3(x2, ds.dx), yend = psum$3(y2, ds.dy);
2693
2710
  return { x: x2, y: y2, xend, yend };
2694
2711
  },
2695
2712
  get_values(ds, orientation) {
@@ -2705,11 +2722,11 @@ const stick$1 = {
2705
2722
  return d;
2706
2723
  }
2707
2724
  };
2708
- let psum$2 = vecutils.sum;
2725
+ let { sum: psum$2, coalesce: coalesce$2 } = vecutils;
2709
2726
  const text$3 = {
2710
2727
  scale_attrs: ["size", "color", "stroke", "linewidth", "linetype", "alpha"],
2711
2728
  coord_scale(ds, levels) {
2712
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0, x2 = psum$2(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$2(levels.y?.apply?.(ds.y) ?? ds.y, ynudge);
2729
+ let xnudge = coalesce$2(ds.xnudge, 0), ynudge = coalesce$2(ds.ynudge, 0), x2 = psum$2(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$2(levels.y?.apply?.(ds.y) ?? ds.y, ynudge);
2713
2730
  return { x: x2, y: y2 };
2714
2731
  },
2715
2732
  get_range(ds, orientation) {
@@ -2721,11 +2738,11 @@ const text$3 = {
2721
2738
  return d;
2722
2739
  }
2723
2740
  };
2724
- let psum$1 = vecutils.sum;
2741
+ let { sum: psum$1, coalesce: coalesce$1 } = vecutils;
2725
2742
  const textsegment$1 = {
2726
2743
  scale_attrs: ["size", "color", "stroke", "linewidth", "linetype", "alpha"],
2727
2744
  coord_scale(ds, levels) {
2728
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0, x2 = psum$1(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$1(levels.y?.apply?.(ds.y) ?? ds.y, ynudge), xend = psum$1(levels.x?.apply?.(ds.xend) ?? ds.xend, xnudge), yend = psum$1(levels.y?.apply?.(ds.yend) ?? ds.yend, ynudge);
2745
+ let xnudge = coalesce$1(ds.xnudge, 0), ynudge = coalesce$1(ds.ynudge, 0), x2 = psum$1(levels.x?.apply?.(ds.x) ?? ds.x, xnudge), y2 = psum$1(levels.y?.apply?.(ds.y) ?? ds.y, ynudge), xend = psum$1(levels.x?.apply?.(ds.xend) ?? ds.xend, xnudge), yend = psum$1(levels.y?.apply?.(ds.yend) ?? ds.yend, ynudge);
2729
2746
  return { x: x2, y: y2, xend, yend };
2730
2747
  },
2731
2748
  get_range(ds, orientation) {
@@ -2737,11 +2754,11 @@ const textsegment$1 = {
2737
2754
  return d;
2738
2755
  }
2739
2756
  };
2740
- let psum = vecutils.sum;
2757
+ let { sum: psum, coalesce } = vecutils;
2741
2758
  const tile$1 = {
2742
2759
  scale_attrs: ["fill", "color", "linewidth", "linetype", "alpha"],
2743
2760
  coord_scale(ds, levels) {
2744
- let xnudge = ds.xnudge ?? 0, ynudge = ds.ynudge ?? 0, x2 = levels.x?.apply?.(ds.x) ?? ds.x, y2 = levels.y?.apply?.(ds.y) ?? ds.y, xmin = psum(x2, ds.width?.map?.((x3) => -x3 / 2) ?? -0.5, xnudge), xmax = psum(x2, ds.width?.map?.((x3) => +x3 / 2) ?? 0.5, xnudge), ymin = psum(y2, ds.height?.map?.((x3) => -x3 / 2) ?? -0.5, ynudge), ymax = psum(y2, ds.height?.map?.((x3) => +x3 / 2) ?? 0.5, ynudge);
2761
+ let xnudge = coalesce(ds.xnudge, 0), ynudge = coalesce(ds.ynudge, 0), x2 = levels.x?.apply?.(ds.x) ?? ds.x, y2 = levels.y?.apply?.(ds.y) ?? ds.y, xmin = psum(x2, ds.width?.map?.((x3) => -x3 / 2) ?? -0.5, xnudge), xmax = psum(x2, ds.width?.map?.((x3) => +x3 / 2) ?? 0.5, xnudge), ymin = psum(y2, ds.height?.map?.((x3) => -x3 / 2) ?? -0.5, ynudge), ymax = psum(y2, ds.height?.map?.((x3) => +x3 / 2) ?? 0.5, ynudge);
2745
2762
  return { xmin, xmax, ymin, ymax };
2746
2763
  },
2747
2764
  get_values(ds, orientation) {
@@ -2794,20 +2811,21 @@ const bar = Object.assign(function(data, { position = "stack", width = 0.9, heig
2794
2811
  let group = intraaction(Object.fromEntries(keys.map((k) => [k, data[k]])));
2795
2812
  let inter = intraaction({ group: group ?? 0, value: values });
2796
2813
  let groups = Map.groupBy(data.$raw, (_, i) => inter.categories[inter[i]]);
2797
- let $raw = Array.from(groups.values()), cates = Array.from(groups.keys());
2814
+ let $raw = Array.from(groups.values()), cates = Array.from(groups.keys()), val = $raw.map((v) => v.length);
2798
2815
  let result = {
2799
2816
  $raw,
2800
- $group: cates.map((x2) => x2.group)
2817
+ $group: cates.map((x2) => x2.group),
2818
+ [cateAes]: cates.map((v) => v.value)
2801
2819
  };
2802
2820
  for (let key of keys) {
2803
2821
  result[key] = cates.map((x2) => x2.group).map((i) => group.categories[i][key]);
2804
2822
  }
2805
2823
  if (cateAes == "x") {
2806
- result.x = cates.map((v) => v.value);
2807
- result.height = $raw.map((v) => v.length);
2824
+ width ??= 0.9;
2825
+ result.height = val;
2808
2826
  } else {
2809
- result.y = cates.map((v) => v.value);
2810
- result.width = $raw.map((v) => v.length);
2827
+ height ??= 0.9;
2828
+ result.width = val;
2811
2829
  }
2812
2830
  if (position == "stack") {
2813
2831
  let cate_group = Object.groupBy(result.$group, (v, i) => group.categories[v][cateAes]);
@@ -2816,7 +2834,7 @@ const bar = Object.assign(function(data, { position = "stack", width = 0.9, heig
2816
2834
  let s = 0;
2817
2835
  for (let i of cate_group[cate]) {
2818
2836
  offset[i] = s;
2819
- s += $raw[i].length;
2837
+ s += val[i];
2820
2838
  }
2821
2839
  }
2822
2840
  if (cateAes == "x") {
@@ -2906,6 +2924,85 @@ const boxplot = Object.assign(function(data, { position = "dodge", width = 0.9,
2906
2924
  }
2907
2925
  return result;
2908
2926
  }, { core_attrs: ["x", "y", "xnudge", "ynudge"] });
2927
+ const col = Object.assign(function(data, { position = "stack", width, height, orientation = "x" }) {
2928
+ let missingAes = ["x", "y"].filter((a) => data[a] == null);
2929
+ if (missingAes.length > 0)
2930
+ throw new Error(`Missing aesthetics for "StatCol": "${missingAes.join('", "')}"`);
2931
+ let isXdiscrete = data.x.some(is_categorical);
2932
+ let isYdiscrete = data.y.some(is_categorical);
2933
+ if (isXdiscrete && isYdiscrete)
2934
+ throw new Error(`Both "x" and "y" are discrete, "StatCol" requires at most one discrete aesthetic`);
2935
+ let cateAes = isXdiscrete == isYdiscrete ? orientation != "y" ? "x" : "y" : isXdiscrete ? "x" : "y";
2936
+ let valueAes = cateAes == "x" ? "y" : "x";
2937
+ let keys = Object.keys(data).filter((k) => k != valueAes && !k.startsWith("$"));
2938
+ let group = intraaction(Object.fromEntries(keys.map((k) => [k, data[k]])));
2939
+ let inter = intraaction({ group: group ?? 0, cate: data[cateAes] });
2940
+ let groupIdx = Map.groupBy(inter.map((_, i) => i), (_, i) => inter.categories[inter[i]]);
2941
+ let groups = Map.groupBy(data.$raw, (_, i) => inter.categories[inter[i]]);
2942
+ let cates = Array.from(groups.keys()), $raw = Array.from(groupIdx.values()).map((arr) => arr.map((idx) => data.$raw[idx])), val = Array.from(groupIdx.values()).map((arr) => numutils.sum(arr.map((idx) => data[valueAes][idx])));
2943
+ let result = {
2944
+ $raw,
2945
+ $group: cates.map((x2) => x2.group),
2946
+ [cateAes]: cates.map((v) => v.value)
2947
+ };
2948
+ for (let key of keys) {
2949
+ result[key] = cates.map((x2) => x2.group).map((i) => group.categories[i][key]);
2950
+ }
2951
+ if (cateAes == "x") {
2952
+ if (isXdiscrete) {
2953
+ width ??= 0.9;
2954
+ } else {
2955
+ width ??= numutils.min(numutils.diff(Array.from(new Set(data[cateAes])).sort((a, b) => a - b))) * 0.9;
2956
+ }
2957
+ result.height = val;
2958
+ } else {
2959
+ if (isYdiscrete) {
2960
+ height ??= 0.9;
2961
+ } else {
2962
+ height ??= numutils.min(numutils.diff(Array.from(new Set(data[cateAes])).sort((a, b) => a - b))) * 0.9;
2963
+ }
2964
+ result.width = val;
2965
+ }
2966
+ if (position == "stack") {
2967
+ let cate_group = Object.groupBy(result.$group, (v, i) => group.categories[v][cateAes]);
2968
+ let offset = cates.map((_) => 0);
2969
+ for (let cate in cate_group) {
2970
+ let s = 0;
2971
+ for (let i of cate_group[cate]) {
2972
+ offset[i] = s;
2973
+ s += val[i];
2974
+ }
2975
+ }
2976
+ if (cateAes == "x") {
2977
+ result.y = result.height.map((v, i) => offset[i] + v / 2);
2978
+ result.width = cates.map((_) => width);
2979
+ } else {
2980
+ result.x = result.width.map((v, i) => offset[i] + v / 2);
2981
+ result.height = cates.map((_) => height);
2982
+ }
2983
+ } else if (position == "dodge") {
2984
+ let cate_group = Object.groupBy(result.$group, (v, i) => group.categories[v][cateAes]);
2985
+ let $group = result.$group.map((v) => cate_group[group.categories[v][cateAes]]);
2986
+ if (cateAes == "x") {
2987
+ result.y = result.height.map((v) => v / 2);
2988
+ result.width = $group.map((arr) => width / arr.length);
2989
+ result.xnudge = $group.map((arr, i) => (result.xnudge?.[i] ?? 0) + ((arr.indexOf(result.$group[i]) + 0.5) / arr.length - 0.5) * width);
2990
+ } else {
2991
+ result.x = result.width.map((v) => v / 2);
2992
+ result.height = $group.map((arr) => height / arr.length);
2993
+ result.ynudge = $group.map((arr, i) => (result.ynudge?.[i] ?? 0) + ((arr.indexOf(result.$group[i]) + 0.5) / arr.length - 0.5) * height);
2994
+ }
2995
+ } else {
2996
+ if (cateAes == "x") {
2997
+ result.y = result.height.map((v) => v / 2);
2998
+ result.width = cates.map((_) => width);
2999
+ } else {
3000
+ result.x = result.width.map((v) => v / 2);
3001
+ result.height = cates.map((_) => height);
3002
+ }
3003
+ }
3004
+ return result;
3005
+ }, { core_attrs: ["x", "y", "xnudge", "ynudge"] });
2909
3006
  const curve = Object.assign(function(data) {
2910
3007
  if (data.points != null) return data;
2911
3008
  let missingAes = ["x", "y"].filter((a) => data[a] == null);
@@ -3330,6 +3427,7 @@ const vvstat = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
3330
3427
  __proto__: null,
3331
3428
  bar,
3332
3429
  boxplot,
3430
+ col,
3333
3431
  curve,
3334
3432
  density,
3335
3433
  ellipse,
@@ -7349,9 +7447,9 @@ class GPlot {
7349
7447
  }
7350
7448
  getComputedLayers() {
7351
7449
  return this.layers.map((layer) => {
7352
- let data = Object.values(Object.groupBy(layer.data.$group.map(
7450
+ let data = layer.data.$group.map(
7353
7451
  (_, i) => vvgeom[layer.geom].validate(object_map(layer.data, (k, v) => v?.[i]))
7354
- ).filter((x2) => x2 != null), (d) => d.$group));
7452
+ ).filter((x2) => x2 != null);
7355
7453
  return { data, geom: layer.geom, vBind: layer.vBind };
7356
7454
  });
7357
7455
  }
@@ -7536,9 +7634,9 @@ class GAxis {
7536
7634
  return breaks;
7537
7635
  }
7538
7636
  }
7539
- const _hoisted_1$e = ["font-size"];
7637
+ const _hoisted_1$q = ["font-size"];
7540
7638
  const _hoisted_2$8 = { key: 0 };
7541
- const _sfc_main$17 = {
7639
+ const _sfc_main$18 = {
7542
7640
  __name: "CoreText",
7543
7641
  props: {
7544
7642
  x: { type: Number, default: 0 },
@@ -7566,8 +7664,9 @@ const _sfc_main$17 = {
7566
7664
  setup(__props) {
7567
7665
  const ele = useTemplateRef("ele");
7568
7666
  const textBox = reactive({ width: 0, height: 0 });
7667
+ const visible = inject("vvplot-visible", true);
7569
7668
  watch(
7570
- [ele, () => __props.fontSize, () => __props.size, () => __props.text, () => __props.textLength, () => __props.fontFamily],
7669
+ [ele, visible, () => __props.fontSize, () => __props.size, () => __props.text, () => __props.textLength, () => __props.fontFamily],
7571
7670
  async ([e]) => {
7572
7671
  if (!e) return;
7573
7672
  await nextTick();
@@ -7625,7 +7724,7 @@ const _sfc_main$17 = {
7625
7724
  __props.title ? (openBlock(), createElementBlock("title", _hoisted_2$8, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
7626
7725
  createTextVNode(" " + toDisplayString(__props.text?.replace(/ /g, " ")), 1)
7627
7726
  ])
7628
- ], 16, _hoisted_1$e);
7727
+ ], 16, _hoisted_1$q);
7629
7728
  };
7630
7729
  }
7631
7730
  };
@@ -14787,9 +14886,9 @@ XmlRenderer.prototype.out = out;
14787
14886
  XmlRenderer.prototype.cr = cr;
14788
14887
  XmlRenderer.prototype.tag = tag;
14789
14888
  XmlRenderer.prototype.esc = escapeXml;
14790
- const _hoisted_1$d = ["text-anchor", "font-size"];
14889
+ const _hoisted_1$p = ["text-anchor", "font-size"];
14791
14890
  const _hoisted_2$7 = { key: 0 };
14792
- const _sfc_main$16 = {
14891
+ const _sfc_main$17 = {
14793
14892
  __name: "CoreMarkdown",
14794
14893
  props: {
14795
14894
  x: { type: Number, default: 0 },
@@ -14818,8 +14917,9 @@ const _sfc_main$16 = {
14818
14917
  const parser = new Parser();
14819
14918
  const ele = useTemplateRef("ele");
14820
14919
  const textBox = reactive({ width: 0, height: 0 });
14920
+ const visible = inject("vvplot-visible", true);
14821
14921
  watch(
14822
- [ele, () => __props.fontSize, () => __props.size, () => __props.text, () => __props.textLength, () => __props.fontFamily],
14922
+ [ele, visible, () => __props.fontSize, () => __props.size, () => __props.text, () => __props.textLength, () => __props.fontFamily],
14823
14923
  async ([e]) => {
14824
14924
  if (!e) return;
14825
14925
  await nextTick();
@@ -14932,11 +15032,11 @@ const _sfc_main$16 = {
14932
15032
  (openBlock(true), createElementBlock(Fragment, null, renderList(textFragments.value, (span) => {
14933
15033
  return openBlock(), createElementBlock("tspan", mergeProps({ ref_for: true }, span.vbind), toDisplayString(span.text), 17);
14934
15034
  }), 256))
14935
- ], 16, _hoisted_1$d);
15035
+ ], 16, _hoisted_1$p);
14936
15036
  };
14937
15037
  }
14938
15038
  };
14939
- const _sfc_main$15 = {
15039
+ const _sfc_main$16 = {
14940
15040
  __name: "CoreAxisLabel",
14941
15041
  props: {
14942
15042
  type: String,
@@ -14998,11 +15098,11 @@ const _sfc_main$15 = {
14998
15098
  }
14999
15099
  };
15000
15100
  return (_ctx, _cache) => {
15001
- return __props.type == "markdown" ? (openBlock(), createBlock(_sfc_main$16, mergeProps({ key: 0 }, toHandlers(vOn)), null, 16)) : (openBlock(), createBlock(_sfc_main$17, mergeProps({ key: 1 }, toHandlers(vOn)), null, 16));
15101
+ return __props.type == "markdown" ? (openBlock(), createBlock(_sfc_main$17, mergeProps({ key: 0 }, toHandlers(vOn)), null, 16)) : (openBlock(), createBlock(_sfc_main$18, mergeProps({ key: 1 }, toHandlers(vOn)), null, 16));
15002
15102
  };
15003
15103
  }
15004
15104
  };
15005
- const _hoisted_1$c = ["transform"];
15105
+ const _hoisted_1$o = ["transform"];
15006
15106
  const _hoisted_2$6 = ["x2"];
15007
15107
  const _hoisted_3$4 = {
15008
15108
  class: "vvplot-interactive",
@@ -15015,7 +15115,7 @@ const _hoisted_5$2 = {
15015
15115
  fill: "transparent"
15016
15116
  };
15017
15117
  const _hoisted_6$2 = ["x"];
15018
- const _sfc_main$14 = {
15118
+ const _sfc_main$15 = {
15019
15119
  __name: "CoreAxisH",
15020
15120
  props: {
15021
15121
  coord: String,
@@ -15204,16 +15304,15 @@ const _sfc_main$14 = {
15204
15304
  let { xmin, xmax, ymin, ymax } = __props.pos2coord({ hmin: hmin0 + dh, hmax: hmax0 + dh });
15205
15305
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
15206
15306
  };
15207
- e.target.onpointerup = (ev) => {
15307
+ e.target.addEventListener("pointerup", function(ev) {
15208
15308
  e.target.onpointermove = null;
15209
- e.target.onpointerup = null;
15210
15309
  e.target.style.cursor = null;
15211
15310
  if (!pointerMoved) return;
15212
15311
  moveTimer = setTimeout(() => {
15213
15312
  applyTransform(act, ev);
15214
15313
  movementX = 0;
15215
15314
  }, 300);
15216
- };
15315
+ }, { once: true });
15217
15316
  }
15218
15317
  function axisRescaleLeftPointerdown(e) {
15219
15318
  let act = __props.action.find((a) => a.action == "rescale");
@@ -15239,11 +15338,10 @@ const _sfc_main$14 = {
15239
15338
  });
15240
15339
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
15241
15340
  };
15242
- e.target.onpointerup = (ev) => {
15341
+ e.target.addEventListener("pointerup", function(ev) {
15243
15342
  e.target.onpointermove = null;
15244
- e.target.onpointerup = null;
15245
15343
  applyTransform(act, ev);
15246
- };
15344
+ }, { once: true });
15247
15345
  }
15248
15346
  function axisRescaleRightPointerdown(e) {
15249
15347
  let act = __props.action.find((a) => a.action == "rescale");
@@ -15269,11 +15367,10 @@ const _sfc_main$14 = {
15269
15367
  });
15270
15368
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
15271
15369
  };
15272
- e.target.onpointerup = (ev) => {
15370
+ e.target.addEventListener("pointerup", function(ev) {
15273
15371
  e.target.onpointermove = null;
15274
- e.target.onpointerup = null;
15275
15372
  applyTransform(act, ev);
15276
- };
15373
+ }, { once: true });
15277
15374
  }
15278
15375
  let wheelDelta = 0, wheelTimer;
15279
15376
  function axisWheel(e) {
@@ -15381,7 +15478,7 @@ const _sfc_main$14 = {
15381
15478
  _cache[2] || (_cache[2] = createTextVNode()),
15382
15479
  (openBlock(true), createElementBlock(Fragment, null, renderList(tickTexts.value, (tick) => {
15383
15480
  return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, tick.wrapper), [
15384
- createVNode(_sfc_main$15, mergeProps({ ref_for: true }, tick.text, { getPosition }), null, 16)
15481
+ createVNode(_sfc_main$16, mergeProps({ ref_for: true }, tick.text, { getPosition }), null, 16)
15385
15482
  ], 16);
15386
15483
  }), 256)),
15387
15484
  _cache[3] || (_cache[3] = createTextVNode()),
@@ -15414,13 +15511,13 @@ const _sfc_main$14 = {
15414
15511
  ])) : createCommentVNode("", true),
15415
15512
  _cache[5] || (_cache[5] = createTextVNode()),
15416
15513
  axisTitle.value.text ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
15417
- __props.theme.title_type == "markdown" ? (openBlock(), createBlock(_sfc_main$16, normalizeProps(mergeProps({ key: 0 }, axisTitle.value)), null, 16)) : (openBlock(), createBlock(_sfc_main$17, normalizeProps(mergeProps({ key: 1 }, axisTitle.value)), null, 16))
15514
+ __props.theme.title_type == "markdown" ? (openBlock(), createBlock(_sfc_main$17, normalizeProps(mergeProps({ key: 0 }, axisTitle.value)), null, 16)) : (openBlock(), createBlock(_sfc_main$18, normalizeProps(mergeProps({ key: 1 }, axisTitle.value)), null, 16))
15418
15515
  ], 64)) : createCommentVNode("", true)
15419
- ], 12, _hoisted_1$c);
15516
+ ], 12, _hoisted_1$o);
15420
15517
  };
15421
15518
  }
15422
15519
  };
15423
- const _hoisted_1$b = ["transform"];
15520
+ const _hoisted_1$n = ["transform"];
15424
15521
  const _hoisted_2$5 = ["y2"];
15425
15522
  const _hoisted_3$3 = {
15426
15523
  class: "vvplot-interactive",
@@ -15433,7 +15530,7 @@ const _hoisted_5$1 = {
15433
15530
  fill: "transparent"
15434
15531
  };
15435
15532
  const _hoisted_6$1 = ["y"];
15436
- const _sfc_main$13 = {
15533
+ const _sfc_main$14 = {
15437
15534
  __name: "CoreAxisV",
15438
15535
  props: {
15439
15536
  coord: String,
@@ -15622,16 +15719,15 @@ const _sfc_main$13 = {
15622
15719
  let { xmin, xmax, ymin, ymax } = __props.pos2coord({ vmin: vmin0 + dv, vmax: vmax0 + dv });
15623
15720
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
15624
15721
  };
15625
- e.target.onpointerup = (ev) => {
15722
+ e.target.addEventListener("pointerup", function(ev) {
15626
15723
  e.target.onpointermove = null;
15627
- e.target.onpointerup = null;
15628
15724
  e.target.style.cursor = null;
15629
15725
  if (!pointerMoved) return;
15630
15726
  moveTimer = setTimeout(() => {
15631
15727
  applyTransform(act, ev);
15632
15728
  movementY = 0;
15633
15729
  }, 300);
15634
- };
15730
+ }, { once: true });
15635
15731
  }
15636
15732
  function axisRescaleTopPointerdown(e) {
15637
15733
  let act = __props.action.find((a) => a.action == "rescale");
@@ -15657,11 +15753,10 @@ const _sfc_main$13 = {
15657
15753
  });
15658
15754
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
15659
15755
  };
15660
- e.target.onpointerup = (ev) => {
15756
+ e.target.addEventListener("pointerup", function(ev) {
15661
15757
  e.target.onpointermove = null;
15662
- e.target.onpointerup = null;
15663
15758
  applyTransform(act, ev);
15664
- };
15759
+ }, { once: true });
15665
15760
  }
15666
15761
  function axisRescaleBottomPointerdown(e) {
15667
15762
  let act = __props.action.find((a) => a.action == "rescale");
@@ -15687,11 +15782,10 @@ const _sfc_main$13 = {
15687
15782
  });
15688
15783
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
15689
15784
  };
15690
- e.target.onpointerup = (ev) => {
15785
+ e.target.addEventListener("pointerup", function(ev) {
15691
15786
  e.target.onpointermove = null;
15692
- e.target.onpointerup = null;
15693
15787
  applyTransform(act, ev);
15694
- };
15788
+ }, { once: true });
15695
15789
  }
15696
15790
  let wheelDelta = 0, wheelTimer;
15697
15791
  function axisWheel(e) {
@@ -15799,7 +15893,7 @@ const _sfc_main$13 = {
15799
15893
  _cache[2] || (_cache[2] = createTextVNode()),
15800
15894
  (openBlock(true), createElementBlock(Fragment, null, renderList(tickTexts.value, (tick) => {
15801
15895
  return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, tick.wrapper), [
15802
- createVNode(_sfc_main$15, mergeProps({ ref_for: true }, tick.text, { getPosition }), null, 16)
15896
+ createVNode(_sfc_main$16, mergeProps({ ref_for: true }, tick.text, { getPosition }), null, 16)
15803
15897
  ], 16);
15804
15898
  }), 256)),
15805
15899
  _cache[3] || (_cache[3] = createTextVNode()),
@@ -15832,13 +15926,13 @@ const _sfc_main$13 = {
15832
15926
  ])) : createCommentVNode("", true),
15833
15927
  _cache[5] || (_cache[5] = createTextVNode()),
15834
15928
  axisTitle.value.text ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
15835
- __props.theme.title_type == "markdown" ? (openBlock(), createBlock(_sfc_main$16, normalizeProps(mergeProps({ key: 0 }, axisTitle.value)), null, 16)) : (openBlock(), createBlock(_sfc_main$17, normalizeProps(mergeProps({ key: 1 }, axisTitle.value)), null, 16))
15929
+ __props.theme.title_type == "markdown" ? (openBlock(), createBlock(_sfc_main$17, normalizeProps(mergeProps({ key: 0 }, axisTitle.value)), null, 16)) : (openBlock(), createBlock(_sfc_main$18, normalizeProps(mergeProps({ key: 1 }, axisTitle.value)), null, 16))
15836
15930
  ], 64)) : createCommentVNode("", true)
15837
- ], 12, _hoisted_1$b);
15931
+ ], 12, _hoisted_1$n);
15838
15932
  };
15839
15933
  }
15840
15934
  };
15841
- const _sfc_main$12 = {
15935
+ const _sfc_main$13 = {
15842
15936
  __name: "CoreAxis",
15843
15937
  props: {
15844
15938
  theme: { type: Object, default: () => ({}) },
@@ -15847,8 +15941,8 @@ const _sfc_main$12 = {
15847
15941
  },
15848
15942
  setup(__props) {
15849
15943
  const axis = {
15850
- h: _sfc_main$14,
15851
- v: _sfc_main$13
15944
+ h: _sfc_main$15,
15945
+ v: _sfc_main$14
15852
15946
  };
15853
15947
  return (_ctx, _cache) => {
15854
15948
  return __props.position != "none" ? (openBlock(), createBlock(resolveDynamicComponent(axis[__props.orientation]), {
@@ -15859,7 +15953,7 @@ const _sfc_main$12 = {
15859
15953
  };
15860
15954
  }
15861
15955
  };
15862
- const _sfc_main$11 = {
15956
+ const _sfc_main$12 = {
15863
15957
  __name: "CoreGridH",
15864
15958
  props: {
15865
15959
  breaks: { type: Array, default: () => [] },
@@ -15931,7 +16025,7 @@ const _sfc_main$11 = {
15931
16025
  };
15932
16026
  }
15933
16027
  };
15934
- const _sfc_main$10 = {
16028
+ const _sfc_main$11 = {
15935
16029
  __name: "CoreGridV",
15936
16030
  props: {
15937
16031
  breaks: { type: Array, default: () => [] },
@@ -16003,7 +16097,7 @@ const _sfc_main$10 = {
16003
16097
  };
16004
16098
  }
16005
16099
  };
16006
- const _sfc_main$$ = {
16100
+ const _sfc_main$10 = {
16007
16101
  __name: "CoreCanvasBoxplot",
16008
16102
  props: {
16009
16103
  extendX: { type: Number, default: 0 },
@@ -16037,83 +16131,81 @@ const _sfc_main$$ = {
16037
16131
  ctx.scale(__props.dpi / 96, __props.dpi / 96);
16038
16132
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16039
16133
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16040
- for (const group of __props.data) {
16041
- for (let {
16042
- x: x2,
16043
- xmin,
16044
- xmax,
16045
- y: y2,
16046
- ymin,
16047
- ymax,
16048
- lwisker,
16049
- Q1,
16050
- median,
16051
- Q3,
16052
- uwisker,
16053
- outliers,
16054
- $xmin,
16055
- $xmax,
16056
- $ymin,
16057
- $ymax,
16058
- fill = "white",
16059
- color: color2 = "black",
16060
- linewidth = 1,
16061
- linetype,
16062
- alpha: alpha2,
16063
- "translate-x": translateX = 0,
16064
- "translate-y": translateY = 0,
16065
- $raw
16066
- } of group) {
16067
- const { hmin: rx1, hmax: rx2, vmin: ry1, vmax: ry2 } = __props.coord2pos(x2 == null ? { ymin, ymax, xmin: Q1, xmax: Q3 } : { xmin, xmax, ymin: Q1, ymax: Q3 });
16068
- const { h: lx1, v: ly1 } = __props.coord2pos(x2 == null ? { y: y2, x: lwisker } : { x: x2, y: lwisker });
16069
- const { h: lx2, v: ly2 } = __props.coord2pos(x2 == null ? { y: y2, x: uwisker } : { x: x2, y: uwisker });
16070
- const { h: mx1, v: my1 } = __props.coord2pos(x2 == null ? { y: ymin, x: median } : { x: xmin, y: median });
16071
- const { h: mx2, v: my2 } = __props.coord2pos(x2 == null ? { y: ymax, x: median } : { x: xmax, y: median });
16072
- const { h: uwx1, v: uwy1 } = __props.coord2pos(x2 == null ? { y: ymin * 0.25 + ymax * 0.75, x: uwisker } : { x: xmin * 0.25 + xmax * 0.75, y: uwisker });
16073
- const { h: uwx2, v: uwy2 } = __props.coord2pos(x2 == null ? { y: ymin * 0.75 + ymax * 0.25, x: uwisker } : { x: xmin * 0.75 + xmax * 0.25, y: uwisker });
16074
- const { h: lwx1, v: lwy1 } = __props.coord2pos(x2 == null ? { y: ymin * 0.25 + ymax * 0.75, x: lwisker } : { x: xmin * 0.25 + xmax * 0.75, y: lwisker });
16075
- const { h: lwx2, v: lwy2 } = __props.coord2pos(x2 == null ? { y: ymin * 0.75 + ymax * 0.25, x: lwisker } : { x: xmin * 0.75 + xmax * 0.25, y: lwisker });
16076
- ctx.globalAlpha = alpha2;
16077
- ctx.setLineDash(parseLinetype(linetype));
16078
- const linepath2d = new Path2D();
16079
- linepath2d.moveTo(lx1 + translateX, ly1 + translateY);
16080
- linepath2d.lineTo(lx2 + translateX, ly2 + translateY);
16081
- const wiskerpath2d = new Path2D();
16082
- wiskerpath2d.moveTo(uwx1 + translateX, uwy1 + translateY);
16083
- wiskerpath2d.lineTo(uwx2 + translateX, uwy2 + translateY);
16084
- wiskerpath2d.moveTo(lwx1 + translateX, lwy1 + translateY);
16085
- wiskerpath2d.lineTo(lwx2 + translateX, lwy2 + translateY);
16086
- const rectpath2d = new Path2D();
16087
- rectpath2d.rect(rx1 + translateX, ry1 + translateY, rx2 - rx1, ry2 - ry1);
16088
- _path_data.set(rectpath2d, $raw);
16089
- const medianpath2d = new Path2D();
16090
- medianpath2d.moveTo(mx1 + translateX, my1 + translateY);
16091
- medianpath2d.lineTo(mx2 + translateX, my2 + translateY);
16092
- if (color2 != null && color2 !== "none") {
16093
- ctx.strokeStyle = color2;
16094
- ctx.lineWidth = linewidth;
16095
- ctx.stroke(linepath2d);
16096
- ctx.stroke(wiskerpath2d);
16097
- }
16098
- if (fill !== "none") {
16099
- ctx.fillStyle = fill;
16100
- ctx.fill(rectpath2d);
16101
- }
16134
+ for (let {
16135
+ x: x2,
16136
+ xmin,
16137
+ xmax,
16138
+ y: y2,
16139
+ ymin,
16140
+ ymax,
16141
+ lwisker,
16142
+ Q1,
16143
+ median,
16144
+ Q3,
16145
+ uwisker,
16146
+ outliers,
16147
+ $xmin,
16148
+ $xmax,
16149
+ $ymin,
16150
+ $ymax,
16151
+ fill = "white",
16152
+ color: color2 = "black",
16153
+ linewidth = 1,
16154
+ linetype,
16155
+ alpha: alpha2,
16156
+ "translate-x": translateX = 0,
16157
+ "translate-y": translateY = 0,
16158
+ $raw
16159
+ } of __props.data) {
16160
+ const { hmin: rx1, hmax: rx2, vmin: ry1, vmax: ry2 } = __props.coord2pos(x2 == null ? { ymin, ymax, xmin: Q1, xmax: Q3 } : { xmin, xmax, ymin: Q1, ymax: Q3 });
16161
+ const { h: lx1, v: ly1 } = __props.coord2pos(x2 == null ? { y: y2, x: lwisker } : { x: x2, y: lwisker });
16162
+ const { h: lx2, v: ly2 } = __props.coord2pos(x2 == null ? { y: y2, x: uwisker } : { x: x2, y: uwisker });
16163
+ const { h: mx1, v: my1 } = __props.coord2pos(x2 == null ? { y: ymin, x: median } : { x: xmin, y: median });
16164
+ const { h: mx2, v: my2 } = __props.coord2pos(x2 == null ? { y: ymax, x: median } : { x: xmax, y: median });
16165
+ const { h: uwx1, v: uwy1 } = __props.coord2pos(x2 == null ? { y: ymin * 0.25 + ymax * 0.75, x: uwisker } : { x: xmin * 0.25 + xmax * 0.75, y: uwisker });
16166
+ const { h: uwx2, v: uwy2 } = __props.coord2pos(x2 == null ? { y: ymin * 0.75 + ymax * 0.25, x: uwisker } : { x: xmin * 0.75 + xmax * 0.25, y: uwisker });
16167
+ const { h: lwx1, v: lwy1 } = __props.coord2pos(x2 == null ? { y: ymin * 0.25 + ymax * 0.75, x: lwisker } : { x: xmin * 0.25 + xmax * 0.75, y: lwisker });
16168
+ const { h: lwx2, v: lwy2 } = __props.coord2pos(x2 == null ? { y: ymin * 0.75 + ymax * 0.25, x: lwisker } : { x: xmin * 0.75 + xmax * 0.25, y: lwisker });
16169
+ ctx.globalAlpha = alpha2;
16170
+ ctx.setLineDash(parseLinetype(linetype));
16171
+ const linepath2d = new Path2D();
16172
+ linepath2d.moveTo(lx1 + translateX, ly1 + translateY);
16173
+ linepath2d.lineTo(lx2 + translateX, ly2 + translateY);
16174
+ const wiskerpath2d = new Path2D();
16175
+ wiskerpath2d.moveTo(uwx1 + translateX, uwy1 + translateY);
16176
+ wiskerpath2d.lineTo(uwx2 + translateX, uwy2 + translateY);
16177
+ wiskerpath2d.moveTo(lwx1 + translateX, lwy1 + translateY);
16178
+ wiskerpath2d.lineTo(lwx2 + translateX, lwy2 + translateY);
16179
+ const rectpath2d = new Path2D();
16180
+ rectpath2d.rect(rx1 + translateX, ry1 + translateY, rx2 - rx1, ry2 - ry1);
16181
+ _path_data.set(rectpath2d, $raw);
16182
+ const medianpath2d = new Path2D();
16183
+ medianpath2d.moveTo(mx1 + translateX, my1 + translateY);
16184
+ medianpath2d.lineTo(mx2 + translateX, my2 + translateY);
16185
+ if (color2 != null && color2 !== "none") {
16186
+ ctx.strokeStyle = color2;
16187
+ ctx.lineWidth = linewidth;
16188
+ ctx.stroke(linepath2d);
16189
+ ctx.stroke(wiskerpath2d);
16190
+ }
16191
+ if (fill !== "none") {
16192
+ ctx.fillStyle = fill;
16193
+ ctx.fill(rectpath2d);
16194
+ }
16195
+ if (color2 != null && color2 !== "none") {
16196
+ ctx.stroke(rectpath2d);
16197
+ ctx.lineWidth = linewidth * 2;
16198
+ ctx.stroke(medianpath2d);
16199
+ }
16200
+ for (let { x: x3, y: y3, $raw: $raw2 } of outliers) {
16201
+ const { h: ox, v: oy } = __props.coord2pos({ x: x3, y: y3 });
16202
+ const outlierpath2d = new Path2D();
16203
+ outlierpath2d.arc(ox + translateX, oy + translateY, 2, 0, Math.PI * 2);
16102
16204
  if (color2 != null && color2 !== "none") {
16103
- ctx.stroke(rectpath2d);
16104
- ctx.lineWidth = linewidth * 2;
16105
- ctx.stroke(medianpath2d);
16106
- }
16107
- for (let { x: x3, y: y3, $raw: $raw2 } of outliers) {
16108
- const { h: ox, v: oy } = __props.coord2pos({ x: x3, y: y3 });
16109
- const outlierpath2d = new Path2D();
16110
- outlierpath2d.arc(ox + translateX, oy + translateY, 2, 0, Math.PI * 2);
16111
- if (color2 != null && color2 !== "none") {
16112
- ctx.fillStyle = color2;
16113
- ctx.fill(outlierpath2d);
16114
- }
16115
- _path_data.set(outlierpath2d, $raw2);
16205
+ ctx.fillStyle = color2;
16206
+ ctx.fill(outlierpath2d);
16116
16207
  }
16208
+ _path_data.set(outlierpath2d, $raw2);
16117
16209
  }
16118
16210
  }
16119
16211
  for (let path2 of Array.from(_path_data.keys()).reverse()) {
@@ -16141,11 +16233,11 @@ const _sfc_main$$ = {
16141
16233
  dispatchEvent: (event) => layerCanvas.value?.dispatchEvent?.(event)
16142
16234
  });
16143
16235
  return (_ctx, _cache) => {
16144
- return openBlock(), createElementBlock("foreignObject", mergeProps(vBind.value, { ref: "container" }), null, 16);
16236
+ return openBlock(), createElementBlock("foreignObject", mergeProps({ class: "vvplot-layer" }, vBind.value, { ref: "container" }), null, 16);
16145
16237
  };
16146
16238
  }
16147
16239
  };
16148
- const _sfc_main$_ = {
16240
+ const _sfc_main$$ = {
16149
16241
  __name: "CoreCanvasCurve",
16150
16242
  props: {
16151
16243
  extendX: { type: Number, default: 0 },
@@ -16179,41 +16271,39 @@ const _sfc_main$_ = {
16179
16271
  ctx.scale(__props.dpi / 96, __props.dpi / 96);
16180
16272
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16181
16273
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16182
- for (const group of __props.data) {
16183
- for (let {
16184
- points,
16185
- fill,
16186
- color: color2,
16187
- linewidth,
16188
- linetype,
16189
- alpha: alpha2,
16190
- "translate-x": translateX = 0,
16191
- "translate-y": translateY = 0,
16192
- $raw,
16193
- interpolate: interpolate2
16194
- } of group) {
16195
- points = points.map((p) => (({ h: x2, v: y2 }) => ({ x: x2, y: y2 }))(__props.coord2pos(p))).filter((p) => p.x != null && p.y != null);
16196
- if (points.length === 0) continue;
16197
- const path2d = new Path2D();
16198
- let interpolatorFn = typeof interpolate2 == "function" ? interpolate2 : interpolators[interpolate2] ?? natural$1;
16199
- let interpolator = interpolatorFn(path2d);
16200
- interpolator.lineStart();
16201
- for (let i = 0; i < points.length; i++) {
16202
- interpolator.point(points[i].x + translateX, points[i].y + translateY);
16203
- }
16204
- interpolator.lineEnd();
16205
- _path_data.set(path2d, $raw);
16206
- ctx.lineWidth = linewidth;
16207
- ctx.globalAlpha = alpha2;
16208
- ctx.setLineDash(parseLinetype(linetype));
16209
- if (fill !== "none") {
16210
- ctx.fillStyle = fill;
16211
- ctx.fill(path2d);
16212
- }
16213
- if (color2 != null && color2 !== "none") {
16214
- ctx.strokeStyle = color2;
16215
- ctx.stroke(path2d);
16216
- }
16274
+ for (let {
16275
+ points,
16276
+ fill,
16277
+ color: color2,
16278
+ linewidth,
16279
+ linetype,
16280
+ alpha: alpha2,
16281
+ "translate-x": translateX = 0,
16282
+ "translate-y": translateY = 0,
16283
+ $raw,
16284
+ interpolate: interpolate2
16285
+ } of __props.data) {
16286
+ points = points.map((p) => (({ h: x2, v: y2 }) => ({ x: x2, y: y2 }))(__props.coord2pos(p))).filter((p) => p.x != null && p.y != null);
16287
+ if (points.length === 0) continue;
16288
+ const path2d = new Path2D();
16289
+ let interpolatorFn = typeof interpolate2 == "function" ? interpolate2 : interpolators[interpolate2] ?? natural$1;
16290
+ let interpolator = interpolatorFn(path2d);
16291
+ interpolator.lineStart();
16292
+ for (let i = 0; i < points.length; i++) {
16293
+ interpolator.point(points[i].x + translateX, points[i].y + translateY);
16294
+ }
16295
+ interpolator.lineEnd();
16296
+ _path_data.set(path2d, $raw);
16297
+ ctx.lineWidth = linewidth;
16298
+ ctx.globalAlpha = alpha2;
16299
+ ctx.setLineDash(parseLinetype(linetype));
16300
+ if (fill !== "none") {
16301
+ ctx.fillStyle = fill;
16302
+ ctx.fill(path2d);
16303
+ }
16304
+ if (color2 != null && color2 !== "none") {
16305
+ ctx.strokeStyle = color2;
16306
+ ctx.stroke(path2d);
16217
16307
  }
16218
16308
  }
16219
16309
  for (let path2 of Array.from(_path_data.keys()).reverse()) {
@@ -16250,11 +16340,11 @@ const _sfc_main$_ = {
16250
16340
  natural: natural$1
16251
16341
  };
16252
16342
  return (_ctx, _cache) => {
16253
- return openBlock(), createElementBlock("foreignObject", mergeProps(vBind.value, { ref: "container" }), null, 16);
16343
+ return openBlock(), createElementBlock("foreignObject", mergeProps({ class: "vvplot-layer" }, vBind.value, { ref: "container" }), null, 16);
16254
16344
  };
16255
16345
  }
16256
16346
  };
16257
- const _sfc_main$Z = {
16347
+ const _sfc_main$_ = {
16258
16348
  __name: "CoreCanvasEllipse",
16259
16349
  props: {
16260
16350
  extendX: { type: Number, default: 0 },
@@ -16288,46 +16378,44 @@ const _sfc_main$Z = {
16288
16378
  ctx.scale(__props.dpi / 96, __props.dpi / 96);
16289
16379
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16290
16380
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16291
- for (const group of __props.data) {
16292
- for (let {
16293
- cx,
16294
- cy,
16295
- A,
16296
- B,
16297
- C,
16298
- fill,
16299
- color: color2,
16300
- linewidth,
16301
- linetype,
16302
- alpha: alpha2,
16303
- "translate-x": translateX = 0,
16304
- "translate-y": translateY = 0,
16305
- $raw
16306
- } of group) {
16307
- let dx = Math.sqrt(C / (A * C - B * B)), dy = Math.sqrt(A / (A * C - B * B));
16308
- const { h: ch, v: cv } = __props.coord2pos({ x: cx, y: cy });
16309
- let { h: h1, v: v1 } = __props.coord2pos({ x: cx - dx, y: cy - dy }), { h: h2, v: v2 } = __props.coord2pos({ x: cx + dx, y: cy + dy });
16310
- let scaleX = (h2 - h1) / (2 * dx), scaleY = (v2 - v1) / (2 * dy);
16311
- A /= scaleX * scaleX;
16312
- B /= scaleX * scaleY;
16313
- C /= scaleY * scaleY;
16314
- const tr = A + C, det = A * C - B * B;
16315
- const disc = Math.sqrt(Math.max(0, tr * tr / 4 - det));
16316
- let rx2 = 1 / Math.sqrt(tr / 2 + disc), ry = 1 / Math.sqrt(tr / 2 - disc), angle2 = Math.atan2(2 * B, A - C) / 2;
16317
- const path2d = new Path2D();
16318
- path2d.ellipse(ch + translateX, cv + translateY, rx2, ry, angle2, 0, 2 * Math.PI);
16319
- _path_data.set(path2d, $raw);
16320
- ctx.lineWidth = linewidth;
16321
- ctx.globalAlpha = alpha2;
16322
- ctx.setLineDash(parseLinetype(linetype));
16323
- if (fill !== "none") {
16324
- ctx.fillStyle = fill;
16325
- ctx.fill(path2d);
16326
- }
16327
- if (color2 != null && color2 !== "none") {
16328
- ctx.strokeStyle = color2;
16329
- ctx.stroke(path2d);
16330
- }
16381
+ for (let {
16382
+ cx,
16383
+ cy,
16384
+ A,
16385
+ B,
16386
+ C,
16387
+ fill,
16388
+ color: color2,
16389
+ linewidth,
16390
+ linetype,
16391
+ alpha: alpha2,
16392
+ "translate-x": translateX = 0,
16393
+ "translate-y": translateY = 0,
16394
+ $raw
16395
+ } of __props.data) {
16396
+ let dx = Math.sqrt(C / (A * C - B * B)), dy = Math.sqrt(A / (A * C - B * B));
16397
+ const { h: ch, v: cv } = __props.coord2pos({ x: cx, y: cy });
16398
+ let { h: h1, v: v1 } = __props.coord2pos({ x: cx - dx, y: cy - dy }), { h: h2, v: v2 } = __props.coord2pos({ x: cx + dx, y: cy + dy });
16399
+ let scaleX = (h2 - h1) / (2 * dx), scaleY = (v2 - v1) / (2 * dy);
16400
+ A /= scaleX * scaleX;
16401
+ B /= scaleX * scaleY;
16402
+ C /= scaleY * scaleY;
16403
+ const tr = A + C, det = A * C - B * B;
16404
+ const disc = Math.sqrt(Math.max(0, tr * tr / 4 - det));
16405
+ let rx2 = 1 / Math.sqrt(tr / 2 + disc), ry = 1 / Math.sqrt(tr / 2 - disc), angle2 = Math.atan2(2 * B, A - C) / 2;
16406
+ const path2d = new Path2D();
16407
+ path2d.ellipse(ch + translateX, cv + translateY, rx2, ry, angle2, 0, 2 * Math.PI);
16408
+ _path_data.set(path2d, $raw);
16409
+ ctx.lineWidth = linewidth;
16410
+ ctx.globalAlpha = alpha2;
16411
+ ctx.setLineDash(parseLinetype(linetype));
16412
+ if (fill !== "none") {
16413
+ ctx.fillStyle = fill;
16414
+ ctx.fill(path2d);
16415
+ }
16416
+ if (color2 != null && color2 !== "none") {
16417
+ ctx.strokeStyle = color2;
16418
+ ctx.stroke(path2d);
16331
16419
  }
16332
16420
  }
16333
16421
  for (let path2 of Array.from(_path_data.keys()).reverse()) {
@@ -16355,11 +16443,11 @@ const _sfc_main$Z = {
16355
16443
  dispatchEvent: (event) => layerCanvas.value?.dispatchEvent?.(event)
16356
16444
  });
16357
16445
  return (_ctx, _cache) => {
16358
- return openBlock(), createElementBlock("foreignObject", mergeProps(vBind.value, { ref: "container" }), null, 16);
16446
+ return openBlock(), createElementBlock("foreignObject", mergeProps({ class: "vvplot-layer" }, vBind.value, { ref: "container" }), null, 16);
16359
16447
  };
16360
16448
  }
16361
16449
  };
16362
- const _sfc_main$Y = {
16450
+ const _sfc_main$Z = {
16363
16451
  __name: "CoreCanvasLine",
16364
16452
  props: {
16365
16453
  extendX: { type: Number, default: 0 },
@@ -16393,33 +16481,31 @@ const _sfc_main$Y = {
16393
16481
  ctx.scale(__props.dpi / 96, __props.dpi / 96);
16394
16482
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16395
16483
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16396
- for (const group of __props.data) {
16397
- for (let {
16398
- x: x2,
16399
- y: y2,
16400
- xend,
16401
- yend,
16402
- color: color2 = "black",
16403
- linewidth,
16404
- alpha: alpha2,
16405
- linetype,
16406
- "translate-x": translateX = 0,
16407
- "translate-y": translateY = 0,
16408
- $raw
16409
- } of group) {
16410
- const { h: x1, v: y1 } = __props.coord2pos({ x: x2, y: y2 });
16411
- const { h: x22, v: y22 } = __props.coord2pos({ x: xend, y: yend });
16412
- const path2d = new Path2D();
16413
- path2d.moveTo(x1 + translateX, y1 + translateY);
16414
- path2d.lineTo(x22 + translateX, y22 + translateY);
16415
- _path_data.set(path2d, $raw);
16416
- ctx.lineWidth = linewidth;
16417
- ctx.globalAlpha = alpha2;
16418
- ctx.setLineDash(parseLinetype(linetype));
16419
- if (color2 != null && color2 !== "none") {
16420
- ctx.strokeStyle = color2;
16421
- ctx.stroke(path2d);
16422
- }
16484
+ for (let {
16485
+ x: x2,
16486
+ y: y2,
16487
+ xend,
16488
+ yend,
16489
+ color: color2 = "black",
16490
+ linewidth,
16491
+ alpha: alpha2,
16492
+ linetype,
16493
+ "translate-x": translateX = 0,
16494
+ "translate-y": translateY = 0,
16495
+ $raw
16496
+ } of __props.data) {
16497
+ const { h: x1, v: y1 } = __props.coord2pos({ x: x2, y: y2 });
16498
+ const { h: x22, v: y22 } = __props.coord2pos({ x: xend, y: yend });
16499
+ const path2d = new Path2D();
16500
+ path2d.moveTo(x1 + translateX, y1 + translateY);
16501
+ path2d.lineTo(x22 + translateX, y22 + translateY);
16502
+ _path_data.set(path2d, $raw);
16503
+ ctx.lineWidth = linewidth;
16504
+ ctx.globalAlpha = alpha2;
16505
+ ctx.setLineDash(parseLinetype(linetype));
16506
+ if (color2 != null && color2 !== "none") {
16507
+ ctx.strokeStyle = color2;
16508
+ ctx.stroke(path2d);
16423
16509
  }
16424
16510
  }
16425
16511
  for (let path2 of Array.from(_path_data.keys()).reverse()) {
@@ -16447,11 +16533,11 @@ const _sfc_main$Y = {
16447
16533
  dispatchEvent: (event) => layerCanvas.value?.dispatchEvent?.(event)
16448
16534
  });
16449
16535
  return (_ctx, _cache) => {
16450
- return openBlock(), createElementBlock("foreignObject", mergeProps(vBind.value, { ref: "container" }), null, 16);
16536
+ return openBlock(), createElementBlock("foreignObject", mergeProps({ class: "vvplot-layer" }, vBind.value, { ref: "container" }), null, 16);
16451
16537
  };
16452
16538
  }
16453
16539
  };
16454
- const _sfc_main$X = {
16540
+ const _sfc_main$Y = {
16455
16541
  __name: "CoreCanvasPoint",
16456
16542
  props: {
16457
16543
  extendX: { type: Number, default: 0 },
@@ -16493,55 +16579,53 @@ const _sfc_main$X = {
16493
16579
  ctx.scale(__props.dpi / 96, __props.dpi / 96);
16494
16580
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16495
16581
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16496
- for (const group of __props.data) {
16497
- for (let {
16498
- x: x2,
16499
- y: y2,
16500
- size = 6,
16501
- shape: shape2,
16502
- color: color2,
16503
- stroke,
16504
- linewidth,
16505
- linetype,
16506
- alpha: alpha2,
16507
- "translate-x": translateX = 0,
16508
- "translate-y": translateY = 0,
16509
- angle: angle2 = 0,
16510
- $raw
16511
- } of group) {
16512
- const { h: cx, v: cy } = __props.coord2pos({ x: x2, y: y2 });
16513
- if (typeof angle2 == "object") {
16514
- let { dx = 0, dy = 0 } = angle2;
16515
- let { h, v } = __props.coord2pos({ x: x2 + dx, y: y2 + dy });
16516
- angle2 = Math.atan2(v - cy, h - cx) * 180 / Math.PI;
16517
- }
16518
- const path2d = new Path2D();
16519
- if (String(shape2).startsWith("path:")) {
16520
- path2d.addPath(
16521
- new Path2D(shape2.slice(5)),
16522
- new DOMMatrix().translateSelf(cx + translateX, cy + translateY).rotate(angle2)
16523
- );
16524
- } else if (shape2 in paths) {
16525
- path2d.addPath(
16526
- new Path2D(paths[shape2](size)),
16527
- new DOMMatrix().translate(cx + translateX, cy + translateY).rotate(angle2)
16528
- );
16529
- } else {
16530
- path2d.arc(cx + translateX, cy + translateY, size / 2, 0, Math.PI * 2);
16531
- }
16532
- _path_data.set(path2d, $raw);
16533
- ctx.lineWidth = linewidth;
16534
- ctx.globalAlpha = alpha2;
16535
- ctx.beginPath();
16536
- if (color2 !== "none") {
16537
- ctx.fillStyle = color2;
16538
- ctx.fill(path2d);
16539
- }
16540
- if (stroke != null && stroke !== "none") {
16541
- ctx.strokeStyle = stroke;
16542
- ctx.setLineDash(parseLinetype(linetype));
16543
- ctx.stroke(path2d);
16544
- }
16582
+ for (let {
16583
+ x: x2,
16584
+ y: y2,
16585
+ size = 6,
16586
+ shape: shape2,
16587
+ color: color2,
16588
+ stroke,
16589
+ linewidth,
16590
+ linetype,
16591
+ alpha: alpha2,
16592
+ "translate-x": translateX = 0,
16593
+ "translate-y": translateY = 0,
16594
+ angle: angle2 = 0,
16595
+ $raw
16596
+ } of __props.data) {
16597
+ const { h: cx, v: cy } = __props.coord2pos({ x: x2, y: y2 });
16598
+ if (typeof angle2 == "object") {
16599
+ let { dx = 0, dy = 0 } = angle2;
16600
+ let { h, v } = __props.coord2pos({ x: x2 + dx, y: y2 + dy });
16601
+ angle2 = Math.atan2(v - cy, h - cx) * 180 / Math.PI;
16602
+ }
16603
+ const path2d = new Path2D();
16604
+ if (String(shape2).startsWith("path:")) {
16605
+ path2d.addPath(
16606
+ new Path2D(shape2.slice(5)),
16607
+ new DOMMatrix().translateSelf(cx + translateX, cy + translateY).rotate(angle2)
16608
+ );
16609
+ } else if (shape2 in paths) {
16610
+ path2d.addPath(
16611
+ new Path2D(paths[shape2](size)),
16612
+ new DOMMatrix().translate(cx + translateX, cy + translateY).rotate(angle2)
16613
+ );
16614
+ } else {
16615
+ path2d.arc(cx + translateX, cy + translateY, size / 2, 0, Math.PI * 2);
16616
+ }
16617
+ _path_data.set(path2d, $raw);
16618
+ ctx.lineWidth = linewidth;
16619
+ ctx.globalAlpha = alpha2;
16620
+ ctx.beginPath();
16621
+ if (color2 !== "none") {
16622
+ ctx.fillStyle = color2;
16623
+ ctx.fill(path2d);
16624
+ }
16625
+ if (stroke != null && stroke !== "none") {
16626
+ ctx.strokeStyle = stroke;
16627
+ ctx.setLineDash(parseLinetype(linetype));
16628
+ ctx.stroke(path2d);
16545
16629
  }
16546
16630
  }
16547
16631
  for (let path2 of Array.from(_path_data.keys()).reverse()) {
@@ -16569,11 +16653,11 @@ const _sfc_main$X = {
16569
16653
  dispatchEvent: (event) => layerCanvas.value?.dispatchEvent?.(event)
16570
16654
  });
16571
16655
  return (_ctx, _cache) => {
16572
- return openBlock(), createElementBlock("foreignObject", mergeProps(vBind.value, { ref: "container" }), null, 16);
16656
+ return openBlock(), createElementBlock("foreignObject", mergeProps({ class: "vvplot-layer" }, vBind.value, { ref: "container" }), null, 16);
16573
16657
  };
16574
16658
  }
16575
16659
  };
16576
- const _sfc_main$W = {
16660
+ const _sfc_main$X = {
16577
16661
  __name: "CoreCanvasPolygon",
16578
16662
  props: {
16579
16663
  extendX: { type: Number, default: 0 },
@@ -16607,38 +16691,36 @@ const _sfc_main$W = {
16607
16691
  ctx.scale(__props.dpi / 96, __props.dpi / 96);
16608
16692
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16609
16693
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16610
- for (const group of __props.data) {
16611
- for (let {
16612
- points,
16613
- fill,
16614
- color: color2,
16615
- linewidth,
16616
- linetype,
16617
- alpha: alpha2,
16618
- "translate-x": translateX = 0,
16619
- "translate-y": translateY = 0,
16620
- $raw
16621
- } of group) {
16622
- points = points.map((p) => (({ h: x2, v: y2 }) => ({ x: x2, y: y2 }))(__props.coord2pos(p))).filter((p) => p.x != null && p.y != null);
16623
- if (points.length === 0) continue;
16624
- const path2d = new Path2D();
16625
- path2d.moveTo(points[0].x + translateX, points[0].y + translateY);
16626
- for (let i = 1; i < points.length; i++) {
16627
- path2d.lineTo(points[i].x + translateX, points[i].y + translateY);
16628
- }
16629
- path2d.closePath();
16630
- _path_data.set(path2d, $raw);
16631
- ctx.lineWidth = linewidth;
16632
- ctx.globalAlpha = alpha2;
16633
- ctx.setLineDash(parseLinetype(linetype));
16634
- if (fill !== "none") {
16635
- ctx.fillStyle = fill;
16636
- ctx.fill(path2d);
16637
- }
16638
- if (color2 != null && color2 !== "none") {
16639
- ctx.strokeStyle = color2;
16640
- ctx.stroke(path2d);
16641
- }
16694
+ for (let {
16695
+ points,
16696
+ fill,
16697
+ color: color2,
16698
+ linewidth,
16699
+ linetype,
16700
+ alpha: alpha2,
16701
+ "translate-x": translateX = 0,
16702
+ "translate-y": translateY = 0,
16703
+ $raw
16704
+ } of __props.data) {
16705
+ points = points.map((p) => (({ h: x2, v: y2 }) => ({ x: x2, y: y2 }))(__props.coord2pos(p))).filter((p) => p.x != null && p.y != null);
16706
+ if (points.length === 0) continue;
16707
+ const path2d = new Path2D();
16708
+ path2d.moveTo(points[0].x + translateX, points[0].y + translateY);
16709
+ for (let i = 1; i < points.length; i++) {
16710
+ path2d.lineTo(points[i].x + translateX, points[i].y + translateY);
16711
+ }
16712
+ path2d.closePath();
16713
+ _path_data.set(path2d, $raw);
16714
+ ctx.lineWidth = linewidth;
16715
+ ctx.globalAlpha = alpha2;
16716
+ ctx.setLineDash(parseLinetype(linetype));
16717
+ if (fill !== "none") {
16718
+ ctx.fillStyle = fill;
16719
+ ctx.fill(path2d);
16720
+ }
16721
+ if (color2 != null && color2 !== "none") {
16722
+ ctx.strokeStyle = color2;
16723
+ ctx.stroke(path2d);
16642
16724
  }
16643
16725
  }
16644
16726
  for (let path2 of Array.from(_path_data.keys()).reverse()) {
@@ -16666,11 +16748,11 @@ const _sfc_main$W = {
16666
16748
  dispatchEvent: (event) => layerCanvas.value?.dispatchEvent?.(event)
16667
16749
  });
16668
16750
  return (_ctx, _cache) => {
16669
- return openBlock(), createElementBlock("foreignObject", mergeProps(vBind.value, { ref: "container" }), null, 16);
16751
+ return openBlock(), createElementBlock("foreignObject", mergeProps({ class: "vvplot-layer" }, vBind.value, { ref: "container" }), null, 16);
16670
16752
  };
16671
16753
  }
16672
16754
  };
16673
- const _sfc_main$V = {
16755
+ const _sfc_main$W = {
16674
16756
  __name: "CoreCanvasRect",
16675
16757
  props: {
16676
16758
  extendX: { type: Number, default: 0 },
@@ -16704,36 +16786,34 @@ const _sfc_main$V = {
16704
16786
  ctx.scale(__props.dpi / 96, __props.dpi / 96);
16705
16787
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16706
16788
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16707
- for (const group of __props.data) {
16708
- for (let {
16709
- xmin,
16710
- xmax,
16711
- ymin,
16712
- ymax,
16713
- fill,
16714
- color: color2,
16715
- linewidth,
16716
- linetype,
16717
- alpha: alpha2,
16718
- "translate-x": translateX = 0,
16719
- "translate-y": translateY = 0,
16720
- $raw
16721
- } of group) {
16722
- const { hmin: x1, hmax: x2, vmin: y1, vmax: y2 } = __props.coord2pos({ xmin, xmax, ymin, ymax });
16723
- const path2d = new Path2D();
16724
- path2d.rect(x1 + translateX, y1 + translateY, x2 - x1, y2 - y1);
16725
- _path_data.set(path2d, $raw);
16726
- ctx.lineWidth = linewidth;
16727
- ctx.globalAlpha = alpha2;
16728
- ctx.setLineDash(parseLinetype(linetype));
16729
- if (fill !== "none") {
16730
- ctx.fillStyle = fill;
16731
- ctx.fill(path2d);
16732
- }
16733
- if (color2 !== "none" && color2 != null) {
16734
- ctx.strokeStyle = color2;
16735
- ctx.stroke(path2d);
16736
- }
16789
+ for (let {
16790
+ xmin,
16791
+ xmax,
16792
+ ymin,
16793
+ ymax,
16794
+ fill,
16795
+ color: color2,
16796
+ linewidth,
16797
+ linetype,
16798
+ alpha: alpha2,
16799
+ "translate-x": translateX = 0,
16800
+ "translate-y": translateY = 0,
16801
+ $raw
16802
+ } of __props.data) {
16803
+ const { hmin: x1, hmax: x2, vmin: y1, vmax: y2 } = __props.coord2pos({ xmin, xmax, ymin, ymax });
16804
+ const path2d = new Path2D();
16805
+ path2d.rect(x1 + translateX, y1 + translateY, x2 - x1, y2 - y1);
16806
+ _path_data.set(path2d, $raw);
16807
+ ctx.lineWidth = linewidth;
16808
+ ctx.globalAlpha = alpha2;
16809
+ ctx.setLineDash(parseLinetype(linetype));
16810
+ if (fill !== "none") {
16811
+ ctx.fillStyle = fill;
16812
+ ctx.fill(path2d);
16813
+ }
16814
+ if (color2 !== "none" && color2 != null) {
16815
+ ctx.strokeStyle = color2;
16816
+ ctx.stroke(path2d);
16737
16817
  }
16738
16818
  }
16739
16819
  for (let path2 of Array.from(_path_data.keys()).reverse()) {
@@ -16761,11 +16841,11 @@ const _sfc_main$V = {
16761
16841
  dispatchEvent: (event) => layerCanvas.value?.dispatchEvent?.(event)
16762
16842
  });
16763
16843
  return (_ctx, _cache) => {
16764
- return openBlock(), createElementBlock("foreignObject", mergeProps(vBind.value, { ref: "container" }), null, 16);
16844
+ return openBlock(), createElementBlock("foreignObject", mergeProps({ class: "vvplot-layer" }, vBind.value, { ref: "container" }), null, 16);
16765
16845
  };
16766
16846
  }
16767
16847
  };
16768
- const _sfc_main$U = {
16848
+ const _sfc_main$V = {
16769
16849
  __name: "CoreCanvasText",
16770
16850
  props: {
16771
16851
  extendX: { type: Number, default: 0 },
@@ -16799,77 +16879,75 @@ const _sfc_main$U = {
16799
16879
  ctx.scale(__props.dpi / 96, __props.dpi / 96);
16800
16880
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16801
16881
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16802
- for (const group of __props.data) {
16803
- for (let {
16804
- x: x2,
16805
- y: y2,
16806
- color: color2,
16807
- size = 4,
16808
- label = "",
16809
- title,
16810
- stroke,
16811
- linewidth,
16812
- linetype,
16813
- alpha: alpha2,
16814
- "anchor-x": anchorX,
16815
- "anchor-y": anchorY,
16816
- "dock-x": dockX,
16817
- "dock-y": dockY,
16818
- "translate-x": translateX = 0,
16819
- "translate-y": translateY = 0,
16820
- angle: angle2,
16821
- "text-length": textLength,
16822
- "font-family": fontFamily = "sans-serif",
16823
- $raw
16824
- } of group) {
16825
- ctx.save();
16826
- const { h: tx, v: ty } = __props.coord2pos({ x: x2, y: y2 });
16827
- ctx.textAlign = "center";
16828
- ctx.textBaseline = "middle";
16829
- ctx.lineWidth = linewidth;
16830
- ctx.globalAlpha = alpha2;
16831
- ctx.font = `${size * 4}px ${fontFamily}`;
16832
- ctx.setLineDash(parseLinetype(linetype));
16833
- ctx.translate(tx + translateX, ty + translateY);
16834
- let { width: w, fontBoundingBoxAscent: a, fontBoundingBoxDescent: d } = ctx.measureText(label), width = w, height = a + d;
16835
- if (typeof textLength == "object") {
16836
- let { x: lx = 0, y: ly = 0 } = textLength;
16837
- let { h: h1, v: v1 } = __props.coord2pos({ x: x2 + lx / 2, y: y2 + ly / 2 }), { h: h2, v: v2 } = __props.coord2pos({ x: x2 - lx / 2, y: y2 - ly / 2 });
16838
- width = Math.hypot(h1 - h2 || 0, v1 - v2 || 0);
16839
- } else if (textLength != null) {
16840
- width = textLength;
16841
- }
16842
- if (typeof angle2 == "object") {
16843
- let { dx = 0, dy = 0 } = angle2;
16844
- let { h, v } = __props.coord2pos({ x: x2 + dx, y: y2 + dy });
16845
- angle2 = Math.atan2(v - ty, h - tx) * 180 / Math.PI;
16846
- }
16847
- if (dockX != null || dockY != null) {
16848
- let alnX = { left: 0, center: 0.5, right: 1 }[dockX] ?? +(dockX ?? 0.5), alnY = { bottom: 0, center: 0.5, top: 1 }[dockY] ?? +(dockY ?? 0.5);
16849
- if (isNaN(alnX)) alnX = 0.5;
16850
- if (isNaN(alnY)) alnY = 0.5;
16851
- let w2 = width * Math.abs(Math.cos(angle2 * Math.PI / 180)) + height * Math.abs(Math.sin(angle2 * Math.PI / 180)), h = width * Math.abs(Math.sin(angle2 * Math.PI / 180)) + height * Math.abs(Math.cos(angle2 * Math.PI / 180));
16852
- ctx.translate(w2 * (0.5 - alnX), h * (alnY - 0.5));
16853
- ctx.rotate(angle2 * Math.PI / 180);
16854
- } else {
16855
- let alnX = { left: 0, center: 0.5, right: 1 }[anchorX] ?? +(anchorX ?? 0.5), alnY = { bottom: 0, center: 0.5, top: 1 }[anchorY] ?? +(anchorY ?? 0.5);
16856
- if (isNaN(alnX)) alnX = 0.5;
16857
- if (isNaN(alnY)) alnY = 0.5;
16858
- let w2 = width, h = height;
16859
- ctx.rotate(angle2 * Math.PI / 180);
16860
- ctx.translate(w2 * (0.5 - alnX), h * (alnY - 0.5));
16861
- }
16862
- if (width != w) ctx.scale(width / w, 1);
16863
- if (color2 !== "none") {
16864
- ctx.fillStyle = color2;
16865
- ctx.fillText(label, 0, 0);
16866
- }
16867
- if (stroke != null && stroke !== "none") {
16868
- ctx.strokeStyle = stroke;
16869
- ctx.strokeText(label, 0, 0);
16870
- }
16871
- ctx.restore();
16882
+ for (let {
16883
+ x: x2,
16884
+ y: y2,
16885
+ color: color2,
16886
+ size = 4,
16887
+ label = "",
16888
+ title,
16889
+ stroke,
16890
+ linewidth,
16891
+ linetype,
16892
+ alpha: alpha2,
16893
+ "anchor-x": anchorX,
16894
+ "anchor-y": anchorY,
16895
+ "dock-x": dockX,
16896
+ "dock-y": dockY,
16897
+ "translate-x": translateX = 0,
16898
+ "translate-y": translateY = 0,
16899
+ angle: angle2,
16900
+ "text-length": textLength,
16901
+ "font-family": fontFamily = "sans-serif",
16902
+ $raw
16903
+ } of __props.data) {
16904
+ ctx.save();
16905
+ const { h: tx, v: ty } = __props.coord2pos({ x: x2, y: y2 });
16906
+ ctx.textAlign = "center";
16907
+ ctx.textBaseline = "middle";
16908
+ ctx.lineWidth = linewidth;
16909
+ ctx.globalAlpha = alpha2;
16910
+ ctx.font = `${size * 4}px ${fontFamily}`;
16911
+ ctx.setLineDash(parseLinetype(linetype));
16912
+ ctx.translate(tx + translateX, ty + translateY);
16913
+ let { width: w, fontBoundingBoxAscent: a, fontBoundingBoxDescent: d } = ctx.measureText(label), width = w, height = a + d;
16914
+ if (typeof textLength == "object") {
16915
+ let { x: lx = 0, y: ly = 0 } = textLength;
16916
+ let { h: h1, v: v1 } = __props.coord2pos({ x: x2 + lx / 2, y: y2 + ly / 2 }), { h: h2, v: v2 } = __props.coord2pos({ x: x2 - lx / 2, y: y2 - ly / 2 });
16917
+ width = Math.hypot(h1 - h2 || 0, v1 - v2 || 0);
16918
+ } else if (textLength != null) {
16919
+ width = textLength;
16920
+ }
16921
+ if (typeof angle2 == "object") {
16922
+ let { dx = 0, dy = 0 } = angle2;
16923
+ let { h, v } = __props.coord2pos({ x: x2 + dx, y: y2 + dy });
16924
+ angle2 = Math.atan2(v - ty, h - tx) * 180 / Math.PI;
16925
+ }
16926
+ if (dockX != null || dockY != null) {
16927
+ let alnX = { left: 0, center: 0.5, right: 1 }[dockX] ?? +(dockX ?? 0.5), alnY = { bottom: 0, center: 0.5, top: 1 }[dockY] ?? +(dockY ?? 0.5);
16928
+ if (isNaN(alnX)) alnX = 0.5;
16929
+ if (isNaN(alnY)) alnY = 0.5;
16930
+ let w2 = width * Math.abs(Math.cos(angle2 * Math.PI / 180)) + height * Math.abs(Math.sin(angle2 * Math.PI / 180)), h = width * Math.abs(Math.sin(angle2 * Math.PI / 180)) + height * Math.abs(Math.cos(angle2 * Math.PI / 180));
16931
+ ctx.translate(w2 * (0.5 - alnX), h * (alnY - 0.5));
16932
+ ctx.rotate(angle2 * Math.PI / 180);
16933
+ } else {
16934
+ let alnX = { left: 0, center: 0.5, right: 1 }[anchorX] ?? +(anchorX ?? 0.5), alnY = { bottom: 0, center: 0.5, top: 1 }[anchorY] ?? +(anchorY ?? 0.5);
16935
+ if (isNaN(alnX)) alnX = 0.5;
16936
+ if (isNaN(alnY)) alnY = 0.5;
16937
+ let w2 = width, h = height;
16938
+ ctx.rotate(angle2 * Math.PI / 180);
16939
+ ctx.translate(w2 * (0.5 - alnX), h * (alnY - 0.5));
16940
+ }
16941
+ if (width != w) ctx.scale(width / w, 1);
16942
+ if (color2 !== "none") {
16943
+ ctx.fillStyle = color2;
16944
+ ctx.fillText(label, 0, 0);
16945
+ }
16946
+ if (stroke != null && stroke !== "none") {
16947
+ ctx.strokeStyle = stroke;
16948
+ ctx.strokeText(label, 0, 0);
16872
16949
  }
16950
+ ctx.restore();
16873
16951
  }
16874
16952
  for (let path2 of Array.from(_path_data.keys()).reverse()) {
16875
16953
  path_data.set(path2, _path_data.get(path2));
@@ -16896,11 +16974,11 @@ const _sfc_main$U = {
16896
16974
  dispatchEvent: (event) => layerCanvas.value?.dispatchEvent?.(event)
16897
16975
  });
16898
16976
  return (_ctx, _cache) => {
16899
- return openBlock(), createElementBlock("foreignObject", mergeProps(vBind.value, { ref: "container" }), null, 16);
16977
+ return openBlock(), createElementBlock("foreignObject", mergeProps({ class: "vvplot-layer" }, vBind.value, { ref: "container" }), null, 16);
16900
16978
  };
16901
16979
  }
16902
16980
  };
16903
- const _sfc_main$T = {
16981
+ const _sfc_main$U = {
16904
16982
  __name: "CoreCanvasTextsegment",
16905
16983
  props: {
16906
16984
  extendX: { type: Number, default: 0 },
@@ -16934,69 +17012,86 @@ const _sfc_main$T = {
16934
17012
  ctx.scale(__props.dpi / 96, __props.dpi / 96);
16935
17013
  ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
16936
17014
  let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
16937
- for (const group of __props.data) {
16938
- for (let {
16939
- x: x2,
16940
- xend,
16941
- y: y2,
16942
- yend,
16943
- size = 4,
16944
- label = "",
16945
- title,
16946
- color: color2,
16947
- stroke,
16948
- linewidth,
16949
- linetype,
16950
- alpha: alpha2,
16951
- "translate-x": translateX = 0,
16952
- "translate-y": translateY = 0,
16953
- "text-length": textLength,
16954
- "font-family": fontFamily = "sans-serif",
16955
- "text-align": textAlign = "justify",
16956
- angle: angle2 = "auto",
16957
- inset = 0,
16958
- $raw
16959
- } of group) {
16960
- const { h: x1, v: y1 } = __props.coord2pos({ x: x2, y: y2 });
16961
- const { h: x22, v: y22 } = __props.coord2pos({ x: xend, y: yend });
16962
- ctx.save();
16963
- ctx.translate(translateX, translateY);
16964
- ctx.textBaseline = "middle";
16965
- ctx.lineWidth = linewidth;
16966
- ctx.globalAlpha = alpha2;
16967
- ctx.font = `${size * 4}px ${fontFamily}`;
16968
- ctx.setLineDash(parseLinetype(linetype));
16969
- if (["stretch", "pre", "start", "center", "end", "post"].includes(textAlign)) {
16970
- let radian = Math.atan2(y22 - y1, x22 - x1);
16971
- let text2 = String(label).replace(/\x01|\x02/g, "");
16972
- let insetX = Math.cos(radian) * inset, insetY = Math.sin(radian) * inset;
16973
- switch (textAlign) {
16974
- case "stretch":
16975
- case "center":
16976
- ctx.translate((x1 + x22) / 2, (y1 + y22) / 2);
16977
- ctx.textAlign = "center";
16978
- break;
16979
- case "pre":
16980
- ctx.translate(x1 - insetX, y1 - insetY);
16981
- ctx.textAlign = "end";
16982
- break;
16983
- case "start":
16984
- ctx.translate(x1 + insetX, y1 + insetY);
16985
- ctx.textAlign = "start";
16986
- break;
16987
- case "end":
16988
- ctx.translate(x22 - insetX, y22 - insetY);
16989
- ctx.textAlign = "end";
16990
- break;
16991
- case "post":
16992
- ctx.translate(x22 + insetX, y22 + insetY);
16993
- ctx.textAlign = "start";
16994
- break;
16995
- }
17015
+ for (let {
17016
+ x: x2,
17017
+ xend,
17018
+ y: y2,
17019
+ yend,
17020
+ size = 4,
17021
+ label = "",
17022
+ title,
17023
+ color: color2,
17024
+ stroke,
17025
+ linewidth,
17026
+ linetype,
17027
+ alpha: alpha2,
17028
+ "translate-x": translateX = 0,
17029
+ "translate-y": translateY = 0,
17030
+ "text-length": textLength,
17031
+ "font-family": fontFamily = "sans-serif",
17032
+ "text-align": textAlign = "justify",
17033
+ angle: angle2 = "auto",
17034
+ inset = 0,
17035
+ $raw
17036
+ } of __props.data) {
17037
+ const { h: x1, v: y1 } = __props.coord2pos({ x: x2, y: y2 });
17038
+ const { h: x22, v: y22 } = __props.coord2pos({ x: xend, y: yend });
17039
+ ctx.save();
17040
+ ctx.translate(translateX, translateY);
17041
+ ctx.textBaseline = "middle";
17042
+ ctx.lineWidth = linewidth;
17043
+ ctx.globalAlpha = alpha2;
17044
+ ctx.font = `${size * 4}px ${fontFamily}`;
17045
+ ctx.setLineDash(parseLinetype(linetype));
17046
+ if (["stretch", "pre", "start", "center", "end", "post"].includes(textAlign)) {
17047
+ let radian = Math.atan2(y22 - y1, x22 - x1);
17048
+ let text2 = String(label).replace(/\x01|\x02/g, "");
17049
+ let insetX = Math.cos(radian) * inset, insetY = Math.sin(radian) * inset;
17050
+ switch (textAlign) {
17051
+ case "stretch":
17052
+ case "center":
17053
+ ctx.translate((x1 + x22) / 2, (y1 + y22) / 2);
17054
+ ctx.textAlign = "center";
17055
+ break;
17056
+ case "pre":
17057
+ ctx.translate(x1 - insetX, y1 - insetY);
17058
+ ctx.textAlign = "end";
17059
+ break;
17060
+ case "start":
17061
+ ctx.translate(x1 + insetX, y1 + insetY);
17062
+ ctx.textAlign = "start";
17063
+ break;
17064
+ case "end":
17065
+ ctx.translate(x22 - insetX, y22 - insetY);
17066
+ ctx.textAlign = "end";
17067
+ break;
17068
+ case "post":
17069
+ ctx.translate(x22 + insetX, y22 + insetY);
17070
+ ctx.textAlign = "start";
17071
+ break;
17072
+ }
17073
+ ctx.rotate(radian);
17074
+ if (textAlign === "stretch") {
17075
+ ctx.scale(Math.hypot(x22 - x1 || 0, y22 - y1 || 0) / ctx.measureText(text2).width, 1);
17076
+ }
17077
+ if (color2 !== "none") {
17078
+ ctx.fillStyle = color2;
17079
+ ctx.fillText(text2, 0, 0);
17080
+ }
17081
+ if (stroke != null && stroke !== "none") {
17082
+ ctx.strokeStyle = stroke;
17083
+ ctx.strokeText(text2, 0, 0);
17084
+ }
17085
+ } else {
17086
+ let radian = angle2 === "auto" ? Math.atan2(y22 - y1, x22 - x1) : angle2 * Math.PI / 180;
17087
+ ctx.textAlign = "center";
17088
+ let parts = splitLabel(String(label));
17089
+ let dx = (x22 - x1) / (parts.length - 1 || 1), dy = (y22 - y1) / (parts.length - 1 || 1);
17090
+ for (let i = 0; i < parts.length; i++) {
17091
+ ctx.save();
17092
+ ctx.translate(x1 + i * dx, y1 + i * dy);
16996
17093
  ctx.rotate(radian);
16997
- if (textAlign === "stretch") {
16998
- ctx.scale(Math.hypot(x22 - x1 || 0, y22 - y1 || 0) / ctx.measureText(text2).width, 1);
16999
- }
17094
+ let text2 = parts[i];
17000
17095
  if (color2 !== "none") {
17001
17096
  ctx.fillStyle = color2;
17002
17097
  ctx.fillText(text2, 0, 0);
@@ -17005,29 +17100,10 @@ const _sfc_main$T = {
17005
17100
  ctx.strokeStyle = stroke;
17006
17101
  ctx.strokeText(text2, 0, 0);
17007
17102
  }
17008
- } else {
17009
- let radian = angle2 === "auto" ? Math.atan2(y22 - y1, x22 - x1) : angle2 * Math.PI / 180;
17010
- ctx.textAlign = "center";
17011
- let parts = splitLabel(String(label));
17012
- let dx = (x22 - x1) / (parts.length - 1 || 1), dy = (y22 - y1) / (parts.length - 1 || 1);
17013
- for (let i = 0; i < parts.length; i++) {
17014
- ctx.save();
17015
- ctx.translate(x1 + i * dx, y1 + i * dy);
17016
- ctx.rotate(radian);
17017
- let text2 = parts[i];
17018
- if (color2 !== "none") {
17019
- ctx.fillStyle = color2;
17020
- ctx.fillText(text2, 0, 0);
17021
- }
17022
- if (stroke != null && stroke !== "none") {
17023
- ctx.strokeStyle = stroke;
17024
- ctx.strokeText(text2, 0, 0);
17025
- }
17026
- ctx.restore();
17027
- }
17103
+ ctx.restore();
17028
17104
  }
17029
- ctx.restore();
17030
17105
  }
17106
+ ctx.restore();
17031
17107
  }
17032
17108
  for (let path2 of Array.from(_path_data.keys()).reverse()) {
17033
17109
  path_data.set(path2, _path_data.get(path2));
@@ -17068,26 +17144,27 @@ const _sfc_main$T = {
17068
17144
  return result;
17069
17145
  }
17070
17146
  return (_ctx, _cache) => {
17071
- return openBlock(), createElementBlock("foreignObject", mergeProps(vBind.value, { ref: "container" }), null, 16);
17147
+ return openBlock(), createElementBlock("foreignObject", mergeProps({ class: "vvplot-layer" }, vBind.value, { ref: "container" }), null, 16);
17072
17148
  };
17073
17149
  }
17074
17150
  };
17075
17151
  const canvas = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
17076
17152
  __proto__: null,
17077
- boxplot: _sfc_main$$,
17078
- curve: _sfc_main$_,
17079
- ellipse: _sfc_main$Z,
17080
- line: _sfc_main$Y,
17081
- point: _sfc_main$X,
17082
- polygon: _sfc_main$W,
17083
- rect: _sfc_main$V,
17084
- shape: _sfc_main$_,
17085
- stick: _sfc_main$Y,
17086
- text: _sfc_main$U,
17087
- textsegment: _sfc_main$T,
17088
- tile: _sfc_main$V
17153
+ boxplot: _sfc_main$10,
17154
+ curve: _sfc_main$$,
17155
+ ellipse: _sfc_main$_,
17156
+ line: _sfc_main$Z,
17157
+ point: _sfc_main$Y,
17158
+ polygon: _sfc_main$X,
17159
+ rect: _sfc_main$W,
17160
+ shape: _sfc_main$$,
17161
+ stick: _sfc_main$Z,
17162
+ text: _sfc_main$V,
17163
+ textsegment: _sfc_main$U,
17164
+ tile: _sfc_main$W
17089
17165
  }, Symbol.toStringTag, { value: "Module" }));
17090
- const _sfc_main$S = {
17166
+ const _hoisted_1$m = { class: "vvplot-layer" };
17167
+ const _sfc_main$T = {
17091
17168
  __name: "CoreSvgBlank",
17092
17169
  props: {
17093
17170
  extendX: { type: Number, default: 0 },
@@ -17102,12 +17179,12 @@ const _sfc_main$S = {
17102
17179
  emits: ["click", "contextmenu", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup"],
17103
17180
  setup(__props, { emit: __emit }) {
17104
17181
  return (_ctx, _cache) => {
17105
- return openBlock(), createElementBlock("g");
17182
+ return openBlock(), createElementBlock("g", _hoisted_1$m);
17106
17183
  };
17107
17184
  }
17108
17185
  };
17109
- const _hoisted_1$a = { key: 0 };
17110
- const _sfc_main$R = {
17186
+ const _hoisted_1$l = { key: 0 };
17187
+ const _sfc_main$S = {
17111
17188
  __name: "CoreTile",
17112
17189
  props: {
17113
17190
  x: { type: Number, default: 0 },
@@ -17142,14 +17219,14 @@ const _sfc_main$R = {
17142
17219
  });
17143
17220
  return (_ctx, _cache) => {
17144
17221
  return openBlock(), createElementBlock("rect", normalizeProps(guardReactiveProps(binds.value)), [
17145
- __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$a, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17222
+ __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$l, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17146
17223
  ], 16);
17147
17224
  };
17148
17225
  }
17149
17226
  };
17150
- const _hoisted_1$9 = { key: 0 };
17227
+ const _hoisted_1$k = { key: 0 };
17151
17228
  const _hoisted_2$4 = { key: 0 };
17152
- const _sfc_main$Q = {
17229
+ const _sfc_main$R = {
17153
17230
  __name: "CorePoint",
17154
17231
  props: {
17155
17232
  x: { type: Number, default: 0 },
@@ -17200,15 +17277,15 @@ const _sfc_main$Q = {
17200
17277
  });
17201
17278
  return (_ctx, _cache) => {
17202
17279
  return binds.value.d ? (openBlock(), createElementBlock("path", normalizeProps(mergeProps({ key: 0 }, binds.value)), [
17203
- __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$9, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17280
+ __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$k, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17204
17281
  ], 16)) : (openBlock(), createElementBlock("circle", normalizeProps(mergeProps({ key: 1 }, binds.value)), [
17205
17282
  __props.title ? (openBlock(), createElementBlock("title", _hoisted_2$4, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17206
17283
  ], 16));
17207
17284
  };
17208
17285
  }
17209
17286
  };
17210
- const _hoisted_1$8 = { key: 0 };
17211
- const _sfc_main$P = {
17287
+ const _hoisted_1$j = { key: 0 };
17288
+ const _sfc_main$Q = {
17212
17289
  __name: "CoreLine",
17213
17290
  props: {
17214
17291
  x1: { type: Number, default: 0 },
@@ -17241,12 +17318,13 @@ const _sfc_main$P = {
17241
17318
  });
17242
17319
  return (_ctx, _cache) => {
17243
17320
  return openBlock(), createElementBlock("line", normalizeProps(guardReactiveProps(binds.value)), [
17244
- __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$8, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17321
+ __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$j, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17245
17322
  ], 16);
17246
17323
  };
17247
17324
  }
17248
17325
  };
17249
- const _sfc_main$O = {
17326
+ const _hoisted_1$i = { class: "vvplot-layer" };
17327
+ const _sfc_main$P = {
17250
17328
  __name: "CoreSvgBoxplot",
17251
17329
  props: {
17252
17330
  extendX: { type: Number, default: 0 },
@@ -17264,7 +17342,7 @@ const _sfc_main$O = {
17264
17342
  const emit = __emit;
17265
17343
  const binds = computed(() => {
17266
17344
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
17267
- return __props.data.map((group) => group.map(({
17345
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
17268
17346
  x: x2,
17269
17347
  xmin,
17270
17348
  xmax,
@@ -17404,23 +17482,23 @@ const _sfc_main$O = {
17404
17482
  }).filter((x2) => x2 != null));
17405
17483
  });
17406
17484
  return (_ctx, _cache) => {
17407
- return openBlock(), createElementBlock("g", null, [
17485
+ return openBlock(), createElementBlock("g", _hoisted_1$i, [
17408
17486
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17409
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17487
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17410
17488
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbinds, von]) => {
17411
17489
  return openBlock(), createElementBlock("g", null, [
17412
- createVNode(_sfc_main$P, mergeProps({ ref_for: true }, vbinds.line), null, 16),
17490
+ createVNode(_sfc_main$Q, mergeProps({ ref_for: true }, vbinds.line), null, 16),
17413
17491
  _cache[0] || (_cache[0] = createTextVNode()),
17414
- createVNode(_sfc_main$R, mergeProps({ ref_for: true }, vbinds.rect, toHandlers(von)), null, 16),
17492
+ createVNode(_sfc_main$S, mergeProps({ ref_for: true }, vbinds.rect, toHandlers(von)), null, 16),
17415
17493
  _cache[1] || (_cache[1] = createTextVNode()),
17416
- createVNode(_sfc_main$P, mergeProps({ ref_for: true }, vbinds.midline), null, 16),
17494
+ createVNode(_sfc_main$Q, mergeProps({ ref_for: true }, vbinds.midline), null, 16),
17417
17495
  _cache[2] || (_cache[2] = createTextVNode()),
17418
- createVNode(_sfc_main$P, mergeProps({ ref_for: true }, vbinds.uwisker), null, 16),
17496
+ createVNode(_sfc_main$Q, mergeProps({ ref_for: true }, vbinds.uwisker), null, 16),
17419
17497
  _cache[3] || (_cache[3] = createTextVNode()),
17420
- createVNode(_sfc_main$P, mergeProps({ ref_for: true }, vbinds.lwisker), null, 16),
17498
+ createVNode(_sfc_main$Q, mergeProps({ ref_for: true }, vbinds.lwisker), null, 16),
17421
17499
  _cache[4] || (_cache[4] = createTextVNode()),
17422
17500
  (openBlock(true), createElementBlock(Fragment, null, renderList(vbinds.outliers, ([vbind, von2]) => {
17423
- return openBlock(), createBlock(_sfc_main$Q, mergeProps({ ref_for: true }, vbind, toHandlers(von2)), null, 16);
17501
+ return openBlock(), createBlock(_sfc_main$R, mergeProps({ ref_for: true }, vbind, toHandlers(von2)), null, 16);
17424
17502
  }), 256))
17425
17503
  ]);
17426
17504
  }), 256))
@@ -17430,8 +17508,8 @@ const _sfc_main$O = {
17430
17508
  };
17431
17509
  }
17432
17510
  };
17433
- const _hoisted_1$7 = { key: 0 };
17434
- const _sfc_main$N = {
17511
+ const _hoisted_1$h = { key: 0 };
17512
+ const _sfc_main$O = {
17435
17513
  __name: "CoreCurve",
17436
17514
  props: {
17437
17515
  points: { type: Array, default: () => [] },
@@ -17471,12 +17549,13 @@ const _sfc_main$N = {
17471
17549
  };
17472
17550
  return (_ctx, _cache) => {
17473
17551
  return openBlock(), createElementBlock("path", normalizeProps(guardReactiveProps(binds.value)), [
17474
- __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$7, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17552
+ __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$h, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17475
17553
  ], 16);
17476
17554
  };
17477
17555
  }
17478
17556
  };
17479
- const _sfc_main$M = {
17557
+ const _hoisted_1$g = { class: "vvplot-layer vvplot-layer-curve" };
17558
+ const _sfc_main$N = {
17480
17559
  __name: "CoreSvgCurve",
17481
17560
  props: {
17482
17561
  extendX: { type: Number, default: 0 },
@@ -17494,7 +17573,7 @@ const _sfc_main$M = {
17494
17573
  const emit = __emit;
17495
17574
  const binds = computed(() => {
17496
17575
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
17497
- return __props.data.map((group) => group.map(({
17576
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
17498
17577
  points,
17499
17578
  fill,
17500
17579
  color: color2,
@@ -17536,11 +17615,11 @@ const _sfc_main$M = {
17536
17615
  }).filter((x2) => x2 != null));
17537
17616
  });
17538
17617
  return (_ctx, _cache) => {
17539
- return openBlock(), createElementBlock("g", null, [
17618
+ return openBlock(), createElementBlock("g", _hoisted_1$g, [
17540
17619
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17541
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17620
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17542
17621
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17543
- return openBlock(), createBlock(_sfc_main$N, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17622
+ return openBlock(), createBlock(_sfc_main$O, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17544
17623
  }), 256))
17545
17624
  ], 16);
17546
17625
  }), 256))
@@ -17548,8 +17627,8 @@ const _sfc_main$M = {
17548
17627
  };
17549
17628
  }
17550
17629
  };
17551
- const _hoisted_1$6 = { key: 0 };
17552
- const _sfc_main$L = {
17630
+ const _hoisted_1$f = { key: 0 };
17631
+ const _sfc_main$M = {
17553
17632
  __name: "CoreEllipse",
17554
17633
  props: {
17555
17634
  cx: { type: Number, default: 0 },
@@ -17589,12 +17668,13 @@ const _sfc_main$L = {
17589
17668
  });
17590
17669
  return (_ctx, _cache) => {
17591
17670
  return openBlock(), createElementBlock("ellipse", normalizeProps(guardReactiveProps(binds.value)), [
17592
- __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$6, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17671
+ __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$f, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
17593
17672
  ], 16);
17594
17673
  };
17595
17674
  }
17596
17675
  };
17597
- const _sfc_main$K = {
17676
+ const _hoisted_1$e = { class: "vvplot-layer vvplot-layer-ellipse" };
17677
+ const _sfc_main$L = {
17598
17678
  __name: "CoreSvgEllipse",
17599
17679
  props: {
17600
17680
  extendX: { type: Number, default: 0 },
@@ -17612,7 +17692,7 @@ const _sfc_main$K = {
17612
17692
  const emit = __emit;
17613
17693
  const binds = computed(() => {
17614
17694
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
17615
- return __props.data.map((group) => group.map(({
17695
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
17616
17696
  cx,
17617
17697
  cy,
17618
17698
  A,
@@ -17664,11 +17744,11 @@ const _sfc_main$K = {
17664
17744
  }).filter((x2) => x2 != null));
17665
17745
  });
17666
17746
  return (_ctx, _cache) => {
17667
- return openBlock(), createElementBlock("g", null, [
17747
+ return openBlock(), createElementBlock("g", _hoisted_1$e, [
17668
17748
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17669
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17749
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17670
17750
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17671
- return openBlock(), createBlock(_sfc_main$L, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17751
+ return openBlock(), createBlock(_sfc_main$M, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17672
17752
  }), 256))
17673
17753
  ], 16);
17674
17754
  }), 256))
@@ -17676,7 +17756,8 @@ const _sfc_main$K = {
17676
17756
  };
17677
17757
  }
17678
17758
  };
17679
- const _sfc_main$J = {
17759
+ const _hoisted_1$d = { class: "vvplot-layer vvplot-layer-line" };
17760
+ const _sfc_main$K = {
17680
17761
  __name: "CoreSvgLine",
17681
17762
  props: {
17682
17763
  extendX: { type: Number, default: 0 },
@@ -17694,7 +17775,7 @@ const _sfc_main$J = {
17694
17775
  const emit = __emit;
17695
17776
  const binds = computed(() => {
17696
17777
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
17697
- return __props.data.map((group) => group.map(({
17778
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
17698
17779
  x: x2,
17699
17780
  y: y2,
17700
17781
  xend,
@@ -17739,11 +17820,11 @@ const _sfc_main$J = {
17739
17820
  }).filter((x2) => x2 != null));
17740
17821
  });
17741
17822
  return (_ctx, _cache) => {
17742
- return openBlock(), createElementBlock("g", null, [
17823
+ return openBlock(), createElementBlock("g", _hoisted_1$d, [
17743
17824
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17744
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17825
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17745
17826
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17746
- return openBlock(), createBlock(_sfc_main$P, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17827
+ return openBlock(), createBlock(_sfc_main$Q, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17747
17828
  }), 256))
17748
17829
  ], 16);
17749
17830
  }), 256))
@@ -17751,7 +17832,8 @@ const _sfc_main$J = {
17751
17832
  };
17752
17833
  }
17753
17834
  };
17754
- const _sfc_main$I = {
17835
+ const _hoisted_1$c = { class: "vvplot-layer" };
17836
+ const _sfc_main$J = {
17755
17837
  __name: "CoreSvgMarkdown",
17756
17838
  props: {
17757
17839
  extendX: { type: Number, default: 0 },
@@ -17769,7 +17851,7 @@ const _sfc_main$I = {
17769
17851
  const emit = __emit;
17770
17852
  const binds = computed(() => {
17771
17853
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
17772
- return __props.data.map((group) => group.map(({
17854
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
17773
17855
  x: x2,
17774
17856
  y: y2,
17775
17857
  size = 4,
@@ -17838,11 +17920,11 @@ const _sfc_main$I = {
17838
17920
  }).filter((x2) => x2 != null));
17839
17921
  });
17840
17922
  return (_ctx, _cache) => {
17841
- return openBlock(), createElementBlock("g", null, [
17923
+ return openBlock(), createElementBlock("g", _hoisted_1$c, [
17842
17924
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17843
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17925
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17844
17926
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17845
- return openBlock(), createBlock(_sfc_main$16, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17927
+ return openBlock(), createBlock(_sfc_main$17, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17846
17928
  }), 256))
17847
17929
  ], 16);
17848
17930
  }), 256))
@@ -17850,7 +17932,8 @@ const _sfc_main$I = {
17850
17932
  };
17851
17933
  }
17852
17934
  };
17853
- const _sfc_main$H = {
17935
+ const _hoisted_1$b = { class: "vvplot-layer" };
17936
+ const _sfc_main$I = {
17854
17937
  __name: "CoreSvgMarkdownsegment",
17855
17938
  props: {
17856
17939
  extendX: { type: Number, default: 0 },
@@ -17868,7 +17951,7 @@ const _sfc_main$H = {
17868
17951
  const emit = __emit;
17869
17952
  const binds = computed(() => {
17870
17953
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
17871
- return __props.data.map((group) => group.map(({
17954
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
17872
17955
  x: x2,
17873
17956
  xend,
17874
17957
  y: y2,
@@ -17959,11 +18042,11 @@ const _sfc_main$H = {
17959
18042
  }).filter((x2) => x2 != null));
17960
18043
  });
17961
18044
  return (_ctx, _cache) => {
17962
- return openBlock(), createElementBlock("g", null, [
18045
+ return openBlock(), createElementBlock("g", _hoisted_1$b, [
17963
18046
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
17964
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18047
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
17965
18048
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
17966
- return openBlock(), createBlock(_sfc_main$16, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
18049
+ return openBlock(), createBlock(_sfc_main$17, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
17967
18050
  }), 256))
17968
18051
  ], 16);
17969
18052
  }), 256))
@@ -17971,7 +18054,8 @@ const _sfc_main$H = {
17971
18054
  };
17972
18055
  }
17973
18056
  };
17974
- const _sfc_main$G = {
18057
+ const _hoisted_1$a = { class: "vvplot-layer" };
18058
+ const _sfc_main$H = {
17975
18059
  __name: "CoreSvgPoint",
17976
18060
  props: {
17977
18061
  extendX: { type: Number, default: 0 },
@@ -17989,7 +18073,7 @@ const _sfc_main$G = {
17989
18073
  const emit = __emit;
17990
18074
  const binds = computed(() => {
17991
18075
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
17992
- return __props.data.map((group) => group.map(({
18076
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
17993
18077
  x: x2,
17994
18078
  y: y2,
17995
18079
  shape: shape2,
@@ -18038,11 +18122,11 @@ const _sfc_main$G = {
18038
18122
  }).filter((x2) => x2 != null));
18039
18123
  });
18040
18124
  return (_ctx, _cache) => {
18041
- return openBlock(), createElementBlock("g", null, [
18125
+ return openBlock(), createElementBlock("g", _hoisted_1$a, [
18042
18126
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
18043
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18127
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18044
18128
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
18045
- return openBlock(), createBlock(_sfc_main$Q, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
18129
+ return openBlock(), createBlock(_sfc_main$R, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
18046
18130
  }), 256))
18047
18131
  ], 16);
18048
18132
  }), 256))
@@ -18050,8 +18134,8 @@ const _sfc_main$G = {
18050
18134
  };
18051
18135
  }
18052
18136
  };
18053
- const _hoisted_1$5 = { key: 0 };
18054
- const _sfc_main$F = {
18137
+ const _hoisted_1$9 = { key: 0 };
18138
+ const _sfc_main$G = {
18055
18139
  __name: "CorePolygon",
18056
18140
  props: {
18057
18141
  points: { type: Array, default: () => [] },
@@ -18080,12 +18164,13 @@ const _sfc_main$F = {
18080
18164
  });
18081
18165
  return (_ctx, _cache) => {
18082
18166
  return openBlock(), createElementBlock("polygon", normalizeProps(guardReactiveProps(binds.value)), [
18083
- __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$5, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
18167
+ __props.title ? (openBlock(), createElementBlock("title", _hoisted_1$9, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
18084
18168
  ], 16);
18085
18169
  };
18086
18170
  }
18087
18171
  };
18088
- const _sfc_main$E = {
18172
+ const _hoisted_1$8 = { class: "vvplot-layer" };
18173
+ const _sfc_main$F = {
18089
18174
  __name: "CoreSvgPolygon",
18090
18175
  props: {
18091
18176
  extendX: { type: Number, default: 0 },
@@ -18103,7 +18188,7 @@ const _sfc_main$E = {
18103
18188
  const emit = __emit;
18104
18189
  const binds = computed(() => {
18105
18190
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
18106
- return __props.data.map((group) => group.map(({
18191
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
18107
18192
  points,
18108
18193
  fill,
18109
18194
  color: color2,
@@ -18145,11 +18230,11 @@ const _sfc_main$E = {
18145
18230
  }).filter((x2) => x2 != null));
18146
18231
  });
18147
18232
  return (_ctx, _cache) => {
18148
- return openBlock(), createElementBlock("g", null, [
18233
+ return openBlock(), createElementBlock("g", _hoisted_1$8, [
18149
18234
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
18150
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18235
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18151
18236
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
18152
- return openBlock(), createBlock(_sfc_main$F, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
18237
+ return openBlock(), createBlock(_sfc_main$G, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
18153
18238
  }), 256))
18154
18239
  ], 16);
18155
18240
  }), 256))
@@ -18157,7 +18242,8 @@ const _sfc_main$E = {
18157
18242
  };
18158
18243
  }
18159
18244
  };
18160
- const _sfc_main$D = {
18245
+ const _hoisted_1$7 = { class: "vvplot-layer" };
18246
+ const _sfc_main$E = {
18161
18247
  __name: "CoreSvgRect",
18162
18248
  props: {
18163
18249
  extendX: { type: Number, default: 0 },
@@ -18175,7 +18261,7 @@ const _sfc_main$D = {
18175
18261
  const emit = __emit;
18176
18262
  const binds = computed(() => {
18177
18263
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
18178
- return __props.data.map((group) => group.map(({
18264
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
18179
18265
  xmin,
18180
18266
  xmax,
18181
18267
  ymin,
@@ -18217,11 +18303,11 @@ const _sfc_main$D = {
18217
18303
  }).filter((x2) => x2 != null));
18218
18304
  });
18219
18305
  return (_ctx, _cache) => {
18220
- return openBlock(), createElementBlock("g", null, [
18306
+ return openBlock(), createElementBlock("g", _hoisted_1$7, [
18221
18307
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
18222
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18308
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18223
18309
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
18224
- return openBlock(), createBlock(_sfc_main$R, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
18310
+ return openBlock(), createBlock(_sfc_main$S, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
18225
18311
  }), 256))
18226
18312
  ], 16);
18227
18313
  }), 256))
@@ -18229,7 +18315,8 @@ const _sfc_main$D = {
18229
18315
  };
18230
18316
  }
18231
18317
  };
18232
- const _sfc_main$C = {
18318
+ const _hoisted_1$6 = { class: "vvplot-layer" };
18319
+ const _sfc_main$D = {
18233
18320
  __name: "CoreSvgText",
18234
18321
  props: {
18235
18322
  extendX: { type: Number, default: 0 },
@@ -18247,7 +18334,7 @@ const _sfc_main$C = {
18247
18334
  const emit = __emit;
18248
18335
  const binds = computed(() => {
18249
18336
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
18250
- return __props.data.map((group) => group.map(({
18337
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
18251
18338
  x: x2,
18252
18339
  y: y2,
18253
18340
  size = 4,
@@ -18316,11 +18403,11 @@ const _sfc_main$C = {
18316
18403
  }).filter((x2) => x2 != null));
18317
18404
  });
18318
18405
  return (_ctx, _cache) => {
18319
- return openBlock(), createElementBlock("g", null, [
18406
+ return openBlock(), createElementBlock("g", _hoisted_1$6, [
18320
18407
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
18321
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18408
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18322
18409
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von]) => {
18323
- return openBlock(), createBlock(_sfc_main$17, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
18410
+ return openBlock(), createBlock(_sfc_main$18, mergeProps({ ref_for: true }, vbind, toHandlers(von)), null, 16);
18324
18411
  }), 256))
18325
18412
  ], 16);
18326
18413
  }), 256))
@@ -18328,7 +18415,8 @@ const _sfc_main$C = {
18328
18415
  };
18329
18416
  }
18330
18417
  };
18331
- const _sfc_main$B = {
18418
+ const _hoisted_1$5 = { class: "vvplot-layer" };
18419
+ const _sfc_main$C = {
18332
18420
  __name: "CoreSvgTextsegment",
18333
18421
  props: {
18334
18422
  extendX: { type: Number, default: 0 },
@@ -18346,7 +18434,7 @@ const _sfc_main$B = {
18346
18434
  const emit = __emit;
18347
18435
  const binds = computed(() => {
18348
18436
  let xlim_min = -__props.layout.fullWidth * __props.extendX - __props.layout.l, xlim_max = __props.layout.fullWidth * (1 + __props.extendX) - __props.layout.l, ylim_min = -__props.layout.fullHeight * __props.extendY - __props.layout.t, ylim_max = __props.layout.fullHeight * (1 + __props.extendY) - __props.layout.t;
18349
- return __props.data.map((group) => group.map(({
18437
+ return Object.values(Object.groupBy(__props.data, (d) => d.$group)).map((group) => group.map(({
18350
18438
  x: x2,
18351
18439
  xend,
18352
18440
  y: y2,
@@ -18480,9 +18568,9 @@ const _sfc_main$B = {
18480
18568
  return result;
18481
18569
  }
18482
18570
  return (_ctx, _cache) => {
18483
- return openBlock(), createElementBlock("g", null, [
18571
+ return openBlock(), createElementBlock("g", _hoisted_1$5, [
18484
18572
  (openBlock(true), createElementBlock(Fragment, null, renderList(binds.value, (group) => {
18485
- return openBlock(), createElementBlock("g", mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18573
+ return openBlock(), createElementBlock("g", mergeProps({ class: "vvplot-group" }, { ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
18486
18574
  (openBlock(true), createElementBlock(Fragment, null, renderList(group, ([vbind, von, content, title]) => {
18487
18575
  return openBlock(), createElementBlock("text", mergeProps({ ref_for: true }, vbind, toHandlers(von, true)), [
18488
18576
  createElementVNode("title", null, toDisplayString(title), 1),
@@ -18507,23 +18595,23 @@ const _sfc_main$B = {
18507
18595
  };
18508
18596
  const svg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18509
18597
  __proto__: null,
18510
- blank: _sfc_main$S,
18511
- boxplot: _sfc_main$O,
18512
- curve: _sfc_main$M,
18513
- ellipse: _sfc_main$K,
18514
- line: _sfc_main$J,
18515
- markdown: _sfc_main$I,
18516
- markdownsegment: _sfc_main$H,
18517
- point: _sfc_main$G,
18518
- polygon: _sfc_main$E,
18519
- rect: _sfc_main$D,
18520
- shape: _sfc_main$M,
18521
- stick: _sfc_main$J,
18522
- text: _sfc_main$C,
18523
- textsegment: _sfc_main$B,
18524
- tile: _sfc_main$D
18598
+ blank: _sfc_main$T,
18599
+ boxplot: _sfc_main$P,
18600
+ curve: _sfc_main$N,
18601
+ ellipse: _sfc_main$L,
18602
+ line: _sfc_main$K,
18603
+ markdown: _sfc_main$J,
18604
+ markdownsegment: _sfc_main$I,
18605
+ point: _sfc_main$H,
18606
+ polygon: _sfc_main$F,
18607
+ rect: _sfc_main$E,
18608
+ shape: _sfc_main$N,
18609
+ stick: _sfc_main$K,
18610
+ text: _sfc_main$D,
18611
+ textsegment: _sfc_main$C,
18612
+ tile: _sfc_main$E
18525
18613
  }, Symbol.toStringTag, { value: "Module" }));
18526
- const _sfc_main$A = {
18614
+ const _sfc_main$B = {
18527
18615
  __name: "CoreLayer",
18528
18616
  props: {
18529
18617
  data: Object,
@@ -18564,7 +18652,7 @@ const _sfc_main$A = {
18564
18652
  };
18565
18653
  const _hoisted_1$4 = { key: 0 };
18566
18654
  const _hoisted_2$3 = ["onPointerdown"];
18567
- const _sfc_main$z = {
18655
+ const _sfc_main$A = {
18568
18656
  __name: "CoreSelection",
18569
18657
  props: /* @__PURE__ */ mergeModels({
18570
18658
  coord2pos: Function,
@@ -18653,9 +18741,6 @@ const _sfc_main$z = {
18653
18741
  transform2.push(`scale(${sclH}, ${sclV})`);
18654
18742
  return transform2.join(" ") || null;
18655
18743
  });
18656
- const translating = computed(
18657
- () => __props.activeTransform.translateH != 0 || __props.activeTransform.translateV != 0 || __props.activeTransform.scaleH != 1 || __props.activeTransform.scaleV != 1
18658
- );
18659
18744
  const rectBind = computed(() => {
18660
18745
  if (!position.value) return null;
18661
18746
  let { hmin, hmax, vmin, vmax, pos } = position.value;
@@ -18680,7 +18765,7 @@ const _sfc_main$z = {
18680
18765
  };
18681
18766
  });
18682
18767
  const interactiveBind = computed(() => {
18683
- if (!position.value || translating.value) return null;
18768
+ if (!position.value) return null;
18684
18769
  let size = 10;
18685
18770
  let { hmin, hmax, vmin, vmax, pos } = position.value;
18686
18771
  let width = Math.max(0, hmax - hmin), height = Math.max(0, vmax - vmin);
@@ -18695,7 +18780,7 @@ const _sfc_main$z = {
18695
18780
  };
18696
18781
  if (config.resize) {
18697
18782
  if (pos.hmin != null)
18698
- binds.l = { x: hmin - size / 2, y: vmin, width: size, height, style: "cursor:ew-resize;", class: "vvplot-interactive" };
18783
+ binds.l = { x: hmin - size / 2, y: vmin, width: size, height, style: "cursor:ew-resize;" };
18699
18784
  if (pos.hmax != null)
18700
18785
  binds.r = { x: hmax - size / 2, y: vmin, width: size, height, style: "cursor:ew-resize;" };
18701
18786
  if (pos.vmin != null)
@@ -18775,8 +18860,7 @@ const _sfc_main$z = {
18775
18860
  if (ymin > ymax) [ymin, ymax] = [ymax, ymin];
18776
18861
  emit("selecting", { xmin, xmax, ymin, ymax }, __props.theme);
18777
18862
  };
18778
- e.target.onpointerup = (ev) => {
18779
- ev.currentTarget.onpointerup = null;
18863
+ e.target.addEventListener("pointerup", function(ev) {
18780
18864
  ev.currentTarget.onpointermove = null;
18781
18865
  if (config.buttons & 1) {
18782
18866
  ev.currentTarget.onclick = (event2) => {
@@ -18802,7 +18886,7 @@ const _sfc_main$z = {
18802
18886
  model.value = dropNull(res);
18803
18887
  emit("selectend");
18804
18888
  emit("select", dropNull(res), event);
18805
- };
18889
+ }, { once: true });
18806
18890
  }
18807
18891
  return (_ctx, _cache) => {
18808
18892
  return rectBind.value ? (openBlock(), createElementBlock("g", _hoisted_1$4, [
@@ -18821,7 +18905,7 @@ const _sfc_main$z = {
18821
18905
  const _hoisted_1$3 = ["height", "width"];
18822
18906
  const _hoisted_2$2 = ["y1", "y2"];
18823
18907
  const _hoisted_3$2 = ["y"];
18824
- const _sfc_main$y = {
18908
+ const _sfc_main$z = {
18825
18909
  __name: "CoreGuideGradientbar",
18826
18910
  props: {
18827
18911
  scales: Array,
@@ -18861,7 +18945,7 @@ const _sfc_main$y = {
18861
18945
  ref: "svg"
18862
18946
  }, [
18863
18947
  (openBlock(true), createElementBlock(Fragment, null, renderList(gradient_values.value, (v, i) => {
18864
- return openBlock(), createBlock(_sfc_main$R, mergeProps({
18948
+ return openBlock(), createBlock(_sfc_main$S, mergeProps({
18865
18949
  width: 10,
18866
18950
  height: 3.1,
18867
18951
  x: 10,
@@ -18893,12 +18977,12 @@ const _sfc_main$y = {
18893
18977
  };
18894
18978
  const element = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18895
18979
  __proto__: null,
18896
- curve: _sfc_main$N,
18897
- line: _sfc_main$P,
18898
- point: _sfc_main$Q,
18899
- polygon: _sfc_main$F,
18900
- text: _sfc_main$17,
18901
- tile: _sfc_main$R
18980
+ curve: _sfc_main$O,
18981
+ line: _sfc_main$Q,
18982
+ point: _sfc_main$R,
18983
+ polygon: _sfc_main$G,
18984
+ text: _sfc_main$18,
18985
+ tile: _sfc_main$S
18902
18986
  }, Symbol.toStringTag, { value: "Module" }));
18903
18987
  const _hoisted_1$2 = ["height", "width"];
18904
18988
  const _hoisted_2$1 = ["transform"];
@@ -18908,7 +18992,7 @@ const _hoisted_4$1 = {
18908
18992
  y: "10",
18909
18993
  "alignment-baseline": "central"
18910
18994
  };
18911
- const _sfc_main$x = {
18995
+ const _sfc_main$y = {
18912
18996
  __name: "CoreGuideLegendkey",
18913
18997
  props: {
18914
18998
  scales: Array,
@@ -18975,7 +19059,7 @@ const _sfc_main$x = {
18975
19059
  };
18976
19060
  }
18977
19061
  };
18978
- const _sfc_main$w = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19062
+ const _sfc_main$x = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
18979
19063
  __name: "CoreGuide",
18980
19064
  props: {
18981
19065
  scales: Array,
@@ -18983,8 +19067,8 @@ const _sfc_main$w = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
18983
19067
  },
18984
19068
  setup(__props) {
18985
19069
  const guide = {
18986
- legendkey: _sfc_main$x,
18987
- gradientbar: _sfc_main$y
19070
+ legendkey: _sfc_main$y,
19071
+ gradientbar: _sfc_main$z
18988
19072
  };
18989
19073
  const title = computed(() => {
18990
19074
  return __props.scales.reduce((v, [s]) => v ?? s.title, null) ?? __props.scales.reduce((v, [s]) => v ?? s._title, null);
@@ -19028,7 +19112,7 @@ const _sfc_main$w = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19028
19112
  };
19029
19113
  }
19030
19114
  });
19031
- const _sfc_main$v = {
19115
+ const _sfc_main$w = {
19032
19116
  __name: "CoreLegend",
19033
19117
  props: {
19034
19118
  theme: { type: Object, default: () => ({}) },
@@ -19062,7 +19146,7 @@ const _sfc_main$v = {
19062
19146
  style: normalizeStyle({ gap: __props.theme.spacing + "px" })
19063
19147
  }, [
19064
19148
  (openBlock(true), createElementBlock(Fragment, null, renderList(guides.value, ([[key, type], scales]) => {
19065
- return openBlock(), createBlock(_sfc_main$w, {
19149
+ return openBlock(), createBlock(_sfc_main$x, {
19066
19150
  key,
19067
19151
  type,
19068
19152
  scales
@@ -19076,11 +19160,11 @@ const _hoisted_1$1 = ["id"];
19076
19160
  const _hoisted_2 = ["width", "height"];
19077
19161
  const _hoisted_3 = ["transform", "width", "height", "fill"];
19078
19162
  const _hoisted_4 = ["transform"];
19079
- const _hoisted_5 = ["transform", "clip-path"];
19080
- const _hoisted_6 = ["transform"];
19081
- const _hoisted_7 = ["clip-path"];
19163
+ const _hoisted_5 = ["transform"];
19164
+ const _hoisted_6 = ["clip-path"];
19165
+ const _hoisted_7 = ["transform", "clip-path"];
19082
19166
  const _hoisted_8 = { key: 1 };
19083
- const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19167
+ const _sfc_main$v = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19084
19168
  __name: "CorePlot",
19085
19169
  props: /* @__PURE__ */ mergeModels({
19086
19170
  schema: Object,
@@ -19124,6 +19208,7 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19124
19208
  "pointermove",
19125
19209
  "wheel",
19126
19210
  "select",
19211
+ "selecting",
19127
19212
  "move",
19128
19213
  "zoom",
19129
19214
  "rescale",
@@ -19431,11 +19516,13 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19431
19516
  res.ymin = ystart > yend ? yend : ystart;
19432
19517
  res.ymax = ystart > yend ? ystart : yend;
19433
19518
  }
19519
+ if (!emitEvent(sel["onSelecting"], dropNull(res), sel.theme)) {
19520
+ emit("selecting", dropNull(res), sel.theme);
19521
+ }
19434
19522
  selectionPreview.value = res;
19435
19523
  selectionPreviewTheme.value = sel.theme;
19436
19524
  };
19437
- e.target.onpointerup = (ev) => {
19438
- ev.currentTarget.onpointerup = null;
19525
+ e.target.addEventListener("pointerup", function(ev) {
19439
19526
  ev.currentTarget.onpointermove = null;
19440
19527
  svg2.style.userSelect = null;
19441
19528
  selectionPreview.value = {};
@@ -19483,7 +19570,7 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19483
19570
  emit("select", dropNull(res), event);
19484
19571
  }
19485
19572
  }
19486
- };
19573
+ }, { once: true });
19487
19574
  return;
19488
19575
  }
19489
19576
  let act = props.action.find((a) => a.action == "move" && ["buttons", "ctrlKey", "shiftKey", "altKey", "metaKey"].every((k) => a[k] == e[k]));
@@ -19513,15 +19600,14 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19513
19600
  let { xmin, xmax, ymin, ymax } = pos2coord({ hmin: h1, hmax: h2, vmin: v1, vmax: v2 });
19514
19601
  Object.assign(rangePreview, { xmin, xmax, ymin, ymax });
19515
19602
  };
19516
- e.target.onpointerup = (ev) => {
19517
- ev.currentTarget.onpointerup = null;
19603
+ e.target.addEventListener("pointerup", function(ev) {
19518
19604
  ev.currentTarget.onpointermove = null;
19519
19605
  svg2.style.userSelect = null;
19520
19606
  moveTimer = setTimeout(() => {
19521
19607
  applyTransform(act, ev);
19522
19608
  movementX = movementY = 0;
19523
19609
  }, 300);
19524
- };
19610
+ }, { once: true });
19525
19611
  return;
19526
19612
  }
19527
19613
  }
@@ -19779,7 +19865,7 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19779
19865
  transform: `translate(${unref(panel).left}, ${unref(panel).top})`,
19780
19866
  style: { "pointer-events": "none" }
19781
19867
  }, [
19782
- createVNode(_sfc_main$11, {
19868
+ createVNode(_sfc_main$12, {
19783
19869
  breaks: gridBreaks.value.h,
19784
19870
  layout: unref(innerRect),
19785
19871
  activeTransform: activeTransform.value,
@@ -19787,7 +19873,7 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19787
19873
  transition: transition.value
19788
19874
  }, null, 8, ["breaks", "layout", "activeTransform", "transition"]),
19789
19875
  _cache[2] || (_cache[2] = createTextVNode()),
19790
- createVNode(_sfc_main$10, {
19876
+ createVNode(_sfc_main$11, {
19791
19877
  breaks: gridBreaks.value.v,
19792
19878
  layout: unref(innerRect),
19793
19879
  activeTransform: activeTransform.value,
@@ -19796,6 +19882,30 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19796
19882
  }, null, 8, ["breaks", "layout", "activeTransform", "transition"])
19797
19883
  ], 8, _hoisted_4),
19798
19884
  _cache[8] || (_cache[8] = createTextVNode()),
19885
+ createElementVNode("g", {
19886
+ transform: `translate(${unref(panel).left}, ${unref(panel).top})`
19887
+ }, [
19888
+ (openBlock(true), createElementBlock(Fragment, null, renderList(axes.value.filter((a) => typeof a.bind.position !== "number"), (axis) => {
19889
+ return openBlock(), createBlock(_sfc_main$13, mergeProps({ ref_for: true }, axis.bind, toHandlers(axis.on), {
19890
+ transition: transition.value,
19891
+ "onUpdate:transition": _cache[0] || (_cache[0] = ($event) => transition.value = $event),
19892
+ activeTransform: activeTransform.value
19893
+ }), null, 16, ["transition", "activeTransform"]);
19894
+ }), 256)),
19895
+ _cache[3] || (_cache[3] = createTextVNode()),
19896
+ createElementVNode("g", {
19897
+ "clip-path": props.clip ? `url(#${unref(vid)}-plot-clip)` : null
19898
+ }, [
19899
+ (openBlock(true), createElementBlock(Fragment, null, renderList(axes.value.filter((a) => typeof a.bind.position === "number"), (axis) => {
19900
+ return openBlock(), createBlock(_sfc_main$13, mergeProps({ ref_for: true }, axis.bind, toHandlers(axis.on), {
19901
+ transition: transition.value,
19902
+ "onUpdate:transition": _cache[1] || (_cache[1] = ($event) => transition.value = $event),
19903
+ activeTransform: activeTransform.value
19904
+ }), null, 16, ["transition", "activeTransform"]);
19905
+ }), 256))
19906
+ ], 8, _hoisted_6)
19907
+ ], 8, _hoisted_5),
19908
+ _cache[9] || (_cache[9] = createTextVNode()),
19799
19909
  createElementVNode("g", {
19800
19910
  transform: `translate(${unref(panel).left}, ${unref(panel).top})`,
19801
19911
  "clip-path": props.clip ? `url(#${unref(vid)}-plot-clip)` : null
@@ -19804,7 +19914,7 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19804
19914
  style: { transition: transition.value }
19805
19915
  }), [
19806
19916
  (openBlock(true), createElementBlock(Fragment, null, renderList(vplot.value.layers, (layer) => {
19807
- return openBlock(), createBlock(_sfc_main$A, mergeProps({
19917
+ return openBlock(), createBlock(_sfc_main$B, mergeProps({
19808
19918
  ref_for: true,
19809
19919
  ref_key: "layers",
19810
19920
  ref: layers,
@@ -19819,9 +19929,9 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19819
19929
  }), null, 16, ["data", "layout", "geom", "default-render", "default-dpi"]);
19820
19930
  }), 256))
19821
19931
  ], 16),
19822
- _cache[3] || (_cache[3] = createTextVNode()),
19932
+ _cache[4] || (_cache[4] = createTextVNode()),
19823
19933
  (openBlock(true), createElementBlock(Fragment, null, renderList(props.selections, (sel) => {
19824
- return openBlock(), createBlock(_sfc_main$z, mergeProps({
19934
+ return openBlock(), createBlock(_sfc_main$A, mergeProps({
19825
19935
  coord2pos,
19826
19936
  pos2coord,
19827
19937
  layout: unref(innerRect),
@@ -19831,8 +19941,8 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19831
19941
  activeTransform: activeTransform.value
19832
19942
  }, { ref_for: true }, sel, { flip: __props.flip }), null, 16, ["layout", "transition", "activeTransform", "flip"]);
19833
19943
  }), 256)),
19834
- _cache[4] || (_cache[4] = createTextVNode()),
19835
- createVNode(_sfc_main$z, {
19944
+ _cache[5] || (_cache[5] = createTextVNode()),
19945
+ createVNode(_sfc_main$A, {
19836
19946
  coord2pos,
19837
19947
  pos2coord,
19838
19948
  layout: unref(innerRect),
@@ -19842,31 +19952,7 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19842
19952
  theme: _selectionPreviewTheme.value,
19843
19953
  flip: __props.flip
19844
19954
  }, null, 8, ["layout", "modelValue", "transition", "activeTransform", "theme", "flip"])
19845
- ], 8, _hoisted_5),
19846
- _cache[9] || (_cache[9] = createTextVNode()),
19847
- createElementVNode("g", {
19848
- transform: `translate(${unref(panel).left}, ${unref(panel).top})`
19849
- }, [
19850
- (openBlock(true), createElementBlock(Fragment, null, renderList(axes.value.filter((a) => typeof a.bind.position !== "number"), (axis) => {
19851
- return openBlock(), createBlock(_sfc_main$12, mergeProps({ ref_for: true }, axis.bind, toHandlers(axis.on), {
19852
- transition: transition.value,
19853
- "onUpdate:transition": _cache[0] || (_cache[0] = ($event) => transition.value = $event),
19854
- activeTransform: activeTransform.value
19855
- }), null, 16, ["transition", "activeTransform"]);
19856
- }), 256)),
19857
- _cache[5] || (_cache[5] = createTextVNode()),
19858
- createElementVNode("g", {
19859
- "clip-path": props.clip ? `url(#${unref(vid)}-plot-clip)` : null
19860
- }, [
19861
- (openBlock(true), createElementBlock(Fragment, null, renderList(axes.value.filter((a) => typeof a.bind.position === "number"), (axis) => {
19862
- return openBlock(), createBlock(_sfc_main$12, mergeProps({ ref_for: true }, axis.bind, toHandlers(axis.on), {
19863
- transition: transition.value,
19864
- "onUpdate:transition": _cache[1] || (_cache[1] = ($event) => transition.value = $event),
19865
- activeTransform: activeTransform.value
19866
- }), null, 16, ["transition", "activeTransform"]);
19867
- }), 256))
19868
- ], 8, _hoisted_7)
19869
- ], 8, _hoisted_6),
19955
+ ], 8, _hoisted_7),
19870
19956
  _cache[10] || (_cache[10] = createTextVNode()),
19871
19957
  renderSlot(_ctx.$slots, "default"),
19872
19958
  _cache[11] || (_cache[11] = createTextVNode()),
@@ -19875,7 +19961,7 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19875
19961
  defer: "",
19876
19962
  to: props.legendTeleport
19877
19963
  }, [
19878
- createVNode(_sfc_main$v, {
19964
+ createVNode(_sfc_main$w, {
19879
19965
  scales: vplot.value?.scales,
19880
19966
  theme: __props.theme.legend
19881
19967
  }, null, 8, ["scales", "theme"])
@@ -19885,14 +19971,14 @@ const _sfc_main$u = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
19885
19971
  };
19886
19972
  }
19887
19973
  });
19888
- const _sfc_main$t = {
19974
+ const _sfc_main$u = {
19889
19975
  $_type: "action",
19890
19976
  $_props: {}
19891
19977
  };
19892
- const _sfc_main$s = {
19978
+ const _sfc_main$t = {
19893
19979
  $_type: "layer"
19894
19980
  };
19895
- const _sfc_main$r = {
19981
+ const _sfc_main$s = {
19896
19982
  $_props: {
19897
19983
  geom: "tile",
19898
19984
  stat: "bar"
@@ -19900,14 +19986,14 @@ const _sfc_main$r = {
19900
19986
  $_type: "layer",
19901
19987
  $_argnames: ["width", "height", "position"]
19902
19988
  };
19903
- const _sfc_main$q = {
19989
+ const _sfc_main$r = {
19904
19990
  $_props: {
19905
19991
  geom: "blank",
19906
19992
  stat: "identity"
19907
19993
  },
19908
19994
  $_type: "layer"
19909
19995
  };
19910
- const _sfc_main$p = {
19996
+ const _sfc_main$q = {
19911
19997
  $_props: {
19912
19998
  geom: "boxplot",
19913
19999
  stat: "boxplot"
@@ -19915,6 +20001,14 @@ const _sfc_main$p = {
19915
20001
  $_type: "layer",
19916
20002
  $_argnames: ["width", "height", "position"]
19917
20003
  };
20004
+ const _sfc_main$p = {
20005
+ $_props: {
20006
+ geom: "tile",
20007
+ stat: "col"
20008
+ },
20009
+ $_type: "layer",
20010
+ $_argnames: ["width", "height", "position", "orientation"]
20011
+ };
19918
20012
  const _sfc_main$o = {
19919
20013
  $_props: {
19920
20014
  geom: "curve",
@@ -20064,10 +20158,11 @@ const _sfc_main$6 = {
20064
20158
  };
20065
20159
  const geom_components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
20066
20160
  __proto__: null,
20067
- VVGeom: _sfc_main$s,
20068
- VVGeomBar: _sfc_main$r,
20069
- VVGeomBlank: _sfc_main$q,
20070
- VVGeomBoxplot: _sfc_main$p,
20161
+ VVGeom: _sfc_main$t,
20162
+ VVGeomBar: _sfc_main$s,
20163
+ VVGeomBlank: _sfc_main$r,
20164
+ VVGeomBoxplot: _sfc_main$q,
20165
+ VVGeomCol: _sfc_main$p,
20071
20166
  VVGeomCurve: _sfc_main$o,
20072
20167
  VVGeomDensity: _sfc_main$n,
20073
20168
  VVGeomEllipse: _sfc_main$m,
@@ -20156,8 +20251,8 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
20156
20251
  const components = {
20157
20252
  ...geom_components,
20158
20253
  ...axis_components,
20159
- VVAction: _sfc_main$t,
20160
- VVSelection: _sfc_main$t
20254
+ VVAction: _sfc_main$u,
20255
+ VVSelection: _sfc_main$u
20161
20256
  };
20162
20257
  const opponents = {
20163
20258
  x: "y",
@@ -20214,8 +20309,12 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
20214
20309
  }
20215
20310
  }).filter((x2) => x2 != null);
20216
20311
  let res = Object.groupBy(comps, (c) => c.type.$_type ?? "dom");
20217
- for (let type in res) {
20218
- vnodes[type][key] = res[type];
20312
+ for (let type in vnodes) {
20313
+ if (res[type] == null) {
20314
+ delete vnodes[type][key];
20315
+ } else {
20316
+ vnodes[type][key] = res[type];
20317
+ }
20219
20318
  }
20220
20319
  }, { immediate: true });
20221
20320
  }
@@ -20622,6 +20721,8 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
20622
20721
  const plotRef = useTemplateRef("plot");
20623
20722
  const width = useModel(__props, "width");
20624
20723
  const height = useModel(__props, "height");
20724
+ const visible = ref(null);
20725
+ provide("vvplot-visible", visible);
20625
20726
  onMounted(() => {
20626
20727
  watch(width, (v) => {
20627
20728
  wrapperRef.value.style.width = str_c(v, "px") ?? null;
@@ -20631,8 +20732,11 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
20631
20732
  }, { immediate: true });
20632
20733
  });
20633
20734
  let oldSize = { width: 0, height: 0 };
20634
- useResizeObserver(plotRef, (e) => {
20635
- let { width: w, height: h } = e[0].contentRect;
20735
+ useResizeObserver(plotRef, ([entry]) => {
20736
+ visible.value = entry.target.getClientRects().length > 0;
20737
+ if (!visible.value) return;
20738
+ let { width: w, height: h } = entry.contentRect;
20739
+ if (width.value - w < 0.5 && height.value - h < 0.5) return;
20636
20740
  if (wrapperRef.value.style.width) width.value = w;
20637
20741
  if (wrapperRef.value.style.height) height.value = h;
20638
20742
  if ((w > 0 || h > 0) && (oldSize.width > 0 || oldSize.height > 0))
@@ -20674,7 +20778,7 @@ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
20674
20778
  class: "vvplot",
20675
20779
  style: wrapperStyle.value
20676
20780
  }, vBind.value.wrapper), [
20677
- createVNode(_sfc_main$u, mergeProps({
20781
+ createVNode(_sfc_main$v, mergeProps({
20678
20782
  ref: "plot",
20679
20783
  paddings,
20680
20784
  schema: schema.value,
@@ -20736,15 +20840,16 @@ const _sfc_main = {
20736
20840
  };
20737
20841
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
20738
20842
  __proto__: null,
20739
- VVAction: _sfc_main$t,
20843
+ VVAction: _sfc_main$u,
20740
20844
  VVAxis: _sfc_main$5,
20741
20845
  VVAxisBreak: _sfc_main$2,
20742
20846
  VVAxisX: _sfc_main$4,
20743
20847
  VVAxisY: _sfc_main$3,
20744
- VVGeom: _sfc_main$s,
20745
- VVGeomBar: _sfc_main$r,
20746
- VVGeomBlank: _sfc_main$q,
20747
- VVGeomBoxplot: _sfc_main$p,
20848
+ VVGeom: _sfc_main$t,
20849
+ VVGeomBar: _sfc_main$s,
20850
+ VVGeomBlank: _sfc_main$r,
20851
+ VVGeomBoxplot: _sfc_main$q,
20852
+ VVGeomCol: _sfc_main$p,
20748
20853
  VVGeomCurve: _sfc_main$o,
20749
20854
  VVGeomDensity: _sfc_main$n,
20750
20855
  VVGeomEllipse: _sfc_main$m,
@@ -20768,15 +20873,16 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
20768
20873
  VVSelection: _sfc_main
20769
20874
  }, Symbol.toStringTag, { value: "Module" }));
20770
20875
  export {
20771
- _sfc_main$t as VVAction,
20876
+ _sfc_main$u as VVAction,
20772
20877
  _sfc_main$5 as VVAxis,
20773
20878
  _sfc_main$2 as VVAxisBreak,
20774
20879
  _sfc_main$4 as VVAxisX,
20775
20880
  _sfc_main$3 as VVAxisY,
20776
- _sfc_main$s as VVGeom,
20777
- _sfc_main$r as VVGeomBar,
20778
- _sfc_main$q as VVGeomBlank,
20779
- _sfc_main$p as VVGeomBoxplot,
20881
+ _sfc_main$t as VVGeom,
20882
+ _sfc_main$s as VVGeomBar,
20883
+ _sfc_main$r as VVGeomBlank,
20884
+ _sfc_main$q as VVGeomBoxplot,
20885
+ _sfc_main$p as VVGeomCol,
20780
20886
  _sfc_main$o as VVGeomCurve,
20781
20887
  _sfc_main$n as VVGeomDensity,
20782
20888
  _sfc_main$m as VVGeomEllipse,