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

Function _alignPixel

src/helpers/helpers.canvas.ts:125–129  ·  view source on GitHub ↗
(chart: Chart, pixel: number, width: number)

Source from the content-addressed store, hash-verified

123 * @private
124 */
125export function _alignPixel(chart: Chart, pixel: number, width: number) {
126 const devicePixelRatio = chart.currentDevicePixelRatio;
127 const halfWidth = width !== 0 ? Math.max(width / 2, 0.5) : 0;
128 return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;
129}
130
131/**
132 * Clears the entire canvas.

Callers 4

getPixelForDecimalMethod · 0.85
alignBorderValueMethod · 0.85
_computeGridLineItemsMethod · 0.85
drawBorderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected