|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<link href="../css/c3.css" rel="stylesheet" type="text/css">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h3>Zerobased</h3>
|
|
|
|
<div id="chart1"></div>
|
|
|
|
<h3>Not zerobased because of axis.y.min</h3>
|
|
|
|
<div id="chart2"></div>
|
|
|
|
<h3>Zerobased</h3>
|
|
|
|
<div id="chart3"></div>
|
|
|
|
<h3>Not zerobased because of axis.y.min</h3>
|
|
|
|
<div id="chart4"></div>
|
|
|
|
<h3>+/- vaulues</h3>
|
|
|
|
<div id="chart5"></div>
|
|
|
|
|
|
|
|
<script src="https://d3js.org/d3.v5.min.js" charset="utf-8"></script>
|
|
|
|
<script src="../js/c3.js"></script>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
var chart1 = c3.generate({
|
|
|
|
bindto: '#chart1',
|
|
|
|
data: {
|
|
|
|
columns: [
|
|
|
|
['data1', 300, 350, 300, 0, 0, 0],
|
|
|
|
['data2', 130, 100, 140, 200, 150, 50]
|
|
|
|
],
|
|
|
|
type: 'area'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var chart2 = c3.generate({
|
|
|
|
bindto: '#chart2',
|
|
|
|
data: {
|
|
|
|
columns: [
|
|
|
|
['data1', 300, 350, 300, 0, 0, 0],
|
|
|
|
['data2', 130, 100, 140, 200, 150, 50]
|
|
|
|
],
|
|
|
|
type: 'area'
|
|
|
|
},
|
|
|
|
axis: {
|
|
|
|
y: {
|
|
|
|
min: 100,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
var chart3 = c3.generate({
|
|
|
|
bindto: '#chart3',
|
|
|
|
data: {
|
|
|
|
columns: [
|
|
|
|
['data1', -300, -350, -300, 0, 0, 0],
|
|
|
|
['data2', -130, -100, -140, -200, -150, -50]
|
|
|
|
],
|
|
|
|
type: 'area'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var chart4 = c3.generate({
|
|
|
|
bindto: '#chart4',
|
|
|
|
data: {
|
|
|
|
columns: [
|
|
|
|
['data1', -300, -350, -300, 0, 0, 0],
|
|
|
|
['data2', -130, -100, -140, -200, -150, -50]
|
|
|
|
],
|
|
|
|
type: 'area'
|
|
|
|
},
|
|
|
|
axis: {
|
|
|
|
y: {
|
|
|
|
max: -100,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var chart5 = c3.generate({
|
|
|
|
bindto: '#chart5',
|
|
|
|
data: {
|
|
|
|
columns: [
|
|
|
|
['data1', -300, 350, -300, 0, 0, 0],
|
|
|
|
['data2', -130, -100, 140, -200, 150, -50]
|
|
|
|
],
|
|
|
|
type: 'area'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|