Browse Source

Fix half pixel of axis ticks

pull/246/head
Masayuki Tanaka 11 years ago
parent
commit
18bca4b0ac
  1. 6
      c3.js
  2. 2
      c3.min.js

6
c3.js

@ -4636,12 +4636,12 @@
function axisX(selection, x) { function axisX(selection, x) {
selection.attr("transform", function (d) { selection.attr("transform", function (d) {
return "translate(" + Math.round(x(d) + tickOffset) + ", 0)"; return "translate(" + Math.ceil(x(d) + tickOffset) + ", 0)";
}); });
} }
function axisY(selection, y) { function axisY(selection, y) {
selection.attr("transform", function (d) { selection.attr("transform", function (d) {
return "translate(0," + Math.round(y(d)) + ")"; return "translate(0," + Math.ceil(y(d)) + ")";
}); });
} }
function scaleExtent(domain) { function scaleExtent(domain) {
@ -4699,7 +4699,7 @@
textUpdate = tickUpdate.select("text"); textUpdate = tickUpdate.select("text");
if (isCategory) { if (isCategory) {
tickOffset = Math.round((scale1(1) - scale1(0)) / 2); tickOffset = Math.ceil((scale1(1) - scale1(0)) / 2);
tickX = tickCentered ? 0 : tickOffset; tickX = tickCentered ? 0 : tickOffset;
} else { } else {
tickOffset = tickX = 0; tickOffset = tickX = 0;

2
c3.min.js vendored

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