@sveltejs/pancake
Advanced tools
+4
-0
| # @sveltejs/pancake changelog | ||
| ## 0.0.13 | ||
| * Pass index to x/y accessors | ||
| ## 0.0.12 | ||
@@ -4,0 +8,0 @@ |
@@ -12,5 +12,5 @@ <script> | ||
| {#each data as d, i} | ||
| <Box y1="{y(d) - height/2}" y2="{y(d) + height/2}" x1={0} x2={x(d)}> | ||
| <Box y1="{y(d, i) - height/2}" y2="{y(d, i) + height/2}" x1={0} x2="{x(d, i)}"> | ||
| <slot value={d} first="{i === 0}" last="{i === data.length - 1}"/> | ||
| </Box> | ||
| {/each} |
@@ -12,5 +12,5 @@ <script> | ||
| {#each data as d, i} | ||
| <Box x1="{x(d) - width/2}" x2="{x(d) + width/2}" y1={0} y2={y(d)}> | ||
| <Box x1="{x(d, i) - width/2}" x2="{x(d, i) + width/2}" y1={0} y2="{y(d, i)}"> | ||
| <slot value={d} first="{i === 0}" last="{i === data.length - 1}"/> | ||
| </Box> | ||
| {/each} |
@@ -26,4 +26,4 @@ <script> | ||
| $: style = orientation === HORIZONTAL | ||
| ? y => `width: 100%; height: 0; top: ${$y(y)}%` | ||
| : x => `width: 0; height: 100%; left: ${$x(x)}%`; | ||
| ? (y, i) => `width: 100%; height: 0; top: ${$y(y, i)}%` | ||
| : (x, i) => `width: 0; height: 100%; left: ${$x(x, i)}%`; | ||
| </script> | ||
@@ -33,3 +33,3 @@ | ||
| {#each _ticks as tick, i} | ||
| <div class="pancake-grid-item" style={style(tick)}> | ||
| <div class="pancake-grid-item" style={style(tick, i)}> | ||
| <slot value={tick} first={i === 0} last={i === _ticks.length - 1}></slot> | ||
@@ -36,0 +36,0 @@ </div> |
@@ -15,3 +15,3 @@ <script> | ||
| $: quadtree = new Quadtree(data, x, y); | ||
| $: quadtree = new Quadtree(data, x, y); // TODO map data here so we don't need to pass accessors around, and accessors can access index | ||
| $: closest = $pointer.x !== undefined ? quadtree.find($pointer.x, $pointer.y) : null; | ||
@@ -18,0 +18,0 @@ </script> |
@@ -11,5 +11,5 @@ <script> | ||
| $: points = [ | ||
| { x: x(data[0]), y: floor }, | ||
| ...data.map(d => ({ x: x(d), y: y(d) })), | ||
| { x: x(data[data.length - 1]), y: floor } | ||
| { x: x(data[0], 0), y: floor }, | ||
| ...data.map((d, i) => ({ x: x(d, i), y: y(d, i) })), | ||
| { x: x(data[data.length - 1], data.length - 1), y: floor } | ||
| ]; | ||
@@ -16,0 +16,0 @@ </script> |
@@ -12,3 +12,3 @@ <script> | ||
| $: d = 'M' + data | ||
| .map(d => `${$x_scale(x(d))},${$y_scale(y(d))}`) | ||
| .map((d, i) => `${$x_scale(x(d, i))},${$y_scale(y(d, i))}`) | ||
| .join('L'); | ||
@@ -15,0 +15,0 @@ </script> |
@@ -11,5 +11,5 @@ <script> | ||
| $: d = `M${data.map(d => `${$x_scale(x(d))},${$y_scale(y(d))}`).join('L')}`; | ||
| $: d = `M${data.map((d, i) => `${$x_scale(x(d, i))},${$y_scale(y(d, i))}`).join('L')}`; | ||
| </script> | ||
| <slot {d}></slot> |
@@ -11,5 +11,5 @@ <script> | ||
| $: d = data.map(d => { | ||
| const _x = $x_scale(x(d)); | ||
| const _y = $y_scale(y(d)); | ||
| $: d = data.map((d, i) => { | ||
| const _x = $x_scale(x(d, i)); | ||
| const _y = $y_scale(y(d, i)); | ||
@@ -16,0 +16,0 @@ return `M${_x} ${_y} A0 0 0 0 1 ${_x + 0.0001} ${_y + 0.0001}`; |
+1
-1
| { | ||
| "name": "@sveltejs/pancake", | ||
| "version": "0.0.12", | ||
| "version": "0.0.13", | ||
| "description": "Experimental charting library for Svelte", | ||
@@ -5,0 +5,0 @@ "module": "index.mjs", |
17479
1.41%