Browse Source

Fix bar width when categorized axis

pull/51/head
Masayuki Tanaka 11 years ago
parent
commit
5e9fd991ab
  1. 10
      c3.js

10
c3.js

@ -2117,8 +2117,7 @@
var rectX, rectW; var rectX, rectW;
var withY, withSubchart, withTransition, withTransform, withUpdateXDomain, withUpdateOrgXDomain; var withY, withSubchart, withTransition, withTransform, withUpdateXDomain, withUpdateOrgXDomain;
var hideAxis = hasArcType(c3.data.targets); var hideAxis = hasArcType(c3.data.targets);
var drawBar = generateDrawBar(barIndices), drawBarOnSub = generateDrawBar(barIndices, true); var drawBar, drawBarOnSub, xForText, yForText;
var xForText = generateXYForText(barIndices, true), yForText = generateXYForText(barIndices, false);
var duration; var duration;
options = isDefined(options) ? options : {}; options = isDefined(options) ? options : {};
@ -2152,6 +2151,11 @@
main.select(".y.axis").style("opacity", hideAxis ? 0 : 1).transition().duration(__axis_rotated ? 0 : duration).call(__axis_rotated ? xAxis : yAxis); main.select(".y.axis").style("opacity", hideAxis ? 0 : 1).transition().duration(__axis_rotated ? 0 : duration).call(__axis_rotated ? xAxis : yAxis);
main.select(".y2.axis").style("opacity", hideAxis ? 0 : 1).transition().call(yAxis2); main.select(".y2.axis").style("opacity", hideAxis ? 0 : 1).transition().call(yAxis2);
// setup drawer - MEMO: these must be called after axis updated
drawBar = generateDrawBar(barIndices);
xForText = generateXYForText(barIndices, true);
yForText = generateXYForText(barIndices, false);
// Update label position // Update label position
main.select(".x.axis .-axis-x-label").attr("x", width); main.select(".x.axis .-axis-x-label").attr("x", width);
@ -2335,6 +2339,8 @@
if (!brush.empty()) { if (!brush.empty()) {
brush.extent(x.orgDomain()).update(); brush.extent(x.orgDomain()).update();
} }
// setup drawer - MEMO: this must be called after axis updated
drawBarOnSub = generateDrawBar(barIndices, true);
// bars // bars
contextBar = context.selectAll('.-bars').selectAll('.-bar') contextBar = context.selectAll('.-bars').selectAll('.-bar')
.data(barData); .data(barData);

Loading…
Cancel
Save