Commit 93348c05 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix resize and zoom when categorized axis

parent afefe29a
...@@ -214,9 +214,35 @@ ...@@ -214,9 +214,35 @@
yAxis.scale(y).orient(__axis_rotated ? (__axis_y_inner ? "top" : "bottom") : (__axis_y_inner ? "right" : "left")); yAxis.scale(y).orient(__axis_rotated ? (__axis_y_inner ? "top" : "bottom") : (__axis_y_inner ? "right" : "left"));
yAxis2.scale(y2).orient(__axis_rotated ? (__axis_y2_inner ? "bottom" : "top") : (__axis_y2_inner ? "left" : "right")); yAxis2.scale(y2).orient(__axis_rotated ? (__axis_y2_inner ? "bottom" : "top") : (__axis_y2_inner ? "left" : "right"));
subXAxis.scale(subX).orient("bottom"); subXAxis.scale(subX).orient("bottom");
// Use custom scale if needed
if (isCategorized) {
// TODO: fix this
// TODO: fix x_grid
(function () {
var _x = x, _subX = subX;
var keys = Object.keys(x), key, i;
x = function(d){ return _x(d) + xAxis.tickOffset(); };
subX = function(d){ return _subX(d) + subXAxis.tickOffset(); };
for (i = 0; i < keys.length; i++) {
key = keys[i];
x[key] = _x[key];
subX[key] = _subX[key];
}
x.domain = function (domain) {
if (!arguments.length) {
var domain = _x.domain();
domain[1]++;
return domain;
}
_x.domain(domain);
return x;
};
})();
}
}; };
updateScales(); updateScales();
// Set up axies
if (isTimeSeries) { if (isTimeSeries) {
xAxis.tickFormat(customTimeFormat); xAxis.tickFormat(customTimeFormat);
} }
...@@ -234,32 +260,6 @@ ...@@ -234,32 +260,6 @@
}; };
} }
// Use custom scale if needed
if (isCategorized) {
// TODO: fix this
// TODO: fix x_grid
(function () {
var _x = x, _subX = subX;
var keys = Object.keys(x), key, i;
x = function(d){ return _x(d) + xAxis.tickOffset(); };
subX = function(d){ return _subX(d) + subXAxis.tickOffset(); };
for (i = 0; i < keys.length; i++) {
key = keys[i];
x[key] = _x[key];
subX[key] = _subX[key];
}
x.domain = function (domain) {
if (!arguments.length) {
var domain = _x.domain();
domain[1]++;
return domain;
}
_x.domain(domain);
return x;
};
})();
}
// For main region // For main region
var lineOnMain = (function () { var lineOnMain = (function () {
var line = d3.svg.line() var line = d3.svg.line()
......
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