Commit 4112ee1b authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix trivial

parent db37719f
...@@ -692,9 +692,10 @@ ...@@ -692,9 +692,10 @@
domainLength = Math.abs(yDomainMax - yDomainMin), domainLength = Math.abs(yDomainMax - yDomainMin),
padding = domainLength * 0.1, // TODO: should be an option padding = domainLength * 0.1, // TODO: should be an option
padding_top = padding, padding_bottom = padding, padding_top = padding, padding_bottom = padding,
center = axisId === 'y2' ? __axis_y2_center : __axis_y_center; center = axisId === 'y2' ? __axis_y2_center : __axis_y_center,
yDomainAbs, widths, diff, ratio;
if (center) { if (center) {
var yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax)); yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax));
yDomainMax = yDomainAbs - center; yDomainMax = yDomainAbs - center;
yDomainMin = center - yDomainAbs; yDomainMin = center - yDomainAbs;
} }
...@@ -708,8 +709,9 @@ ...@@ -708,8 +709,9 @@
} }
// add padding for data label // add padding for data label
if (hasDataLabel() && __axis_rotated) { if (hasDataLabel() && __axis_rotated) {
var widths = getDataLabelWidth(yDomainMin, yDomainMax), diff = diffDomain(y.range()); widths = getDataLabelWidth(yDomainMin, yDomainMax);
var ratio = [widths[0] / diff, widths[1] / diff]; diff = diffDomain(y.range());
ratio = [widths[0] / diff, widths[1] / diff];
padding_top += domainLength * (ratio[1] / (1 - ratio[0] - ratio[1])); padding_top += domainLength * (ratio[1] / (1 - ratio[0] - ratio[1]));
padding_bottom += domainLength * (ratio[0] / (1 - ratio[0] - ratio[1])); padding_bottom += domainLength * (ratio[0] / (1 - ratio[0] - ratio[1]));
} }
......
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