Commit f834ca6a authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix centered category axis - #804

parent d81715b9
......@@ -6650,7 +6650,7 @@
var dy = sizeFor1Char.h;
if (i === 0) {
if (orient === 'left' || orient === 'right') {
dy = -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - (params.isCategory ? 2 : 3));
dy = -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3);
} else {
dy = ".71em";
}
......@@ -6659,7 +6659,7 @@
}
function tickSize(d) {
var tickPosition = scale(d) + tickOffset;
var tickPosition = scale(d) + (tickCentered ? 0 : tickOffset);
return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -411,7 +411,7 @@ describe('c3 chart axis', function () {
ticks.each(function (d, i) {
var tspans = d3.select(this).selectAll('tspan'),
expectedX = '-9',
expectedDy = '2';
expectedDy = '3';
if (i > 0) { // i === 0 should be checked in next test
expect(tspans.size()).toBe(1);
tspans.each(function () {
......
......@@ -146,7 +146,7 @@ function c3_axis(d3, params) {
var dy = sizeFor1Char.h;
if (i === 0) {
if (orient === 'left' || orient === 'right') {
dy = -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - (params.isCategory ? 2 : 3));
dy = -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3);
} else {
dy = ".71em";
}
......@@ -155,7 +155,7 @@ function c3_axis(d3, params) {
}
function tickSize(d) {
var tickPosition = scale(d) + tickOffset;
var tickPosition = scale(d) + (tickCentered ? 0 : tickOffset);
return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0;
}
......
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