Browse Source

Fix legend position when element appended - #334

pull/340/head
Masayuki Tanaka 11 years ago
parent
commit
169da6264a
  1. 2
      c3.js
  2. 2
      c3.min.js
  3. 27
      htdocs/samples/element.html

2
c3.js

@ -2956,7 +2956,7 @@
// MEMO: call here to update legend box and tranlate for all // MEMO: call here to update legend box and tranlate for all
// MEMO: translate will be upated by this, so transform not needed in updateLegend() // MEMO: translate will be upated by this, so transform not needed in updateLegend()
updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false}); updateLegend(mapToIds(c3.data.targets), {withTransform: false, withTransitionForTransform: false, withTransition: false});
/*-- Main Region --*/ /*-- Main Region --*/

2
c3.min.js vendored

File diff suppressed because one or more lines are too long

27
htdocs/samples/element.html

@ -3,26 +3,35 @@
<link rel="stylesheet" type="text/css" href="/css/c3.css"> <link rel="stylesheet" type="text/css" href="/css/c3.css">
</head> </head>
<body> <body>
<!-- <div id="chart"></div>--> <div id="chart1"></div>
<div id="chart2"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<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 chart = c3.generate({
var chart1 = c3.generate({
data: { data: {
columns: [ columns: [
['sample', 30, 200, 100, null, 150, 250] ['sample', 30, 200, 100, null, 150, 250]
], ],
}, },
// size: {
// width: 640,
// height: 320
// }
}); });
setTimeout(function () { var chart2 = c3.generate({
document.body.appendChild(chart.element); data: {
}, 1000); columns: [
['sample', 30, 200, 100, null, 150, 250]
],
type: 'bar'
}
});
document.getElementById('chart1').appendChild(chart1.element);
$('#chart2').append(chart2.element);
</script> </script>
</body> </body>
</html> </html>

Loading…
Cancel
Save