vvplot 0.4.1 → 0.4.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.
- package/dist/vvplot.d.ts +0 -315
- package/dist/vvplot.esm.js +107 -58
- package/dist/vvplot.esm.min.js +18 -18
- package/dist/vvplot.global.js +107 -58
- package/dist/vvplot.global.min.js +18 -18
- package/package.json +1 -1
package/dist/vvplot.esm.js
CHANGED
|
@@ -1660,7 +1660,44 @@ function baseParse(input, options) {
|
|
|
1660
1660
|
new RegExp(
|
|
1661
1661
|
"\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b"
|
|
1662
1662
|
);
|
|
1663
|
-
class
|
|
1663
|
+
class AsisString extends String {
|
|
1664
|
+
static #cache = /* @__PURE__ */ new Map();
|
|
1665
|
+
constructor(str) {
|
|
1666
|
+
const s = String(str);
|
|
1667
|
+
if (AsisString.#cache.has(s)) {
|
|
1668
|
+
return AsisString.#cache.get(s);
|
|
1669
|
+
}
|
|
1670
|
+
super(s);
|
|
1671
|
+
AsisString.#cache.set(s, this);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
class AsisNumber extends Number {
|
|
1675
|
+
static #cache = /* @__PURE__ */ new Map();
|
|
1676
|
+
constructor(num2) {
|
|
1677
|
+
const n = Number(num2);
|
|
1678
|
+
if (AsisNumber.#cache.has(n)) {
|
|
1679
|
+
return AsisNumber.#cache.get(n);
|
|
1680
|
+
}
|
|
1681
|
+
super(n);
|
|
1682
|
+
AsisNumber.#cache.set(n, this);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
class Asis extends String {
|
|
1686
|
+
static #cache = /* @__PURE__ */ new Map();
|
|
1687
|
+
constructor(value) {
|
|
1688
|
+
if (typeof value === "string" || value instanceof String) {
|
|
1689
|
+
return new AsisString(value);
|
|
1690
|
+
}
|
|
1691
|
+
if (typeof value === "number" || value instanceof Number) {
|
|
1692
|
+
return new AsisNumber(value);
|
|
1693
|
+
}
|
|
1694
|
+
throw new Error("Unsupported type");
|
|
1695
|
+
}
|
|
1696
|
+
static [Symbol.hasInstance](obj) {
|
|
1697
|
+
return obj instanceof AsisString || obj instanceof AsisNumber;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
class EnumElement {
|
|
1664
1701
|
constructor(label, value, level) {
|
|
1665
1702
|
this.label = label;
|
|
1666
1703
|
this.value = value;
|
|
@@ -1676,20 +1713,20 @@ class GEnumElement {
|
|
|
1676
1713
|
return this.label;
|
|
1677
1714
|
}
|
|
1678
1715
|
}
|
|
1679
|
-
class
|
|
1716
|
+
class EnumLevel extends Array {
|
|
1680
1717
|
/**
|
|
1681
1718
|
* return:
|
|
1682
|
-
* x if x is a
|
|
1683
|
-
* new
|
|
1684
|
-
* new
|
|
1719
|
+
* x if x is a EnumLevel
|
|
1720
|
+
* new EnumLevel from distinct values of x, ordered by natural order, if x is iterable
|
|
1721
|
+
* new EnumLevel from keys of x, orderd by coresponing values, if x is an object
|
|
1685
1722
|
* @param {*} x
|
|
1686
1723
|
* @param {function} [sortkey]
|
|
1687
|
-
* @returns {
|
|
1724
|
+
* @returns {EnumLevel}
|
|
1688
1725
|
*/
|
|
1689
1726
|
static from(x2) {
|
|
1690
1727
|
if (x2 instanceof this) return x2;
|
|
1691
1728
|
if (x2[Symbol.iterator]) {
|
|
1692
|
-
let lvl = unique(Array.from(x2).map((x3) => String(x3))).sort((a, b) => compare(a, b, { numeric: true }));
|
|
1729
|
+
let lvl = unique(Array.from(x2).filter((x3) => !(x3 instanceof Asis)).map((x3) => String(x3))).sort((a, b) => compare(a, b, { numeric: true }));
|
|
1693
1730
|
return new this(...lvl);
|
|
1694
1731
|
} else if (typeof x2 === "object") {
|
|
1695
1732
|
let lvl = Object.keys(x2).map((x3) => String(x3)).sort((a, b) => compare(x2[a], x2[b]));
|
|
@@ -1698,7 +1735,7 @@ class GEnumLevel extends Array {
|
|
|
1698
1735
|
throw new Error(`Invalid level values: ${x2}`);
|
|
1699
1736
|
}
|
|
1700
1737
|
/**
|
|
1701
|
-
* Check if two
|
|
1738
|
+
* Check if two EnumLevel are equal, i.e. they have the same labels in the same order
|
|
1702
1739
|
* @param {string[]} level
|
|
1703
1740
|
*/
|
|
1704
1741
|
static isEqual(a, b) {
|
|
@@ -1707,20 +1744,20 @@ class GEnumLevel extends Array {
|
|
|
1707
1744
|
}
|
|
1708
1745
|
}
|
|
1709
1746
|
/**
|
|
1710
|
-
* build a
|
|
1747
|
+
* build a EnumLevel
|
|
1711
1748
|
* @param {string[]} level
|
|
1712
1749
|
*/
|
|
1713
1750
|
constructor(...level) {
|
|
1714
|
-
level = level.map((x2, i) => new
|
|
1751
|
+
level = level.map((x2, i) => new EnumElement(String(x2), i));
|
|
1715
1752
|
level.forEach((l) => l.level = level);
|
|
1716
1753
|
level.mapping = Object.fromEntries(level.map((fct) => [fct, fct]));
|
|
1717
|
-
Object.setPrototypeOf(level,
|
|
1754
|
+
Object.setPrototypeOf(level, EnumLevel.prototype);
|
|
1718
1755
|
return level;
|
|
1719
1756
|
}
|
|
1720
1757
|
/**
|
|
1721
1758
|
* get the level instance by index or key
|
|
1722
1759
|
* @param {(number|string)} idx
|
|
1723
|
-
* @returns {
|
|
1760
|
+
* @returns {EnumElement}
|
|
1724
1761
|
*/
|
|
1725
1762
|
getItem(idx) {
|
|
1726
1763
|
if (typeof idx === "number" || idx instanceof Number) {
|
|
@@ -1732,15 +1769,15 @@ class GEnumLevel extends Array {
|
|
|
1732
1769
|
/**
|
|
1733
1770
|
* convert an array to a GEnum array
|
|
1734
1771
|
* @param {string[]} arr array to be converted, preferably a string array (items of other types will be converted to string)
|
|
1735
|
-
* @returns {
|
|
1772
|
+
* @returns {EnumElement[]}
|
|
1736
1773
|
*/
|
|
1737
1774
|
apply(arr) {
|
|
1738
|
-
let result = arr.map((x2) => this.mapping[x2]);
|
|
1775
|
+
let result = arr.map((x2) => x2 instanceof Asis ? x2 : this.mapping[x2]);
|
|
1739
1776
|
result.level = this;
|
|
1740
1777
|
return result;
|
|
1741
1778
|
}
|
|
1742
1779
|
}
|
|
1743
|
-
function
|
|
1780
|
+
function is_continuous(x2) {
|
|
1744
1781
|
return typeof x2 === "number" || x2 instanceof Number || x2 instanceof Date;
|
|
1745
1782
|
}
|
|
1746
1783
|
function plus$1(a, b = 0) {
|
|
@@ -1750,30 +1787,30 @@ function plus$1(a, b = 0) {
|
|
|
1750
1787
|
}
|
|
1751
1788
|
const numutils = {
|
|
1752
1789
|
min(arr, { na_rm = true, infinity_rm = true } = {}) {
|
|
1753
|
-
if (na_rm) arr = arr.filter(
|
|
1790
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1754
1791
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1755
1792
|
return Array.from(arr).reduce((a, b) => a < b ? a : b, Infinity);
|
|
1756
1793
|
},
|
|
1757
1794
|
max(arr, { na_rm = true, infinity_rm = true } = {}) {
|
|
1758
|
-
if (na_rm) arr = arr.filter(
|
|
1795
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1759
1796
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1760
1797
|
return Array.from(arr).reduce((a, b) => a > b ? a : b, -Infinity);
|
|
1761
1798
|
},
|
|
1762
1799
|
mean(arr, { na_rm = true, infinity_rm = true } = {}) {
|
|
1763
|
-
if (na_rm) arr = arr.filter(
|
|
1800
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1764
1801
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1765
1802
|
if (arr.length == 0) return NaN;
|
|
1766
1803
|
return Array.from(arr).reduce((a, v) => a + v, 0) / arr.length;
|
|
1767
1804
|
},
|
|
1768
1805
|
sd(arr, { na_rm = true, infinity_rm = true } = {}) {
|
|
1769
|
-
if (na_rm) arr = arr.filter(
|
|
1806
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1770
1807
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1771
1808
|
if (arr.length <= 1) return NaN;
|
|
1772
1809
|
let mean = Array.from(arr).reduce((a, v) => a + v, 0) / arr.length;
|
|
1773
1810
|
return Math.sqrt(Array.from(arr).reduce((a, v) => a + (v - mean) ** 2, 0) / (arr.length - 1));
|
|
1774
1811
|
},
|
|
1775
1812
|
quantile(arr, p, { na_rm = true, infinity_rm = true } = {}) {
|
|
1776
|
-
if (na_rm) arr = arr.filter(
|
|
1813
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1777
1814
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1778
1815
|
if (arr.length == 0) return NaN;
|
|
1779
1816
|
arr = Array.from(arr).sort((a, b) => a - b);
|
|
@@ -1782,7 +1819,7 @@ const numutils = {
|
|
|
1782
1819
|
return arr[lo] * (hi - idx) + arr[hi] * (idx - lo);
|
|
1783
1820
|
},
|
|
1784
1821
|
extent(arr, { na_rm = true, infinity_rm = true } = {}) {
|
|
1785
|
-
if (na_rm) arr = arr.filter(
|
|
1822
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1786
1823
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1787
1824
|
if (arr.length == 0) return new Array(2);
|
|
1788
1825
|
let min = Array.from(arr).reduce((a, b) => a < b ? a : b, Infinity), max = Array.from(arr).reduce((a, b) => a > b ? a : b, -Infinity);
|
|
@@ -2071,7 +2108,7 @@ const theme_base = {
|
|
|
2071
2108
|
plot: {
|
|
2072
2109
|
margin: 20,
|
|
2073
2110
|
padding_h: 50,
|
|
2074
|
-
padding_v:
|
|
2111
|
+
padding_v: 30
|
|
2075
2112
|
},
|
|
2076
2113
|
legend: {
|
|
2077
2114
|
spacing: 4
|
|
@@ -6590,7 +6627,7 @@ function format_datetime({
|
|
|
6590
6627
|
function format_auto(opts) {
|
|
6591
6628
|
let formatter_number = format_number(opts), formatter_datetime = format_datetime(opts);
|
|
6592
6629
|
return function(x2, i, arr = [x2]) {
|
|
6593
|
-
if (x2 instanceof
|
|
6630
|
+
if (x2 instanceof EnumElement) return String(x2);
|
|
6594
6631
|
if (x2 instanceof Date) return formatter_datetime(x2, i, arr);
|
|
6595
6632
|
return formatter_number(x2, i, arr);
|
|
6596
6633
|
};
|
|
@@ -6610,7 +6647,7 @@ function object_map(obj, expr) {
|
|
|
6610
6647
|
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, expr(k, v)]));
|
|
6611
6648
|
}
|
|
6612
6649
|
function is_categorical(v) {
|
|
6613
|
-
return typeof v === "string" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "object" && typeof v.valueOf() !== "number" && typeof v.valueOf() !== "bigint";
|
|
6650
|
+
return typeof v === "string" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "object" && v !== null && typeof v.valueOf() !== "number" && typeof v.valueOf() !== "bigint";
|
|
6614
6651
|
}
|
|
6615
6652
|
class GLayer {
|
|
6616
6653
|
/**
|
|
@@ -6671,7 +6708,7 @@ class GLayer {
|
|
|
6671
6708
|
this.$fnames = {};
|
|
6672
6709
|
for (const aes in $$aes) {
|
|
6673
6710
|
this.$fnames[aes] = String($$aes[aes]);
|
|
6674
|
-
data[aes] = $$data.map($$aes[aes]);
|
|
6711
|
+
data[aes] = $$data.map($$aes[aes]).map((x2) => x2 instanceof String || x2 instanceof Number ? new Asis(x2) : x2);
|
|
6675
6712
|
}
|
|
6676
6713
|
data.$raw = $$data;
|
|
6677
6714
|
let core_aes = stat?.core_attrs ?? ["x", "y", "xnudge", "ynudge"];
|
|
@@ -6722,9 +6759,9 @@ class GLayer {
|
|
|
6722
6759
|
if ($$levels?.[aes] != null) {
|
|
6723
6760
|
scale.level = $$levels[aes];
|
|
6724
6761
|
} else if (values.some(is_categorical)) {
|
|
6725
|
-
scale.level =
|
|
6762
|
+
scale.level = EnumLevel.from(values);
|
|
6726
6763
|
} else {
|
|
6727
|
-
scale.extent = numutils.extent(values);
|
|
6764
|
+
scale.extent = numutils.extent(values.filter((v) => !(v instanceof Asis)));
|
|
6728
6765
|
}
|
|
6729
6766
|
}
|
|
6730
6767
|
this.applyScale(aes, scale);
|
|
@@ -6754,7 +6791,8 @@ class GLayer {
|
|
|
6754
6791
|
if (scale.level) values = scale.level.apply(values);
|
|
6755
6792
|
if (scale.limits) values.extent = scale.limits;
|
|
6756
6793
|
scale.aes = aes;
|
|
6757
|
-
|
|
6794
|
+
let scaled = scale(values);
|
|
6795
|
+
this.data[aes] = values.map((v, i) => v instanceof Asis ? v.valueOf() : scaled[i]);
|
|
6758
6796
|
this.scales[aes] = scale;
|
|
6759
6797
|
}
|
|
6760
6798
|
applyCoordScale(coord_levels) {
|
|
@@ -6789,9 +6827,9 @@ class GPlot {
|
|
|
6789
6827
|
if (levels?.[aes] != null) {
|
|
6790
6828
|
scale.level = levels[aes];
|
|
6791
6829
|
} else if (values.some(is_categorical)) {
|
|
6792
|
-
scale.level =
|
|
6830
|
+
scale.level = EnumLevel.from(values);
|
|
6793
6831
|
} else {
|
|
6794
|
-
scale.extent = numutils.extent(values);
|
|
6832
|
+
scale.extent = numutils.extent(values.filter((v) => !(v instanceof Asis)));
|
|
6795
6833
|
}
|
|
6796
6834
|
}
|
|
6797
6835
|
scale._title = this.layers.reduce((v, layer) => v ?? layer.$fnames?.[aes], null);
|
|
@@ -6823,17 +6861,17 @@ class GPlot {
|
|
|
6823
6861
|
useCoordLevels(levels = {}) {
|
|
6824
6862
|
for (const aes of ["x", "y"]) {
|
|
6825
6863
|
if (levels[aes]) {
|
|
6826
|
-
this.levels[aes] = new
|
|
6864
|
+
this.levels[aes] = new EnumLevel(...levels[aes]);
|
|
6827
6865
|
} else {
|
|
6828
6866
|
let values = this.layers.flatMap((layer) => {
|
|
6829
6867
|
let fn = vvgeom[layer.geom].get_values ?? vvgeom[layer.geom].get_range;
|
|
6830
6868
|
return fn?.(layer.$data, aes);
|
|
6831
6869
|
});
|
|
6832
6870
|
if (values.some(is_categorical)) {
|
|
6833
|
-
this.levels[aes] =
|
|
6871
|
+
this.levels[aes] = EnumLevel.from(values);
|
|
6834
6872
|
} else {
|
|
6835
6873
|
values = this.layers.flatMap((layer) => vvgeom[layer.geom].get_range?.(layer.$data, aes)).filter((v) => !isNaN(v));
|
|
6836
|
-
this.extents[aes] = numutils.extent(values);
|
|
6874
|
+
this.extents[aes] = numutils.extent(values.filter((v) => !(v instanceof Asis)));
|
|
6837
6875
|
}
|
|
6838
6876
|
}
|
|
6839
6877
|
}
|
|
@@ -14549,7 +14587,7 @@ const _sfc_main$11 = {
|
|
|
14549
14587
|
return result.filter((t) => t.stroke != null).sort((a, b) => a.x1 - b.x1);
|
|
14550
14588
|
});
|
|
14551
14589
|
const tickTexts = computed(() => {
|
|
14552
|
-
let isTop = __props.theme.tick_position == "top";
|
|
14590
|
+
let isTop = (__props.theme.label_position ?? __props.theme.tick_position) == "top";
|
|
14553
14591
|
let result = [];
|
|
14554
14592
|
for (let tick of __props.ticks) {
|
|
14555
14593
|
if (typeof tick == "number") tick = { position: tick, label: tick };
|
|
@@ -14557,14 +14595,14 @@ const _sfc_main$11 = {
|
|
|
14557
14595
|
let tsl = pos * (__props.activeTransform.scaleH - 1) + __props.activeTransform.translateH;
|
|
14558
14596
|
let position = pos + __props.layout.l;
|
|
14559
14597
|
if (position + tsl < 0 || position + tsl > width.value) continue;
|
|
14560
|
-
let offset = (isTop ? -1 : 1) * (tick.length ?? __props.theme.tick_length);
|
|
14598
|
+
let offset = (isTop ? -1 : 1) * (__props.theme.label_offset ?? tick.length ?? __props.theme.tick_length);
|
|
14561
14599
|
let anchorX, anchorY, dockX, dockY;
|
|
14562
|
-
if (__props.theme.
|
|
14563
|
-
anchorX = __props.theme.
|
|
14564
|
-
anchorY = __props.theme.
|
|
14600
|
+
if (__props.theme.label_anchor_x != null || __props.theme.label_anchor_y != null) {
|
|
14601
|
+
anchorX = __props.theme.label_anchor_x ?? 0.5;
|
|
14602
|
+
anchorY = __props.theme.label_anchor_y ?? (isTop ? 0 : 1);
|
|
14565
14603
|
} else {
|
|
14566
|
-
dockX = __props.theme.
|
|
14567
|
-
dockY = __props.theme.
|
|
14604
|
+
dockX = __props.theme.label_dock_x ?? 0.5;
|
|
14605
|
+
dockY = __props.theme.label_dock_y ?? (isTop ? 0 : 1);
|
|
14568
14606
|
}
|
|
14569
14607
|
result.push({
|
|
14570
14608
|
wrapper: {
|
|
@@ -14575,7 +14613,7 @@ const _sfc_main$11 = {
|
|
|
14575
14613
|
text: {
|
|
14576
14614
|
x: position,
|
|
14577
14615
|
y: offset,
|
|
14578
|
-
angle: __props.theme.
|
|
14616
|
+
angle: __props.theme.label_angle,
|
|
14579
14617
|
anchorX,
|
|
14580
14618
|
anchorY,
|
|
14581
14619
|
dockX,
|
|
@@ -14976,7 +15014,7 @@ const _sfc_main$10 = {
|
|
|
14976
15014
|
return result.filter((t) => t.stroke != null).sort((a, b) => a.y1 - b.y1);
|
|
14977
15015
|
});
|
|
14978
15016
|
const tickTexts = computed(() => {
|
|
14979
|
-
let isRight = __props.theme.tick_position == "right";
|
|
15017
|
+
let isRight = (__props.theme.label_position ?? __props.theme.tick_position) == "right";
|
|
14980
15018
|
let result = [];
|
|
14981
15019
|
for (let tick of __props.ticks) {
|
|
14982
15020
|
if (typeof tick == "number") tick = { position: tick };
|
|
@@ -14984,14 +15022,14 @@ const _sfc_main$10 = {
|
|
|
14984
15022
|
let tsl = pos * (__props.activeTransform.scaleV - 1) + __props.activeTransform.translateV;
|
|
14985
15023
|
let position = pos + __props.layout.t;
|
|
14986
15024
|
if (position + tsl < 0 || position + tsl > height.value) continue;
|
|
14987
|
-
let offset = (isRight ? 1 : -1) * ((tick.length ?? __props.theme.tick_length) + 3);
|
|
15025
|
+
let offset = (isRight ? 1 : -1) * ((__props.theme.label_offset ?? tick.length ?? __props.theme.tick_length) + 3);
|
|
14988
15026
|
let anchorX, anchorY, dockX, dockY;
|
|
14989
|
-
if (__props.theme.
|
|
14990
|
-
anchorX = __props.theme.
|
|
14991
|
-
anchorY = __props.theme.
|
|
15027
|
+
if (__props.theme.label_anchor_x != null || __props.theme.label_anchor_y != null) {
|
|
15028
|
+
anchorX = __props.theme.label_anchor_x ?? (isRight ? 0 : 1);
|
|
15029
|
+
anchorY = __props.theme.label_anchor_y ?? 0.5;
|
|
14992
15030
|
} else {
|
|
14993
|
-
dockX = __props.theme.
|
|
14994
|
-
dockY = __props.theme.
|
|
15031
|
+
dockX = __props.theme.label_dock_x ?? (isRight ? 0 : 1);
|
|
15032
|
+
dockY = __props.theme.label_dock_y ?? 0.5;
|
|
14995
15033
|
}
|
|
14996
15034
|
result.push({
|
|
14997
15035
|
wrapper: {
|
|
@@ -15002,7 +15040,7 @@ const _sfc_main$10 = {
|
|
|
15002
15040
|
text: {
|
|
15003
15041
|
y: position,
|
|
15004
15042
|
x: offset,
|
|
15005
|
-
angle: __props.theme.
|
|
15043
|
+
angle: __props.theme.label_angle,
|
|
15006
15044
|
anchorX,
|
|
15007
15045
|
anchorY,
|
|
15008
15046
|
dockX,
|
|
@@ -18032,12 +18070,22 @@ const _sfc_main$w = {
|
|
|
18032
18070
|
setup(__props, { emit: __emit }) {
|
|
18033
18071
|
const model = useModel(__props, "modelValue");
|
|
18034
18072
|
const config = createPropsRestProxy(__props, ["coord2pos", "pos2coord", "layout", "theme", "flip", "activeTransform", "transition"]);
|
|
18073
|
+
function normalize2({ xmin, xmax, ymin, ymax, xreverse = false, yreverse = false } = {}) {
|
|
18074
|
+
if ([xmin, xmax, ymin, ymax].every((v) => v == null)) return null;
|
|
18075
|
+
if (xmin != null && xmax != null && xmin > xmax) [xmin, xmax, xreverse] = [xmax, xmin, !xreverse];
|
|
18076
|
+
if (ymin != null && ymax != null && ymin > ymax) [ymin, ymax, yreverse] = [ymax, ymin, !yreverse];
|
|
18077
|
+
let coord = { xreverse, yreverse };
|
|
18078
|
+
if (xmin != null && isFinite(xmin)) coord.xmin = xmin;
|
|
18079
|
+
if (xmax != null && isFinite(xmax)) coord.xmax = xmax;
|
|
18080
|
+
if (ymin != null && isFinite(ymin)) coord.ymin = ymin;
|
|
18081
|
+
if (ymax != null && isFinite(ymax)) coord.ymax = ymax;
|
|
18082
|
+
return coord;
|
|
18083
|
+
}
|
|
18035
18084
|
const position = computed(() => {
|
|
18036
18085
|
if (model.value == null || model.value.hidden) return null;
|
|
18037
|
-
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
if (vmin != null && vmax != null) [vmin, vmax] = [vmin, vmax].sort((a, b) => a - b);
|
|
18086
|
+
let coord = normalize2(model.value);
|
|
18087
|
+
if (coord == null) return null;
|
|
18088
|
+
let { hmin, hmax, vmin, vmax } = __props.coord2pos(coord, { limited: true }), pos = __props.coord2pos(coord);
|
|
18041
18089
|
return { hmin, hmax, vmin, vmax, pos };
|
|
18042
18090
|
});
|
|
18043
18091
|
const transform = computed(() => {
|
|
@@ -18150,7 +18198,8 @@ const _sfc_main$w = {
|
|
|
18150
18198
|
e.stopPropagation();
|
|
18151
18199
|
e.preventDefault();
|
|
18152
18200
|
e.target.setPointerCapture(e.pointerId);
|
|
18153
|
-
let
|
|
18201
|
+
let { xreverse: $xreverse, yreverse: $yreverse, ...coord0 } = normalize2(model.value);
|
|
18202
|
+
let pos0 = __props.coord2pos(coord0);
|
|
18154
18203
|
let { h: coordL, v: coordT } = __props.pos2coord({ h: pos0.hmin, v: pos0.vmin }), { h: coordR, v: coordB } = __props.pos2coord({ h: pos0.hmax, v: pos0.vmax });
|
|
18155
18204
|
let { hmin: hmin0, hmax: hmax0, vmin: vmin0, vmax: vmax0 } = pos0;
|
|
18156
18205
|
let pointerMoved = false;
|
|
@@ -18217,10 +18266,10 @@ const _sfc_main$w = {
|
|
|
18217
18266
|
let res = {
|
|
18218
18267
|
xmin,
|
|
18219
18268
|
xmax,
|
|
18220
|
-
xreverse: Boolean(xreverse ^
|
|
18269
|
+
xreverse: Boolean(xreverse ^ $xreverse),
|
|
18221
18270
|
ymin,
|
|
18222
18271
|
ymax,
|
|
18223
|
-
yreverse: Boolean(yreverse ^
|
|
18272
|
+
yreverse: Boolean(yreverse ^ $yreverse)
|
|
18224
18273
|
}, event = new PointerEvent("select", e);
|
|
18225
18274
|
model.value = dropNull(res);
|
|
18226
18275
|
emit("selectend");
|
|
@@ -18459,13 +18508,13 @@ const _sfc_main$s = {
|
|
|
18459
18508
|
},
|
|
18460
18509
|
setup(__props) {
|
|
18461
18510
|
const guides = computed(() => {
|
|
18462
|
-
let guide_scales = new Map(Array.from(__props.scales).filter(([fn]) => fn.legend !== false));
|
|
18511
|
+
let guide_scales = new Map(Array.from(__props.scales).filter(([fn]) => fn.legend !== false && fn.limits?.min != fn.limits?.max));
|
|
18463
18512
|
let scale_fns = Array.from(guide_scales.keys());
|
|
18464
18513
|
let keys = scale_fns.map((s) => s.key);
|
|
18465
18514
|
let n = 1;
|
|
18466
18515
|
for (let i = 0; i < keys.length; i++) {
|
|
18467
18516
|
while (keys.includes("_guide_" + n)) n++;
|
|
18468
|
-
keys[i] ??= keys.find((_, j) => keys[j] != null &&
|
|
18517
|
+
keys[i] ??= keys.find((_, j) => keys[j] != null && EnumLevel.isEqual(scale_fns[j].level, scale_fns[i].level)) ?? "_guide_" + n;
|
|
18469
18518
|
}
|
|
18470
18519
|
let types = scale_fns.map((s) => getGuideType(s));
|
|
18471
18520
|
let groups = interaction(keys, types);
|