Browse Source

Fix tick width when no tick exists - #295

pull/319/head
Masayuki Tanaka 11 years ago
parent
commit
3746404fc9
  1. 14
      c3.js
  2. 6
      c3.min.js

14
c3.js

@ -378,6 +378,7 @@
var isLegendRight = __legend_position === 'right';
var legendStep = 0, legendItemWidth = 0, legendItemHeight = 0, legendOpacityForHidden = 0.15;
var currentMaxTickWidth = 0;
/*-- Define Functions --*/
@ -951,11 +952,14 @@
}
function getMaxTickWidth(id) {
var maxWidth = 0, axisClass = id === 'x' ? CLASS.axisX : id === 'y' ? CLASS.axisY : CLASS.axisY2;
d3.selectAll('.' + axisClass + ' .tick text').each(function () {
var box = this.getBoundingClientRect();
if (maxWidth < box.width) { maxWidth = box.width; }
});
return maxWidth < 0 ? 0 : maxWidth;
if (svg) {
svg.selectAll('.' + axisClass + ' .tick text').each(function () {
var box = this.getBoundingClientRect();
if (maxWidth < box.width) { maxWidth = box.width; }
});
}
currentMaxTickWidth = maxWidth <= 0 ? currentMaxTickWidth : maxWidth;
return currentMaxTickWidth;
}
function updateAxisLabels(withTransition) {
var axisXLabel = main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel),

6
c3.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save