Commit 6f2091f2 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix grid height when padding.top specified - #368

parent ed67f04e
...@@ -523,7 +523,7 @@ ...@@ -523,7 +523,7 @@
main.select('line.' + CLASS.xgridFocus) main.select('line.' + CLASS.xgridFocus)
.attr("x1", __axis_rotated ? 0 : -10) .attr("x1", __axis_rotated ? 0 : -10)
.attr("x2", __axis_rotated ? width : -10) .attr("x2", __axis_rotated ? width : -10)
.attr("y1", __axis_rotated ? -10 : margin.top) .attr("y1", __axis_rotated ? -10 : 0)
.attr("y2", __axis_rotated ? -10 : height); .attr("y2", __axis_rotated ? -10 : height);
} }
function updateRadius() { function updateRadius() {
...@@ -3627,7 +3627,7 @@ ...@@ -3627,7 +3627,7 @@
} : { } : {
'x1': function (d) { return x(d) + tickOffset; }, 'x1': function (d) { return x(d) + tickOffset; },
'x2': function (d) { return x(d) + tickOffset; }, 'x2': function (d) { return x(d) + tickOffset; },
'y1': margin.top, 'y1': 0,
'y2': height 'y2': height
}; };
// this is used to flow // this is used to flow
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -15,13 +15,17 @@ ...@@ -15,13 +15,17 @@
<div id="chart3"></div> <div id="chart3"></div>
<div id="chart4"></div> <div id="chart4"></div>
<div id="chart5"></div> <div id="chart5"></div>
<div id="chart6"></div>
<div id="chart7"></div>
<div id="chart8"></div>
<div id="chart9"></div>
<div id="chart10"></div>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="/js/c3.js"></script> <script src="/js/c3.js"></script>
<script> <script>
var chart1 = c3.generate({ var option = {
bindto: '#chart1',
padding: { padding: {
top: 50, top: 50,
right: 200, right: 200,
...@@ -52,160 +56,82 @@ ...@@ -52,160 +56,82 @@
position: 'outer-center' position: 'outer-center'
} }
} }
}
});
var chart2 = c3.generate({
bindto: '#chart2',
padding: {
top: 50,
right: 200,
bottom: 50,
left: 200,
},
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 200, 100, 150, 150]
],
axes: {
data2: 'y2'
},
}, },
legend: { legend: {
position: 'right' position: 'bottom'
},
axis: {
rotated: true,
y: {
label: {
text: 'Y Label',
position: 'outer-center'
}
},
y2: {
show: true,
label: {
text: 'Y2 Label',
position: 'outer-center'
}
}
}
});
var chart3 = c3.generate({
bindto: '#chart3',
padding: {
top: 50,
right: 200,
bottom: 50,
left: 200,
},
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 200, 100, 150, 150]
],
axes: {
data2: 'y2'
},
}, },
subchart: { subchart: {
show: true show: false
}, },
axis: { grid: {
rotated: true, x: {
y: {
label: {
text: 'Y Label',
position: 'outer-center'
}
},
y2: {
show: true, show: true,
label: {
text: 'Y2 Label',
position: 'outer-center'
}
}
}
});
var chart4 = c3.generate({
bindto: '#chart4',
padding: {
top: 50,
right: 200,
bottom: 50,
left: 200,
},
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 200, 100, 150, 150]
],
axes: {
data2: 'y2'
}, },
},
legend: {
position: 'right'
},
subchart: {
show: true
},
axis: {
rotated: true,
y: { y: {
label: {
text: 'Y Label',
position: 'outer-center'
}
},
y2: {
show: true, show: true,
label: {
text: 'Y2 Label',
position: 'outer-center'
}
} }
} }
}); };
var chart5 = c3.generate({
bindto: '#chart5', option.bindto = '#chart1';
padding: { var chart1 = c3.generate(option);
option.bindto = '#chart2';
option.legend.position = 'right'
var chart2 = c3.generate(option);
option.bindto = '#chart3';
option.legend.position = 'bottom';
option.subchart.show = true;
var chart3 = c3.generate(option);
option.bindto = '#chart4';
option.legend.position = 'right';
option.subchart.show = true;
var chart4 = c3.generate(option);
option.bindto = '#chart5';
option.padding = {
top: 0, top: 0,
right: 0, right: 0,
bottom: 0, bottom: 0,
left: 0, left: 0,
}, };
data: { option.subchart.show = false;
columns: [ option.legend.position = 'bottom';
['data1', 30, 200, 100, 400, 150, 250], var chart5 = c3.generate(option);
['data2', 130, 100, 200, 100, 150, 150]
],
axes: { option.axis.rotated = false;
data2: 'y2'
}, option.bindto = '#chart6';
}, var chart6 = c3.generate(option);
axis: {
rotated: true, option.bindto = '#chart7';
y: { option.legend.position = 'right'
label: { var chart7 = c3.generate(option);
text: 'Y Label',
position: 'outer-center' option.bindto = '#chart8';
} option.legend.position = 'bottom';
}, option.subchart.show = true;
y2: { var chart8 = c3.generate(option);
show: true,
label: { option.bindto = '#chart9';
text: 'Y2 Label', option.legend.position = 'right';
position: 'outer-center' option.subchart.show = true;
} var chart9 = c3.generate(option);
}
} option.bindto = '#chart10';
}); option.padding = {
top: 0,
right: 0,
bottom: 0,
left: 0,
};
option.subchart.show = false;
option.legend.position = 'bottom';
var chart10 = c3.generate(option);
</script> </script>
</body> </body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment