@tetacom/svg-charts 1.7.28 → 1.7.29
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/README.md
CHANGED
|
@@ -1840,6 +1840,7 @@ class LinearSeriesBaseComponent extends SeriesBaseComponent {
|
|
|
1840
1840
|
return rV;
|
|
1841
1841
|
};
|
|
1842
1842
|
if (tooltipTracking === TooltipTracking.x) {
|
|
1843
|
+
const sortedData = [...this.series().data].sort((a, b) => a.x - b.x);
|
|
1843
1844
|
const bisect = d3.bisector((_) => _.x).right;
|
|
1844
1845
|
const pointer = mouse[0];
|
|
1845
1846
|
let x0 = scaleX.invert(pointer);
|
|
@@ -1848,7 +1849,7 @@ class LinearSeriesBaseComponent extends SeriesBaseComponent {
|
|
|
1848
1849
|
}
|
|
1849
1850
|
const rightId = bisect([...this.series().data].sort((a, b) => a.x - b.x), x0);
|
|
1850
1851
|
const range = scaleY.range();
|
|
1851
|
-
const intersect = lineIntersection(pointer, range[0], pointer, Number.MAX_SAFE_INTEGER, scaleX(
|
|
1852
|
+
const intersect = lineIntersection(pointer, range[0], pointer, Number.MAX_SAFE_INTEGER, scaleX(sortedData[rightId - 1]?.x), scaleY(sortedData[rightId - 1]?.y), scaleX(sortedData[rightId]?.x), scaleY(sortedData[rightId]?.y));
|
|
1852
1853
|
const x = scaleX.invert(intersect.x);
|
|
1853
1854
|
const y = scaleY.invert(intersect.y);
|
|
1854
1855
|
if (x !== null && x !== undefined && !isNaN(x) && y !== null && y !== undefined && !isNaN(y)) {
|
|
@@ -1872,14 +1873,15 @@ class LinearSeriesBaseComponent extends SeriesBaseComponent {
|
|
|
1872
1873
|
};
|
|
1873
1874
|
}
|
|
1874
1875
|
if (tooltipTracking === TooltipTracking.y) {
|
|
1876
|
+
const sortedData = [...this.series().data].sort((a, b) => a.y - b.y);
|
|
1875
1877
|
const bisect = d3.bisector((_) => _.y).right;
|
|
1876
1878
|
let y0 = scaleY.invert(mouse[1]);
|
|
1877
1879
|
if (y0 instanceof Date) {
|
|
1878
1880
|
y0 = y0.getTime();
|
|
1879
1881
|
}
|
|
1880
|
-
const rightId = bisect(
|
|
1882
|
+
const rightId = bisect(sortedData, y0);
|
|
1881
1883
|
const range = scaleX.range();
|
|
1882
|
-
const intersect = lineIntersection(range[0], mouse[1], Number.MAX_SAFE_INTEGER, mouse[1], scaleX(
|
|
1884
|
+
const intersect = lineIntersection(range[0], mouse[1], Number.MAX_SAFE_INTEGER, mouse[1], scaleX(sortedData[rightId - 1]?.x), scaleY(sortedData[rightId - 1]?.y), scaleX(sortedData[rightId]?.x), scaleY(sortedData[rightId]?.y));
|
|
1883
1885
|
const x = scaleX.invert(intersect.x);
|
|
1884
1886
|
const y = scaleY.invert(intersect.y);
|
|
1885
1887
|
if (x !== null && x !== undefined && !isNaN(x) && y !== null && y !== undefined && !isNaN(y)) {
|