Skip to content

Commit b8b3d94

Browse files
committed
fit r using trace.aspectratio when having non scalegroup
1 parent 08a1f7b commit b8b3d94

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

Diff for: src/traces/funnelarea/plot.js

-7
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,6 @@ function setCoords(cd) {
247247
var scaleX = r / lastX;
248248
var scaleY = r / rY * aspectratio;
249249

250-
if(!trace.scalegroup) {
251-
if(aspectratio > cd0.figMaxH / cd0.figMaxW) {
252-
scaleX /= aspectratio;
253-
scaleY /= aspectratio;
254-
}
255-
}
256-
257250
// set funnelarea r
258251
cd0.r = scaleY * rY;
259252

Diff for: src/traces/pie/plot.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,13 @@ function layoutAreas(cdModule, plotSize) {
816816
height -= getTitleSpace(cd0, plotSize);
817817
}
818818

819-
cd0.figMaxH = height;
820-
cd0.figMaxW = width;
821-
cd0.r = Math.min(width / 2, height / 2) / (1 + getMaxPull(trace));
819+
var rx = width / 2;
820+
var ry = height / 2;
821+
if(trace.type === 'funnelarea' && !trace.scalegroup) {
822+
ry /= trace.aspectratio;
823+
}
824+
825+
cd0.r = Math.min(rx, ry) / (1 + getMaxPull(trace));
822826

823827
cd0.cx = plotSize.l + plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2;
824828
cd0.cy = plotSize.t + plotSize.h * (1 - trace.domain.y[0]) - height / 2;
@@ -852,13 +856,15 @@ function groupScale(cdModule, scaleGroups) {
852856
area = cd0.r * cd0.r;
853857
} else if(trace.type === 'funnelarea') {
854858
var rx, ry;
859+
855860
if(trace.aspectratio > 1) {
856861
rx = cd0.r;
857862
ry = rx / trace.aspectratio;
858863
} else {
859864
ry = cd0.r;
860865
rx = ry * trace.aspectratio;
861866
}
867+
862868
rx *= (1 + trace.baseratio) / 2;
863869

864870
area = rx * ry;
104 Bytes
Loading
Loading

0 commit comments

Comments
 (0)