From 794b12b0103379545ef20a14608fb84c6ff4cabd Mon Sep 17 00:00:00 2001 From: Chen Yu Date: Tue, 12 Dec 2023 13:01:37 +0900 Subject: [PATCH] feat: optimize the initial states of charts (#173) 1. only show live cell count by default; 2. unify selection of avg-block-time of its thumnail and large chart; 3. offset 1% start point of uncle rate because its initial value makes the chart obsure, similar to an outlier at the start point. --- src/pages/StatisticsChart/activities/CellCount.tsx | 5 +++++ src/pages/StatisticsChart/block/AverageBlockTime.tsx | 2 +- src/pages/StatisticsChart/mining/UncleRate.tsx | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/StatisticsChart/activities/CellCount.tsx b/src/pages/StatisticsChart/activities/CellCount.tsx index d42a75093..f23305539 100644 --- a/src/pages/StatisticsChart/activities/CellCount.tsx +++ b/src/pages/StatisticsChart/activities/CellCount.tsx @@ -99,6 +99,11 @@ const useOption = ( name: t('statistic.dead_cell'), }, ], + selected: { + [t('statistic.all_cells')]: false, + [t('statistic.live_cell')]: true, + [t('statistic.dead_cell')]: false, + }, }, grid: isThumbnail ? gridThumbnail : grid, dataZoom: isThumbnail ? [] : DATA_ZOOM_CONFIG, diff --git a/src/pages/StatisticsChart/block/AverageBlockTime.tsx b/src/pages/StatisticsChart/block/AverageBlockTime.tsx index 4f31c6259..34f96fd9b 100644 --- a/src/pages/StatisticsChart/block/AverageBlockTime.tsx +++ b/src/pages/StatisticsChart/block/AverageBlockTime.tsx @@ -80,7 +80,7 @@ const useOption = ( : undefined, grid: isThumbnail ? gridThumbnail : grid, /* Selection starts from 1% because the average block time is extremely high on launch */ - dataZoom: isThumbnail ? [] : DATA_ZOOM_CONFIG.map(zoom => ({ ...zoom, start: 1 })), + dataZoom: DATA_ZOOM_CONFIG.map(zoom => ({ ...zoom, show: !isThumbnail, start: 1 })), xAxis: [ { name: isMobile || isThumbnail ? '' : t('statistic.date'), diff --git a/src/pages/StatisticsChart/mining/UncleRate.tsx b/src/pages/StatisticsChart/mining/UncleRate.tsx index ff3f7abb1..e1f12c3d1 100644 --- a/src/pages/StatisticsChart/mining/UncleRate.tsx +++ b/src/pages/StatisticsChart/mining/UncleRate.tsx @@ -52,7 +52,8 @@ const useOption = ( } : undefined, grid: isThumbnail ? gridThumbnail : grid, - dataZoom: isThumbnail ? [] : DATA_ZOOM_CONFIG, + /* Selection starts from 1% because the uncle rate starts from 0 on launch */ + dataZoom: DATA_ZOOM_CONFIG.map(zoom => ({ ...zoom, show: !isThumbnail, start: 1 })), xAxis: [ { name: isMobile || isThumbnail ? '' : t('statistic.date'),