re-enable chartjs-plugin-gradient

This commit is contained in:
syuilo 2022-12-10 16:39:04 +09:00
parent c5213dddbf
commit 2f9de0c765

View file

@ -34,9 +34,7 @@ import {
import 'chartjs-adapter-date-fns'; import 'chartjs-adapter-date-fns';
import { enUS } from 'date-fns/locale'; import { enUS } from 'date-fns/locale';
import zoomPlugin from 'chartjs-plugin-zoom'; import zoomPlugin from 'chartjs-plugin-zoom';
// https://github.com/misskey-dev/misskey/pull/8575#issuecomment-1114242002 import gradient from 'chartjs-plugin-gradient';
// We can't use gradient because Vite throws a error.
//import gradient from 'chartjs-plugin-gradient';
import * as os from '@/os'; import * as os from '@/os';
import { defaultStore } from '@/store'; import { defaultStore } from '@/store';
import { useChartTooltip } from '@/scripts/use-chart-tooltip'; import { useChartTooltip } from '@/scripts/use-chart-tooltip';
@ -97,7 +95,7 @@ Chart.register(
SubTitle, SubTitle,
Filler, Filler,
zoomPlugin, zoomPlugin,
//gradient, gradient,
); );
const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b)); const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b));
@ -191,7 +189,7 @@ const render = () => {
borderJoinStyle: 'round', borderJoinStyle: 'round',
borderRadius: props.bar ? 3 : undefined, borderRadius: props.bar ? 3 : undefined,
backgroundColor: props.bar ? (x.color ? x.color : getColor(i)) : alpha(x.color ? x.color : getColor(i), 0.1), backgroundColor: props.bar ? (x.color ? x.color : getColor(i)) : alpha(x.color ? x.color : getColor(i), 0.1),
/*gradient: props.bar ? undefined : { gradient: props.bar ? undefined : {
backgroundColor: { backgroundColor: {
axis: 'y', axis: 'y',
colors: { colors: {
@ -199,7 +197,7 @@ const render = () => {
[maxes[i]]: alpha(x.color ? x.color : getColor(i), 0.2), [maxes[i]]: alpha(x.color ? x.color : getColor(i), 0.2),
}, },
}, },
},*/ },
barPercentage: 0.9, barPercentage: 0.9,
categoryPercentage: 0.9, categoryPercentage: 0.9,
fill: x.type === 'area', fill: x.type === 'area',
@ -310,7 +308,7 @@ const render = () => {
}, },
}, },
} : undefined, } : undefined,
//gradient, gradient,
}, },
}, },
plugins: [{ plugins: [{