From 1a56f6679c76c23b63dc742052a7b4bccf96b085 Mon Sep 17 00:00:00 2001 From: Brian Cray Date: Mon, 2 Mar 2020 09:12:47 -0500 Subject: [PATCH 1/7] add plotGaps option to SvgLine and prevent plotting nulls by default --- components/SvgLine.svelte | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/components/SvgLine.svelte b/components/SvgLine.svelte index 872b780..d0e1838 100644 --- a/components/SvgLine.svelte +++ b/components/SvgLine.svelte @@ -7,10 +7,29 @@ export let data; export let x = default_x; export let y = default_y; + export let plotGaps = false - $: d = 'M' + data - .map(d => `${$x_scale(x(d))},${$y_scale(y(d))}`) - .join('L'); + let d + + $: if (plotGaps) { + d = 'M' + data + .map(d => `${$x_scale(x(d))},${$y_scale(y(d))}`) + .join('L') + } + else { + d = data + .map((d, i) => { + let motion = 'L' + if (y(d) == null) { + return + } + if (i == 0 || y(data[i - 1]) == null) { + motion = 'M' + } + return `${motion}${$x_scale(x(d))},${$y_scale(y(d))}` + }) + .join('') + } - \ No newline at end of file + From 87288ff03ebb820bad5c6a48df43264bad9af411 Mon Sep 17 00:00:00 2001 From: Brian Cray Date: Mon, 2 Mar 2020 09:16:07 -0500 Subject: [PATCH 2/7] fix indenting --- components/SvgLine.svelte | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/components/SvgLine.svelte b/components/SvgLine.svelte index d0e1838..64484a2 100644 --- a/components/SvgLine.svelte +++ b/components/SvgLine.svelte @@ -7,29 +7,29 @@ export let data; export let x = default_x; export let y = default_y; - export let plotGaps = false + export let plotGaps = false - let d + let d - $: if (plotGaps) { - d = 'M' + data - .map(d => `${$x_scale(x(d))},${$y_scale(y(d))}`) - .join('L') - } - else { - d = data - .map((d, i) => { - let motion = 'L' - if (y(d) == null) { - return - } - if (i == 0 || y(data[i - 1]) == null) { - motion = 'M' - } - return `${motion}${$x_scale(x(d))},${$y_scale(y(d))}` - }) - .join('') - } + $: if (plotGaps) { + d = 'M' + data + .map(d => `${$x_scale(x(d))},${$y_scale(y(d))}`) + .join('L') + } + else { + d = data + .map((d, i) => { + let motion = 'L' + if (y(d) == null) { + return + } + if (i == 0 || y(data[i - 1]) == null) { + motion = 'M' + } + return `${motion}${$x_scale(x(d))},${$y_scale(y(d))}` + }) + .join('') + } From ab394efbed06c93187df84097e5850b074c0ed72 Mon Sep 17 00:00:00 2001 From: Brian Cray Date: Fri, 27 Mar 2020 12:36:47 -0400 Subject: [PATCH 3/7] package name --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e2c92d2..b556f2e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@sveltejs/pancake", + "name": "@briancray/pancake", "version": "0.0.13", "description": "Experimental charting library for Svelte", "module": "index.mjs", @@ -15,7 +15,7 @@ }, "repository": { "type": "git", - "url": "git+ssh://git@github.com/Rich-Harris/pancake.git" + "url": "git+git@github.com:briancray/pancake.git" }, "keywords": [ "svelte", From d1989e38fefee552045f86d40621df2cd0304d26 Mon Sep 17 00:00:00 2001 From: Brian Cray Date: Fri, 27 Mar 2020 13:01:50 -0400 Subject: [PATCH 4/7] Package name --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b556f2e..b97da51 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { - "name": "@briancray/pancake", + "name": "pancake-with-nulls", "version": "0.0.13", "description": "Experimental charting library for Svelte", + "private": false, "module": "index.mjs", "svelte": "index.mjs", "files": [ @@ -13,6 +14,9 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, + "publishConfig": { + "registry": "https://registry.npmjs.com/" + }, "repository": { "type": "git", "url": "git+git@github.com:briancray/pancake.git" From 66f8686bd99ff00c527bb1182daa6eda781be4a2 Mon Sep 17 00:00:00 2001 From: Brian Cray Date: Tue, 9 Jun 2020 13:59:16 -0400 Subject: [PATCH 5/7] filter nulls when closing gaps --- components/SvgLine.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/components/SvgLine.svelte b/components/SvgLine.svelte index 8cc02b3..3efdcba 100644 --- a/components/SvgLine.svelte +++ b/components/SvgLine.svelte @@ -13,6 +13,7 @@ $: if (plotGaps) { d = 'M' + data + .filter((d, i) => y(d, i) != null) .map((d, i) => `${$x_scale(x(d, i))},${$y_scale(y(d, i))}`) .join('L') } From e80c97cf47f34edcdcf408c58e2143226d762c1f Mon Sep 17 00:00:00 2001 From: Brian Cray Date: Tue, 9 Jun 2020 14:00:19 -0400 Subject: [PATCH 6/7] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b97da51..e0cb54d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pancake-with-nulls", - "version": "0.0.13", + "version": "0.0.14", "description": "Experimental charting library for Svelte", "private": false, "module": "index.mjs", From ba9005708ae7cd061934ea9072b73c5cfd520aeb Mon Sep 17 00:00:00 2001 From: Brian Cray Date: Mon, 27 Jul 2020 12:20:16 -0400 Subject: [PATCH 7/7] chore: version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d470f99..d4f4fc7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pancake-with-nulls", - "version": "0.0.14", + "version": "0.0.15", "description": "Experimental charting library for Svelte", "private": false, "module": "index.mjs",