MCPcopy Create free account
hub / github.com/chartjs/Chart.js / alignY

Function alignY

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

Source from the content-addressed store, hash-verified

322}
323
324function alignY(size, yAlign, paddingAndSize) {
325 // eslint-disable-next-line prefer-const
326 let {y, height} = size;
327 if (yAlign === 'top') {
328 y += paddingAndSize;
329 } else if (yAlign === 'bottom') {
330 y -= height + paddingAndSize;
331 } else {
332 y -= (height / 2);
333 }
334 return y;
335}
336
337/**
338 * 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