From 6eaaea21c57ff0442892a4d184cf1a8190c15a81 Mon Sep 17 00:00:00 2001 From: hhjk00 Date: Thu, 30 Nov 2023 10:34:10 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=84=ED=96=89=EC=8B=9C=EA=B0=84=20stepSize?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statistics/AbnormalSituationContainer.js | 4 ++-- src/containers/statistics/FlightContainer.js | 12 +++++++++--- src/containers/statistics/FlightResultContainer.js | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/containers/statistics/AbnormalSituationContainer.js b/src/containers/statistics/AbnormalSituationContainer.js index 6d34941..290175d 100644 --- a/src/containers/statistics/AbnormalSituationContainer.js +++ b/src/containers/statistics/AbnormalSituationContainer.js @@ -96,7 +96,7 @@ export default function AbnormalSituationContainer() { // Bar Graph handler const handlerBarTicks = data => { const max = calculateMax(data); - const stepSize = hadnlerStepSize(max); + const stepSize = handlerStepSize(max); return { max, stepSize }; }; @@ -106,7 +106,7 @@ export default function AbnormalSituationContainer() { return Math.ceil(max / 5) * 5; }; - const hadnlerStepSize = max => { + const handlerStepSize = max => { const step = Math.ceil(max / 5); let stepSize; diff --git a/src/containers/statistics/FlightContainer.js b/src/containers/statistics/FlightContainer.js index 434f625..a7dc31f 100644 --- a/src/containers/statistics/FlightContainer.js +++ b/src/containers/statistics/FlightContainer.js @@ -94,7 +94,7 @@ export default function FlightContainer() { // Bar Graph handler const handlerBarTicks = data => { const max = calculateMax(data); - const stepSize = hadnlerStepSize(max); + const stepSize = handlerStepSize(max); return { max, stepSize }; }; @@ -104,13 +104,19 @@ export default function FlightContainer() { return Math.ceil(max / 5) * 5; }; - const hadnlerStepSize = max => { + const handlerStepSize = max => { const step = Math.ceil(max / 5); let stepSize; if (searchType.category === 'TIME') { - stepSize = 3600; + const hour = 3600; + + if (max > hour * 60) stepSize = hour * 12; + else if (max > hour * 40) stepSize = hour * 6; + else if (max > hour * 20) stepSize = hour * 4; + else if (max > hour * 10) stepSize = hour * 2; + else stepSize = hour; } else { if (max > 100) { stepSize = Math.ceil(step / 50) * 50; diff --git a/src/containers/statistics/FlightResultContainer.js b/src/containers/statistics/FlightResultContainer.js index dda3461..38b6291 100644 --- a/src/containers/statistics/FlightResultContainer.js +++ b/src/containers/statistics/FlightResultContainer.js @@ -94,7 +94,7 @@ export default function ResultContainer() { // Bar Graph handler const handlerBarTicks = data => { const max = calculateMax(data); - const stepSize = hadnlerStepSize(max); + const stepSize = handlerStepSize(max); return { max, stepSize }; }; @@ -104,7 +104,7 @@ export default function ResultContainer() { return Math.ceil(max / 5) * 5; }; - const hadnlerStepSize = max => { + const handlerStepSize = max => { const step = Math.ceil(max / 5); let stepSize;