(cdModule, plotSize)
| 1077 | } |
| 1078 | |
| 1079 | function layoutAreas(cdModule, plotSize) { |
| 1080 | var scaleGroups = []; |
| 1081 | |
| 1082 | // figure out the center and maximum radius |
| 1083 | for (var i = 0; i < cdModule.length; i++) { |
| 1084 | var cd0 = cdModule[i][0]; |
| 1085 | var trace = cd0.trace; |
| 1086 | |
| 1087 | var domain = trace.domain; |
| 1088 | var width = plotSize.w * (domain.x[1] - domain.x[0]); |
| 1089 | var height = plotSize.h * (domain.y[1] - domain.y[0]); |
| 1090 | // leave some space for the title, if it will be displayed outside |
| 1091 | if (trace.title.text && trace.title.position !== 'middle center') { |
| 1092 | height -= getTitleSpace(cd0, plotSize); |
| 1093 | } |
| 1094 | |
| 1095 | var rx = width / 2; |
| 1096 | var ry = height / 2; |
| 1097 | if (trace.type === 'funnelarea' && !trace.scalegroup) { |
| 1098 | ry /= trace.aspectratio; |
| 1099 | } |
| 1100 | |
| 1101 | cd0.r = Math.min(rx, ry) / (1 + getMaxPull(trace)); |
| 1102 | |
| 1103 | cd0.cx = plotSize.l + (plotSize.w * (trace.domain.x[1] + trace.domain.x[0])) / 2; |
| 1104 | cd0.cy = plotSize.t + plotSize.h * (1 - trace.domain.y[0]) - height / 2; |
| 1105 | if (trace.title.text && trace.title.position.indexOf('bottom') !== -1) { |
| 1106 | cd0.cy -= getTitleSpace(cd0, plotSize); |
| 1107 | } |
| 1108 | |
| 1109 | if (trace.scalegroup && scaleGroups.indexOf(trace.scalegroup) === -1) { |
| 1110 | scaleGroups.push(trace.scalegroup); |
| 1111 | } |
| 1112 | } |
| 1113 | |
| 1114 | groupScale(cdModule, scaleGroups); |
| 1115 | } |
| 1116 | |
| 1117 | function groupScale(cdModule, scaleGroups) { |
| 1118 | var cd0, i, trace; |
no test coverage detected
searching dependent graphs…