Skip to content

Instantly share code, notes, and snippets.

@kristw
Created July 24, 2020 22:57
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 kristw/e94868edfcec9346a58f520a2a8364b7 to your computer and use it in GitHub Desktop.
Save kristw/e94868edfcec9346a58f520a2a8364b7 to your computer and use it in GitHub Desktop.
blog example: C3
const zoom_example = new c3.Plot.Zoomable<number>({
data: zoom_example_data,
h: d3.scale.linear().domain([-10, 10]), // horizontal scale
v: d3.scale.linear().domain([-50, 80]), // vertical scale
x: (d) => d,
margins: { top: 10, right: 20 },
axes: [
new c3.Axis.X({ grid: true, tick_size: 10 }),
new c3.Axis.Y({ grid: true, path_size: 3 }),
],
layers: [
new c3.Plot.Layer.Line<number>({ // Add a line-graph layer to this plot
y: (d) => 40 * Math.sin(d),
interpolate: 'basis',
path_options: { styles: { 'stroke': 'red' } },
}),
],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment