(scale, index, itemOpts)
| 137 | } |
| 138 | |
| 139 | function createPointLabelItem(scale, index, itemOpts) { |
| 140 | const outerDistance = scale.drawingArea; |
| 141 | const {extra, additionalAngle, padding, size} = itemOpts; |
| 142 | const pointLabelPosition = scale.getPointPosition(index, outerDistance + extra + padding, additionalAngle); |
| 143 | const angle = Math.round(toDegrees(_normalizeAngle(pointLabelPosition.angle + HALF_PI))); |
| 144 | const y = yForAngle(pointLabelPosition.y, size.h, angle); |
| 145 | const textAlign = getTextAlignForAngle(angle); |
| 146 | const left = leftForTextAlign(pointLabelPosition.x, size.w, textAlign); |
| 147 | return { |
| 148 | // if to draw or overlapped |
| 149 | visible: true, |
| 150 | |
| 151 | // Text position |
| 152 | x: pointLabelPosition.x, |
| 153 | y, |
| 154 | |
| 155 | // Text rendering data |
| 156 | textAlign, |
| 157 | |
| 158 | // Bounding box |
| 159 | left, |
| 160 | top: y, |
| 161 | right: left + size.w, |
| 162 | bottom: y + size.h |
| 163 | }; |
| 164 | } |
| 165 | |
| 166 | function isNotOverlapped(item, area) { |
| 167 | if (!area) { |
no test coverage detected