Browse Source

Fix legend item width - #257

pull/264/head
Masayuki Tanaka 11 years ago
parent
commit
5f100cb894
  1. 2
      c3.js
  2. 2
      c3.min.js
  3. 61
      htdocs/samples/legend.html

2
c3.js

@ -4206,7 +4206,7 @@
function updateLegend(targetIds, options, transitions) {
var xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect;
var paddingTop = 4, paddingRight = 26, maxWidth = 0, maxHeight = 0, posMin = 10;
var paddingTop = 4, paddingRight = 36, maxWidth = 0, maxHeight = 0, posMin = 10;
var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0;
var withTransition, withTransitionForTransform;
var hasFocused = legend.selectAll('.' + CLASS.legendItemFocused).size();

2
c3.min.js vendored

File diff suppressed because one or more lines are too long

61
htdocs/samples/legend.html

@ -0,0 +1,61 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="/css/c3.css">
</head>
<body>
<div id="chart1"></div>
<div id="chart2"></div>
<div id="chart3"></div>
<div id="chart4"></div>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="/js/c3.js"></script>
<script>
var columns = [];
for (var i = 0; i < 30; i++ ) {
columns[i] = ['datahogehogeohgeohoge' + i, 10 * i, 20 * i];
}
c3.generate({
bindto: '#chart1',
data: {
columns: columns,
},
});
c3.generate({
bindto: '#chart2',
data: {
columns: columns,
},
legend: {
position: 'right'
},
});
c3.generate({
bindto: '#chart3',
data: {
columns: columns,
},
axis: {
rotated: true,
},
});
c3.generate({
bindto: '#chart4',
data: {
columns: columns,
},
legend: {
position: 'right'
},
axis: {
rotated: true,
},
});
</script>
</body>
</html>
Loading…
Cancel
Save