/
githubmirror
/
Chart.js
Обзор
Документация
Войти
/
githubmirror
/
Chart.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v4.4.0
src/plugins/plugin.subtitle.js
53 строки
1019 B
Dan Onoshko
refactor: move to esm in sources (#10879)
17 ноя 2022, 16:08
Не верифицирован
17 ноя 2022, 16:08
5144127
Код
Авторство
О чём код?
import {Title} from './plugin.title.js'; import layouts from '../core/core.layouts.js'; const map = new WeakMap(); export default { id: 'subtitle', start(chart, _args, options) { const title = new Title({ ctx: chart.ctx, options, chart }); layouts.configure(chart, title, options); layouts.addBox(chart, title); map.set(chart, title); }, stop(chart) { layouts.removeBox(chart, map.get(chart)); map.delete(chart); }, beforeUpdate(chart, _args, options) { const title = map.get(chart); layouts.configure(chart, title, options); title.options = options; }, defaults: { align: 'center', display: false, font: { weight: 'normal', }, fullSize: true, padding: 0, position: 'top', text: '', weight: 1500 // by default greater than legend (1000) and smaller than title (2000) }, defaultRoutes: { color: 'color' }, descriptors: { _scriptable: true, _indexable: false, }, };