Commit 8f35e4ac authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix bar width on subchart when brush - #497

parent bab6c75f
......@@ -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;
};
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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;
};
......
......@@ -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),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment