/
githubmirror
/
Chart.js
Обзор
Документация
Войти
/
githubmirror
/
Chart.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/plugins/plugin.filler/simpleArc.js
27 строк
616 B
Dan Onoshko
refactor: move to esm in sources (#10879)
17 ноя 2022, 16:08
Не верифицирован
17 ноя 2022, 16:08
5144127
Код
Авторство
О чём код?
import {TAU} from '../../helpers/index.js'; // TODO: use elements.ArcElement instead export class simpleArc { constructor(opts) { this.x = opts.x; this.y = opts.y; this.radius = opts.radius; } pathSegment(ctx, bounds, opts) { const {x, y, radius} = this; bounds = bounds || {start: 0, end: TAU}; ctx.arc(x, y, radius, bounds.end, bounds.start, true); return !opts.bounds; } interpolate(point) { const {x, y, radius} = this; const angle = point.angle; return { x: x + Math.cos(angle) * radius, y: y + Math.sin(angle) * radius, angle }; } }