fix following chart

This commit is contained in:
syuilo 2023-01-08 20:02:07 +09:00
parent 8977d87021
commit 1d7e0293a8
1 changed files with 7 additions and 6 deletions

View File

@ -34,7 +34,7 @@ const chartEl = $shallowRef<HTMLCanvasElement>(null);
let legendEl = $shallowRef<InstanceType<typeof MkChartLegend>>(); let legendEl = $shallowRef<InstanceType<typeof MkChartLegend>>();
const now = new Date(); const now = new Date();
let chartInstance: Chart = null; let chartInstance: Chart = null;
const chartLimit = 50; const chartLimit = 30;
let fetching = $ref(true); let fetching = $ref(true);
const { handler: externalTooltipHandler } = useChartTooltip(); const { handler: externalTooltipHandler } = useChartTooltip();
@ -77,7 +77,8 @@ async function renderChart() {
borderWidth: 0, borderWidth: 0,
borderJoinStyle: 'round', borderJoinStyle: 'round',
borderRadius: 4, borderRadius: 4,
barPercentage: 0.9, barPercentage: 0.7,
categoryPercentage: 0.7,
fill: true, fill: true,
} satisfies ChartDataset, extra); } satisfies ChartDataset, extra);
} }
@ -86,10 +87,10 @@ async function renderChart() {
type: 'bar', type: 'bar',
data: { data: {
datasets: [ datasets: [
makeDataset('Follow (local)', format(raw.local.followings.inc).slice().reverse(), { backgroundColor: colorFollowLocal }), makeDataset('Follow (local)', format(raw.local.followings.inc).slice().reverse(), { backgroundColor: colorFollowLocal, stack: 'follow' }),
makeDataset('Follow (remote)', format(raw.remote.followings.inc).slice().reverse(), { backgroundColor: colorFollowRemote }), makeDataset('Follow (remote)', format(raw.remote.followings.inc).slice().reverse(), { backgroundColor: colorFollowRemote, stack: 'follow' }),
makeDataset('Followed (local)', format(raw.local.followers.inc).slice().reverse(), { backgroundColor: colorFollowedLocal }), makeDataset('Followed (local)', format(raw.local.followers.inc).slice().reverse(), { backgroundColor: colorFollowedLocal, stack: 'followed' }),
makeDataset('Followed (remote)', format(raw.remote.followers.inc).slice().reverse(), { backgroundColor: colorFollowedRemote }), makeDataset('Followed (remote)', format(raw.remote.followers.inc).slice().reverse(), { backgroundColor: colorFollowedRemote, stack: 'followed' }),
], ],
}, },
options: { options: {