refactor(frontend): scripts -> utility
This commit is contained in:
parent
f35eb0f6d9
commit
be7e3b9a0c
464 changed files with 829 additions and 829 deletions
17
packages/frontend/src/utility/chart-legend.ts
Normal file
17
packages/frontend/src/utility/chart-legend.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { Plugin } from 'chart.js';
|
||||
import MkChartLegend from '@/components/MkChartLegend.vue';
|
||||
|
||||
export const chartLegend = (legend: InstanceType<typeof MkChartLegend>) => ({
|
||||
id: 'htmlLegend',
|
||||
afterUpdate(chart, args, options) {
|
||||
// Reuse the built-in legendItems generator
|
||||
const items = chart.options.plugins.legend.labels.generateLabels(chart);
|
||||
|
||||
legend.update(chart, items);
|
||||
},
|
||||
}) as Plugin;
|
||||
Loading…
Add table
Add a link
Reference in a new issue