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

Function alignY

src/plugins/plugin.tooltip.js:288–299  ·  view source on GitHub ↗
(size, yAlign, paddingAndSize)

Source from the content-addressed store, hash-verified

286}
287
288function alignY(size, yAlign, paddingAndSize) {
289 // eslint-disable-next-line prefer-const
290 let {y, height} = size;
291 if (yAlign === 'top') {
292 y += paddingAndSize;
293 } else if (yAlign === 'bottom') {
294 y -= height + paddingAndSize;
295 } else {
296 y -= (height / 2);
297 }
298 return y;
299}
300
301/**
302 * Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment

Callers 1

getBackgroundPointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected