From f629561d25c448aa7b422049047ae964522835e4 Mon Sep 17 00:00:00 2001 From: Keith Date: Sat, 4 Nov 2023 15:38:43 +0900 Subject: [PATCH 1/2] feat: set start point of selection of avg-block-time 1% Selection starts from 1% because the avg block time is extremely high on blockchain launch Ref: https://github.com/nervosnetwork/ckb-explorer-frontend/issues/1350 --- src/pages/StatisticsChart/block/AverageBlockTime.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/StatisticsChart/block/AverageBlockTime.tsx b/src/pages/StatisticsChart/block/AverageBlockTime.tsx index 91cbca489..dfb2e8305 100644 --- a/src/pages/StatisticsChart/block/AverageBlockTime.tsx +++ b/src/pages/StatisticsChart/block/AverageBlockTime.tsx @@ -88,7 +88,8 @@ const useOption = ( } : undefined, grid: isThumbnail ? gridThumbnail : grid, - dataZoom: isThumbnail ? [] : DATA_ZOOM_CONFIG, + /* Selection starts from 1% because the average block time is extremely high on launch */ + dataZoom: isThumbnail ? [] : DATA_ZOOM_CONFIG.map(zoom => ({ ...zoom, start: 1 })), xAxis: [ { name: isMobile || isThumbnail ? '' : t('statistic.date'), From 231e972e29faeb1659699ee0d6c9a51b442a6e31 Mon Sep 17 00:00:00 2001 From: Keith Date: Sat, 4 Nov 2023 17:52:02 +0900 Subject: [PATCH 2/2] feat: remove fixed y-axis range of avg-block-time Remove the fixed range so the y-scale adjust itself automatically by scaling --- src/pages/StatisticsChart/block/AverageBlockTime.tsx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/pages/StatisticsChart/block/AverageBlockTime.tsx b/src/pages/StatisticsChart/block/AverageBlockTime.tsx index dfb2e8305..63e357cc1 100644 --- a/src/pages/StatisticsChart/block/AverageBlockTime.tsx +++ b/src/pages/StatisticsChart/block/AverageBlockTime.tsx @@ -31,14 +31,6 @@ const useOption = ( containLabel: true, } - const maxAndMinAxis = (statisticAverageBlockTimes: ChartItem.AverageBlockTime[]) => { - const array = statisticAverageBlockTimes.flatMap(data => parseFloat(data.avgBlockTimeDaily)) - return { - max: Math.ceil(Math.max(...array) / 1000), - min: Math.floor(Math.min(...array) / 1000), - } - } - const widthSpan = (value: string) => tooltipWidth(value, currentLanguage === 'en' ? 180 : 100) const parseTooltip = ({ seriesName, data, color }: SeriesItem & { data: string }): string => { @@ -114,8 +106,6 @@ const useOption = ( nameTextStyle: { align: 'left', }, - max: () => maxAndMinAxis(statisticAverageBlockTimes).max, - min: () => maxAndMinAxis(statisticAverageBlockTimes).min, axisLine: { lineStyle: { color: chartColor.colors[0], @@ -133,8 +123,6 @@ const useOption = ( nameTextStyle: { align: 'right', }, - max: () => maxAndMinAxis(statisticAverageBlockTimes).max, - min: () => maxAndMinAxis(statisticAverageBlockTimes).min, axisLine: { lineStyle: { color: chartColor.colors[1],