Skip to content

Instantly share code, notes, and snippets.

@mhkeller
Created January 2, 2020 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhkeller/296e4040fdc62209ae34e4fa6e911428 to your computer and use it in GitHub Desktop.
Save mhkeller/296e4040fdc62209ae34e4fa6e911428 to your computer and use it in GitHub Desktop.
<script>
import { LayerCake, Svg, calcExtents, flatten } from 'layercake';
import { tweened } from 'svelte/motion';
import * as eases from 'svelte/easing';
import Line from '../../components/Line.svelte';
export let data;
export let shared;
const y = tweened(undefined, {
duration: 300,
easing: eases.cubicInOut
});
$: y.set(shared ? [0, 100] : get_extents(data));
</script>
<LayerCake
padding={{ top: 2, right: 6, bottom: 2, left: 6 }}
x={'x'}
y={'y'}
{data}
y_scale={y}
>
<Svg>
<Line
stroke={'#000'}
/>
</Svg>
</LayerCake>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment