layerchart 0.24.0 → 0.24.2
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.
|
@@ -21,12 +21,12 @@ import { writable } from 'svelte/store';
|
|
|
21
21
|
import { bisector, max, min } from 'd3-array';
|
|
22
22
|
import { Delaunay } from 'd3-delaunay';
|
|
23
23
|
import { quadtree as d3Quadtree } from 'd3-quadtree';
|
|
24
|
+
import { sortFunc } from 'svelte-ux';
|
|
24
25
|
import { Svg, Html } from './Chart.svelte';
|
|
25
26
|
import ChartClipPath from './ChartClipPath.svelte';
|
|
26
27
|
import { localPoint } from '../utils/event';
|
|
27
28
|
import { isScaleBand, scaleInvert } from '../utils/scales';
|
|
28
29
|
import { quadtreeRects } from '../utils/quadtree';
|
|
29
|
-
import { createPropertySortFunc, createSortFunc } from 'svelte-ux/utils/sort';
|
|
30
30
|
const dispatch = createEventDispatcher();
|
|
31
31
|
const { flatData, x, xScale, xGet, xRange, y, yScale, yGet, yRange, width, height, padding } = getContext('LayerCake');
|
|
32
32
|
/*
|
|
@@ -119,9 +119,7 @@ function showTooltip(event, tooltipData) {
|
|
|
119
119
|
const yValueAtPoint = scaleInvert($yScale, localY);
|
|
120
120
|
if (isScaleBand($xScale)) {
|
|
121
121
|
// Find point closest to pointer within the x band
|
|
122
|
-
const bandData = $flatData
|
|
123
|
-
.filter((d) => $x(d) === xValueAtPoint)
|
|
124
|
-
.sort(createSortFunc($y)); // sort for bisect
|
|
122
|
+
const bandData = $flatData.filter((d) => $x(d) === xValueAtPoint).sort(sortFunc($y)); // sort for bisect
|
|
125
123
|
const index = bisectY(bandData, yValueAtPoint, 1);
|
|
126
124
|
const previousValue = bandData[index - 1];
|
|
127
125
|
const currentValue = bandData[index];
|
|
@@ -129,9 +127,7 @@ function showTooltip(event, tooltipData) {
|
|
|
129
127
|
}
|
|
130
128
|
else if (isScaleBand($yScale)) {
|
|
131
129
|
// Find point closest to pointer within the y band
|
|
132
|
-
const bandData = $flatData
|
|
133
|
-
.filter((d) => $y(d) === yValueAtPoint)
|
|
134
|
-
.sort(createSortFunc($x)); // sort for bisect
|
|
130
|
+
const bandData = $flatData.filter((d) => $y(d) === yValueAtPoint).sort(sortFunc($x)); // sort for bisect
|
|
135
131
|
const index = bisectX(bandData, xValueAtPoint, 1);
|
|
136
132
|
const previousValue = bandData[index - 1];
|
|
137
133
|
const currentValue = bandData[index];
|
|
@@ -274,7 +270,7 @@ $: if (mode === 'bounds' || mode === 'band') {
|
|
|
274
270
|
};
|
|
275
271
|
}
|
|
276
272
|
})
|
|
277
|
-
.sort(
|
|
273
|
+
.sort(sortFunc('x'));
|
|
278
274
|
// console.log({ rects });
|
|
279
275
|
}
|
|
280
276
|
</script>
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "techniq/layerchart",
|
|
7
|
-
"version": "0.24.
|
|
7
|
+
"version": "0.24.2",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "vite dev",
|
|
10
10
|
"build": "vite build",
|
|
@@ -21,54 +21,54 @@
|
|
|
21
21
|
"publish": "changeset publish"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@rollup/plugin-dsv": "^3.0.
|
|
24
|
+
"@rollup/plugin-dsv": "^3.0.4",
|
|
25
25
|
"@sveltejs/adapter-vercel": "^3.0.3",
|
|
26
|
-
"@sveltejs/kit": "^1.25.
|
|
26
|
+
"@sveltejs/kit": "^1.25.2",
|
|
27
27
|
"@sveltejs/package": "^2.2.2",
|
|
28
28
|
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
|
|
29
29
|
"@tailwindcss/typography": "^0.5.10",
|
|
30
|
-
"@types/d3-array": "^3.0.
|
|
31
|
-
"@types/d3-delaunay": "^6.0.
|
|
32
|
-
"@types/d3-dsv": "^3.0.
|
|
33
|
-
"@types/d3-geo": "^3.0.
|
|
34
|
-
"@types/d3-hierarchy": "^3.1.
|
|
35
|
-
"@types/d3-interpolate": "^3.0.
|
|
36
|
-
"@types/d3-interpolate-path": "^2.0.
|
|
37
|
-
"@types/d3-quadtree": "^3.0.
|
|
30
|
+
"@types/d3-array": "^3.0.8",
|
|
31
|
+
"@types/d3-delaunay": "^6.0.2",
|
|
32
|
+
"@types/d3-dsv": "^3.0.4",
|
|
33
|
+
"@types/d3-geo": "^3.0.5",
|
|
34
|
+
"@types/d3-hierarchy": "^3.1.4",
|
|
35
|
+
"@types/d3-interpolate": "^3.0.2",
|
|
36
|
+
"@types/d3-interpolate-path": "^2.0.1",
|
|
37
|
+
"@types/d3-quadtree": "^3.0.3",
|
|
38
38
|
"@types/d3-random": "^3.0.1",
|
|
39
|
-
"@types/d3-sankey": "^0.12.
|
|
40
|
-
"@types/d3-scale": "^4.0.
|
|
39
|
+
"@types/d3-sankey": "^0.12.2",
|
|
40
|
+
"@types/d3-scale": "^4.0.5",
|
|
41
41
|
"@types/d3-scale-chromatic": "^3.0.0",
|
|
42
|
-
"@types/d3-shape": "^3.1.
|
|
42
|
+
"@types/d3-shape": "^3.1.3",
|
|
43
43
|
"@types/lodash-es": "^4.17.9",
|
|
44
|
-
"@types/marked": "^
|
|
45
|
-
"@types/shapefile": "^0.6.
|
|
44
|
+
"@types/marked": "^6.0.0",
|
|
45
|
+
"@types/shapefile": "^0.6.2",
|
|
46
46
|
"@types/topojson-client": "^3.1.2",
|
|
47
|
-
"autoprefixer": "^10.4.
|
|
47
|
+
"autoprefixer": "^10.4.16",
|
|
48
48
|
"execa": "^8.0.1",
|
|
49
|
-
"marked": "^9.
|
|
49
|
+
"marked": "^9.1.1",
|
|
50
50
|
"mdsvex": "^0.11.0",
|
|
51
51
|
"prettier": "^3.0.3",
|
|
52
52
|
"prettier-plugin-svelte": "^3.0.3",
|
|
53
53
|
"prism-themes": "^1.9.0",
|
|
54
54
|
"rehype-slug": "^6.0.0",
|
|
55
|
-
"svelte": "^4.2.
|
|
56
|
-
"svelte-check": "^3.5.
|
|
55
|
+
"svelte": "^4.2.1",
|
|
56
|
+
"svelte-check": "^3.5.2",
|
|
57
57
|
"svelte-preprocess": "^5.0.4",
|
|
58
|
-
"svelte2tsx": "^0.6.
|
|
58
|
+
"svelte2tsx": "^0.6.23",
|
|
59
59
|
"tailwindcss": "^3.3.3",
|
|
60
60
|
"tslib": "^2.6.2",
|
|
61
61
|
"typescript": "^5.2.2",
|
|
62
62
|
"unist-util-visit": "^5.0.0",
|
|
63
63
|
"us-atlas": "^3.0.1",
|
|
64
|
-
"vite": "^4.4.
|
|
64
|
+
"vite": "^4.4.11"
|
|
65
65
|
},
|
|
66
66
|
"type": "module",
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@changesets/cli": "^2.26.2",
|
|
69
|
-
"@mdi/js": "^7.
|
|
70
|
-
"@types/d3-time": "^3.0.
|
|
71
|
-
"@vercel/analytics": "^1.
|
|
69
|
+
"@mdi/js": "^7.3.67",
|
|
70
|
+
"@types/d3-time": "^3.0.1",
|
|
71
|
+
"@vercel/analytics": "^1.1.1",
|
|
72
72
|
"d3-array": "^3.2.4",
|
|
73
73
|
"d3-delaunay": "^6.0.4",
|
|
74
74
|
"d3-dsv": "^3.0.1",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"d3-tile": "^1.0.0",
|
|
86
86
|
"d3-time": "^3.1.0",
|
|
87
87
|
"date-fns": "^2.30.0",
|
|
88
|
-
"layercake": "^
|
|
88
|
+
"layercake": "^8.0.0",
|
|
89
89
|
"lodash-es": "^4.17.21",
|
|
90
90
|
"shapefile": "^0.6.6",
|
|
91
|
-
"svelte-ux": "^0.
|
|
91
|
+
"svelte-ux": "^0.53.0",
|
|
92
92
|
"topojson-client": "^3.1.0"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|