Commit d209f3d6 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix padding left when rotated

parent 114fb230
...@@ -333,7 +333,7 @@ ...@@ -333,7 +333,7 @@
} else if (__padding_left) { } else if (__padding_left) {
return __padding_left; return __padding_left;
} else { } else {
return __axis_y_inner ? 1 : getAxisWidthByAxisId('y'); return __axis_rotated || __axis_y_inner ? 1 : getAxisWidthByAxisId('y');
} }
} }
function getCurrentPaddingRight() { function getCurrentPaddingRight() {
...@@ -561,13 +561,13 @@ ...@@ -561,13 +561,13 @@
}; };
} }
function getXAxisLabelPosition() { function getXAxisLabelPosition() {
return getAxisLabelPosition(__axis_x_label, 'inner-right'); return getAxisLabelPosition(__axis_x_label, __axis_rotated ? 'inner-top' : 'inner-right');
} }
function getYAxisLabelPosition() { function getYAxisLabelPosition() {
return getAxisLabelPosition(__axis_y_label, 'inner-top'); return getAxisLabelPosition(__axis_y_label, __axis_rotated ? 'inner-right' : 'inner-top');
} }
function getY2AxisLabelPosition() { function getY2AxisLabelPosition() {
return getAxisLabelPosition(__axis_y2_label, 'inner-top'); return getAxisLabelPosition(__axis_y2_label, __axis_rotated ? 'inner-right' : 'inner-top');
} }
function getAxisLabelPositionById(id) { function getAxisLabelPositionById(id) {
return id === 'y2' ? getY2AxisLabelPosition() : id === 'y' ? getYAxisLabelPosition() : getXAxisLabelPosition(); return id === 'y2' ? getY2AxisLabelPosition() : id === 'y' ? getYAxisLabelPosition() : getXAxisLabelPosition();
...@@ -611,6 +611,9 @@ ...@@ -611,6 +611,9 @@
function xForY2AxisLabel() { function xForY2AxisLabel() {
return xForAxisLabel(__axis_rotated, getY2AxisLabelPosition()); return xForAxisLabel(__axis_rotated, getY2AxisLabelPosition());
} }
function dxForXAxisLabel() {
return dxForAxisLabel(!__axis_rotated, getXAxisLabelPosition());
}
function dxForYAxisLabel() { function dxForYAxisLabel() {
return dxForAxisLabel(__axis_rotated, getYAxisLabelPosition()); return dxForAxisLabel(__axis_rotated, getYAxisLabelPosition());
} }
...@@ -1962,6 +1965,7 @@ ...@@ -1962,6 +1965,7 @@
.append("text") .append("text")
.attr("class", "-axis-x-label") .attr("class", "-axis-x-label")
.attr("transform", __axis_rotated ? "rotate(-90)" : "") .attr("transform", __axis_rotated ? "rotate(-90)" : "")
.attr("dx", dxForXAxisLabel)
.attr("dy", dyForXAxisLabel) .attr("dy", dyForXAxisLabel)
.style("text-anchor", textAnchorForXAxisLabel) .style("text-anchor", textAnchorForXAxisLabel)
.text(textForXAxisLabel); .text(textForXAxisLabel);
...@@ -1972,6 +1976,7 @@ ...@@ -1972,6 +1976,7 @@
.attr("class", "-axis-y-label") .attr("class", "-axis-y-label")
.attr("transform", __axis_rotated ? "" : "rotate(-90)") .attr("transform", __axis_rotated ? "" : "rotate(-90)")
.attr("dx", dxForYAxisLabel) .attr("dx", dxForYAxisLabel)
.attr("dy", dyForYAxisLabel)
.style("text-anchor", textAnchorForYAxisLabel) .style("text-anchor", textAnchorForYAxisLabel)
.text(textForYAxisLabel); .text(textForYAxisLabel);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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