diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-03-15 17:43:13 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2023-03-15 17:43:13 +0900 |
| commit | 58fc17e3b6cf71fb0476d849de0440518b93b1cd (patch) | |
| tree | c3fd5c741f03ec8204fd92f85328d0d9a9b62e95 /packages/frontend/src | |
| parent | Fix #10261 (#10323) (diff) | |
| download | misskey-58fc17e3b6cf71fb0476d849de0440518b93b1cd.tar.gz misskey-58fc17e3b6cf71fb0476d849de0440518b93b1cd.tar.bz2 misskey-58fc17e3b6cf71fb0476d849de0440518b93b1cd.zip | |
fix: tweak retention rate aggregation
Diffstat (limited to 'packages/frontend/src')
| -rw-r--r-- | packages/frontend/src/components/MkRetentionHeatmap.vue | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/frontend/src/components/MkRetentionHeatmap.vue b/packages/frontend/src/components/MkRetentionHeatmap.vue index 8326ec7ef3..85c009f746 100644 --- a/packages/frontend/src/components/MkRetentionHeatmap.vue +++ b/packages/frontend/src/components/MkRetentionHeatmap.vue @@ -36,9 +36,11 @@ async function renderChart() { const wide = rootEl.offsetWidth > 600; const narrow = rootEl.offsetWidth < 400; - const maxDays = wide ? 15 : narrow ? 5 : 10; + const maxDays = wide ? 10 : narrow ? 5 : 7; - const raw = await os.api('retention', { }); + let raw = await os.api('retention', { }); + + raw = raw.slice(0, maxDays); const data = []; for (const record of raw) { @@ -60,10 +62,9 @@ async function renderChart() { const color = defaultStore.state.darkMode ? '#b4e900' : '#86b300'; // 視覚上の分かりやすさのため上から最も大きい3つの値の平均を最大値とする - //const max = raw.readWrite.slice().sort((a, b) => b - a).slice(0, 3).reduce((a, b) => a + b, 0) / 3; - const max = 4; + const max = raw.map(x => x.users).slice().sort((a, b) => b - a).slice(0, 3).reduce((a, b) => a + b, 0) / 3; - const marginEachCell = 6; + const marginEachCell = 12; chartInstance = new Chart(chartEl, { type: 'matrix', |