Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions components/SvgLine.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,30 @@
export let data;
export let x = default_x;
export let y = default_y;
export let plotGaps = false

$: d = 'M' + data
.map((d, i) => `${$x_scale(x(d, i))},${$y_scale(y(d, i))}`)
.join('L');
let d

$: 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')
}
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, i))},${$y_scale(y(d, i))}`
})
.join('')
}
</script>

<slot {d}></slot>
<slot {d}></slot>
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "@sveltejs/pancake",
"version": "0.0.14",
"name": "pancake-with-nulls",
"version": "0.0.15",
"description": "Experimental charting library for Svelte",
"private": false,
"module": "index.mjs",
"svelte": "index.mjs",
"files": [
Expand All @@ -13,9 +14,12 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"publishConfig": {
"registry": "https://registry.npmjs.com/"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/Rich-Harris/pancake.git"
"url": "git+git@github.com:briancray/pancake.git"
},
"keywords": [
"svelte",
Expand All @@ -30,6 +34,6 @@
},
"homepage": "https://github.com/Rich-Harris/pancake#readme",
"dependencies": {
"yootils": "0.0.16"
"yootils": "0.0.17"
}
}