layerchart 0.17.0 → 0.17.1
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { getContext } from 'svelte';
|
|
2
|
-
import { get } from 'svelte/store';
|
|
3
2
|
import { max } from 'd3-array';
|
|
3
|
+
import { notNull } from 'svelte-ux';
|
|
4
4
|
import { isScaleBand } from '../utils/scales';
|
|
5
5
|
import Circle from './Circle.svelte';
|
|
6
6
|
import Line from './Line.svelte';
|
|
@@ -10,7 +10,7 @@ const tooltip = tooltipContext();
|
|
|
10
10
|
export let color = undefined;
|
|
11
11
|
export let axis = 'x';
|
|
12
12
|
// TODO: Fix circle points being backwards for stack (see AreaStack)
|
|
13
|
-
function getColor(item, index =
|
|
13
|
+
function getColor(item, index = -1) {
|
|
14
14
|
if (color) {
|
|
15
15
|
if (typeof color === 'function') {
|
|
16
16
|
return color({ value: $y(item), item, index });
|
|
@@ -40,7 +40,7 @@ $: if ($tooltip.data) {
|
|
|
40
40
|
// `x` accessor with multiple properties (ex. `x={['start', 'end']})`)
|
|
41
41
|
lines = [
|
|
42
42
|
...lines,
|
|
43
|
-
...x.map((xItem, i) => ({
|
|
43
|
+
...x.filter(notNull).map((xItem, i) => ({
|
|
44
44
|
x1: xItem + xOffset,
|
|
45
45
|
y1: 0,
|
|
46
46
|
x2: xItem + xOffset,
|
|
@@ -65,7 +65,7 @@ $: if ($tooltip.data) {
|
|
|
65
65
|
// `y` accessor with multiple properties (ex. `y={['start', 'end']})`)
|
|
66
66
|
lines = [
|
|
67
67
|
...lines,
|
|
68
|
-
...y.map((yItem, i) => ({
|
|
68
|
+
...y.filter(notNull).map((yItem, i) => ({
|
|
69
69
|
x1: 0,
|
|
70
70
|
y1: yItem + yOffset,
|
|
71
71
|
x2: max($xRange),
|
|
@@ -87,7 +87,7 @@ $: if ($tooltip.data) {
|
|
|
87
87
|
}
|
|
88
88
|
if (Array.isArray(x)) {
|
|
89
89
|
// `x` accessor with multiple properties (ex. `x={['start', 'end']})`)
|
|
90
|
-
points = x.map((xItem, i) => ({
|
|
90
|
+
points = x.filter(notNull).map((xItem, i) => ({
|
|
91
91
|
x: xItem + xOffset,
|
|
92
92
|
y: $yGet($tooltip.data) + yOffset,
|
|
93
93
|
color: getColor($tooltip.data) // TODO: improve
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { getContext } from 'svelte';
|
|
2
2
|
import Circle from './Circle.svelte';
|
|
3
3
|
import { isScaleBand } from '../utils/scales';
|
|
4
|
+
import { notNull } from 'svelte-ux';
|
|
4
5
|
const context = getContext('LayerCake');
|
|
5
6
|
const { data, xGet, y, yGet, xScale, yScale, rGet, config } = context;
|
|
6
7
|
export let r = 5;
|
|
@@ -39,7 +40,9 @@ $: points = $data.flatMap((d) => {
|
|
|
39
40
|
x={["prop1" ,"prop2"]}
|
|
40
41
|
y="prop3"
|
|
41
42
|
*/
|
|
42
|
-
return $xGet(d)
|
|
43
|
+
return $xGet(d)
|
|
44
|
+
.filter(notNull)
|
|
45
|
+
.map((x) => {
|
|
43
46
|
return {
|
|
44
47
|
x: x + getOffset(x, offsetX, $xScale),
|
|
45
48
|
y: $yGet(d) + getOffset($yGet(d), offsetY, $yScale),
|
|
@@ -52,7 +55,9 @@ $: points = $data.flatMap((d) => {
|
|
|
52
55
|
x="prop1"
|
|
53
56
|
y={["prop2" ,"prop3"]}
|
|
54
57
|
*/
|
|
55
|
-
return $yGet(d)
|
|
58
|
+
return $yGet(d)
|
|
59
|
+
.filter(notNull)
|
|
60
|
+
.map((y) => {
|
|
56
61
|
return {
|
|
57
62
|
x: $xGet(d) + getOffset($xGet(d), offsetX, $xScale),
|
|
58
63
|
y: y + getOffset(y, offsetY, $yScale),
|
|
@@ -11,10 +11,10 @@ export let icon;
|
|
|
11
11
|
<Toggle let:on={open} let:toggle>
|
|
12
12
|
<Button {icon} on:click={toggle} variant="fill-light" color="blue" size="sm">{label}</Button>
|
|
13
13
|
<Dialog {open} on:close={toggle}>
|
|
14
|
-
<div class="grid grid-cols-[1fr,auto] gap-
|
|
15
|
-
<div>
|
|
14
|
+
<div class="grid grid-cols-[1fr,auto] gap-3 items-center p-4">
|
|
15
|
+
<div class="overflow-auto">
|
|
16
16
|
<div class="text-lg font-semibold">{label}</div>
|
|
17
|
-
<div class="text-xs text-black/50">{href}</div>
|
|
17
|
+
<div class="text-xs text-black/50 truncate">{href}</div>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
{#if href}
|
|
@@ -24,7 +24,7 @@ export let icon;
|
|
|
24
24
|
{/if}
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
|
-
<div class="max-h-[80vh]
|
|
27
|
+
<div class="max-h-[80vh] overflow-auto">
|
|
28
28
|
<Code {source} language={source.startsWith('<script') ? 'svelte' : 'js'} />
|
|
29
29
|
</div>
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "techniq/layerchart",
|
|
6
|
-
"version": "0.17.
|
|
6
|
+
"version": "0.17.1",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "vite dev",
|
|
9
9
|
"build": "vite build",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@rollup/plugin-dsv": "^3.0.2",
|
|
20
20
|
"@sveltejs/adapter-vercel": "^3.0.1",
|
|
21
|
-
"@sveltejs/kit": "^1.20.
|
|
22
|
-
"@sveltejs/package": "^2.0
|
|
21
|
+
"@sveltejs/kit": "^1.20.5",
|
|
22
|
+
"@sveltejs/package": "^2.1.0",
|
|
23
23
|
"@tailwindcss/typography": "^0.5.9",
|
|
24
24
|
"@types/d3-array": "^3.0.5",
|
|
25
25
|
"@types/d3-delaunay": "^6.0.1",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/shapefile": "^0.6.1",
|
|
37
37
|
"@types/topojson-client": "^3.1.1",
|
|
38
38
|
"autoprefixer": "^10.4.14",
|
|
39
|
-
"mdsvex": "^0.
|
|
39
|
+
"mdsvex": "^0.11.0",
|
|
40
40
|
"prettier": "^2.8.8",
|
|
41
41
|
"prettier-plugin-svelte": "^2.10.1",
|
|
42
42
|
"prism-themes": "^1.9.0",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"d3-shape": "^3.2.0",
|
|
72
72
|
"d3-tile": "^1.0.0",
|
|
73
73
|
"date-fns": "^2.30.0",
|
|
74
|
-
"layercake": "^7.
|
|
74
|
+
"layercake": "^7.5.0",
|
|
75
75
|
"lodash-es": "^4.17.21",
|
|
76
76
|
"shapefile": "^0.6.6",
|
|
77
77
|
"svelte": "^3.59.1",
|
|
78
|
-
"svelte-ux": "^0.
|
|
78
|
+
"svelte-ux": "^0.43.2",
|
|
79
79
|
"topojson-client": "^3.1.0"
|
|
80
80
|
},
|
|
81
81
|
"main": "./dist/index.js",
|