Browse Source

Fix bar width on subchart when brush - #497

pull/542/head
Masayuki Tanaka 10 years ago
parent
commit
8f35e4acc2
  1. 6
      c3.js
  2. 4
      c3.min.js
  3. 3
      src/axis.js
  4. 3
      src/shape.bar.js

6
c3.js

@ -2885,8 +2885,9 @@
};
c3_chart_internal_fn.generateGetBarPoints = function (barIndices, isSub) {
var $$ = this,
axis = isSub ? $$.subXAxis : $$.xAxis,
barTargetsNum = barIndices.__max__ + 1,
barW = $$.getBarW($$.xAxis, barTargetsNum),
barW = $$.getBarW(axis, barTargetsNum),
barX = $$.getShapeX(barW, barTargetsNum, barIndices, !!isSub),
barY = $$.getShapeY(!!isSub),
barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub),
@ -3758,7 +3759,8 @@
} else {
// TODO: move this to c3_axis
axis.tickOffset = function () {
var edgeX = $$.getEdgeX($$.data.targets), diff = $$.x(edgeX[1]) - $$.x(edgeX[0]),
var scale = this.scale(),
edgeX = $$.getEdgeX($$.data.targets), diff = scale(edgeX[1]) - scale(edgeX[0]),
base = diff ? diff : (config.axis_rotated ? $$.height : $$.width);
return (base / $$.getMaxDataCount()) / 2;
};

4
c3.min.js vendored

File diff suppressed because one or more lines are too long

3
src/axis.js

@ -48,7 +48,8 @@ c3_chart_internal_fn.getXAxis = function (scale, orient, tickFormat, tickValues)
} else {
// TODO: move this to c3_axis
axis.tickOffset = function () {
var edgeX = $$.getEdgeX($$.data.targets), diff = $$.x(edgeX[1]) - $$.x(edgeX[0]),
var scale = this.scale(),
edgeX = $$.getEdgeX($$.data.targets), diff = scale(edgeX[1]) - scale(edgeX[0]),
base = diff ? diff : (config.axis_rotated ? $$.height : $$.width);
return (base / $$.getMaxDataCount()) / 2;
};

3
src/shape.bar.js

@ -86,8 +86,9 @@ c3_chart_internal_fn.generateDrawBar = function (barIndices, isSub) {
};
c3_chart_internal_fn.generateGetBarPoints = function (barIndices, isSub) {
var $$ = this,
axis = isSub ? $$.subXAxis : $$.xAxis,
barTargetsNum = barIndices.__max__ + 1,
barW = $$.getBarW($$.xAxis, barTargetsNum),
barW = $$.getBarW(axis, barTargetsNum),
barX = $$.getShapeX(barW, barTargetsNum, barIndices, !!isSub),
barY = $$.getShapeY(!!isSub),
barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub),

Loading…
Cancel
Save