MCPcopy
hub / github.com/chartjs/Chart.js / createPointLabelItem

Function createPointLabelItem

src/scales/scale.radialLinear.js:139–164  ·  view source on GitHub ↗
(scale, index, itemOpts)

Source from the content-addressed store, hash-verified

137}
138
139function 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
166function isNotOverlapped(item, area) {
167 if (!area) {

Callers 1

buildPointLabelItemsFunction · 0.85

Calls 6

toDegreesFunction · 0.90
_normalizeAngleFunction · 0.85
getTextAlignForAngleFunction · 0.85
leftForTextAlignFunction · 0.85
yForAngleFunction · 0.70
getPointPositionMethod · 0.65

Tested by

no test coverage detected