(crValue, crForm)
| 256 | |
| 257 | // Calculate corner radius of bar in pixels |
| 258 | function calcCornerRadius(crValue, crForm) { |
| 259 | if (!crValue) return 0; |
| 260 | |
| 261 | var barWidth = isHorizontal ? Math.abs(y1 - y0) : Math.abs(x1 - x0); |
| 262 | var barLength = isHorizontal ? Math.abs(x1 - x0) : Math.abs(y1 - y0); |
| 263 | var stackedBarTotalLength = fixpx(Math.abs(c2p(outerBound, true) - c2p(0, true))); |
| 264 | var maxRadius = di.hasB |
| 265 | ? Math.min(barWidth / 2, barLength / 2) |
| 266 | : Math.min(barWidth / 2, stackedBarTotalLength); |
| 267 | var crPx; |
| 268 | |
| 269 | if (crForm === '%') { |
| 270 | // If radius is given as a % string, convert to number of pixels |
| 271 | var crPercent = Math.min(50, crValue); |
| 272 | crPx = barWidth * (crPercent / 100); |
| 273 | } else { |
| 274 | // Otherwise, it's already a number of pixels, use the given value |
| 275 | crPx = crValue; |
| 276 | } |
| 277 | return fixpx(Math.max(Math.min(crPx, maxRadius), 0)); |
| 278 | } |
| 279 | // Exclude anything which is not explicitly a bar or histogram chart from rounding |
| 280 | var r = isBar || isHistogram ? calcCornerRadius(t.cornerradiusvalue, t.cornerradiusform) : 0; |
| 281 | // Construct path string for bar |
no outgoing calls
no test coverage detected
searching dependent graphs…