Created
July 24, 2020 22:57
-
-
Save kristw/e94868edfcec9346a58f520a2a8364b7 to your computer and use it in GitHub Desktop.
blog example: C3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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