Skip to content

Commit

Permalink
-> v0.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Mar 6, 2020
1 parent 5d16a38 commit b2cbb09
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @sveltejs/pancake changelog

## 0.0.13

* Pass index to x/y accessors

## 0.0.12

* Work around Safari bug ([#9](https://github.com/Rich-Harris/pancake/issues/9))
Expand Down
2 changes: 1 addition & 1 deletion components/Bars.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</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}
2 changes: 1 addition & 1 deletion components/Columns.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</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}
6 changes: 3 additions & 3 deletions components/Grid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
: get_ticks($x1, $x2, count));
$: 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>

<div class="pancake-grid">
{#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>
</div>
{/each}
Expand Down
2 changes: 1 addition & 1 deletion components/Quadtree.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const { pointer } = getChartContext();
$: 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;
</script>

Expand Down
6 changes: 3 additions & 3 deletions components/SvgArea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
export let y = default_y;
$: 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 }
];
</script>

Expand Down
2 changes: 1 addition & 1 deletion components/SvgLine.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
export let y = default_y;
$: 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');
</script>

Expand Down
2 changes: 1 addition & 1 deletion components/SvgPolygon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export let x = default_x;
export let y = default_y;
$: 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>
6 changes: 3 additions & 3 deletions components/SvgScatterplot.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
export let x = default_x;
export let y = default_y;
$: 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));
return `M${_x} ${_y} A0 0 0 0 1 ${_x + 0.0001} ${_y + 0.0001}`;
}).join(' ');
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sveltejs/pancake",
"version": "0.0.12",
"version": "0.0.13",
"description": "Experimental charting library for Svelte",
"module": "index.mjs",
"svelte": "index.mjs",
Expand Down

0 comments on commit b2cbb09

Please sign in to comment.