|
|
|
@ -86,8 +86,19 @@ export default function FlightContainer() {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const handlerStepSize = max => { |
|
|
|
|
const exponent = Math.ceil(Math.log10(max)); |
|
|
|
|
return 10 ** (exponent - 1); |
|
|
|
|
const exponent = Math.floor(Math.log10(max)); |
|
|
|
|
const base = Math.pow(10, exponent); |
|
|
|
|
let stepSize; |
|
|
|
|
|
|
|
|
|
if (max / base > 5) { |
|
|
|
|
stepSize = base; |
|
|
|
|
} else if (max / (base / 2) > 5) { |
|
|
|
|
stepSize = base / 2; |
|
|
|
|
} else { |
|
|
|
|
stepSize = base / 5; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return stepSize; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 1234.2345 -> 1,234.2
|
|
|
|
@ -109,7 +120,7 @@ export default function FlightContainer() {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// '24:35:12' -> '1일 35분 12초'
|
|
|
|
|
const parseTimeToSeconds = time => { |
|
|
|
|
const timeStringToDateString = time => { |
|
|
|
|
if (time === 'noData' || time === '00:00:00') return '0초'; |
|
|
|
|
|
|
|
|
|
const [hour, minute, second] = String(time).split(':').map(Number); |
|
|
|
@ -124,19 +135,31 @@ export default function FlightContainer() {
|
|
|
|
|
return parts.join(' '); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const formatPart = (value, unit) => (value > 0 ? `${value}${unit}` : ''); |
|
|
|
|
const formatPart = (value, unit) => { |
|
|
|
|
if (unit === 's' && value === 0) return '0s'; |
|
|
|
|
return value > 0 ? `${value}${unit}` : ''; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 975 -> '16분 15초'
|
|
|
|
|
const parseTimeToDate = time => { |
|
|
|
|
const secondsToDateString = (time, yAxes) => { |
|
|
|
|
const { days, hours, minutes, seconds } = secondsToDHMS(time); |
|
|
|
|
|
|
|
|
|
const parts = [ |
|
|
|
|
let parts = [ |
|
|
|
|
formatPart(days, '일'), |
|
|
|
|
formatPart(hours, '시간'), |
|
|
|
|
formatPart(minutes, '분'), |
|
|
|
|
formatPart(seconds, '초') |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
if (yAxes) { |
|
|
|
|
parts = [ |
|
|
|
|
formatPart(days, 'd'), |
|
|
|
|
formatPart(hours, 'h'), |
|
|
|
|
formatPart(minutes, 'm'), |
|
|
|
|
formatPart(seconds, 's') |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return parts.join(' '); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -156,12 +179,12 @@ export default function FlightContainer() {
|
|
|
|
|
titleName={titleName} |
|
|
|
|
totalTitle={totalTitle} |
|
|
|
|
totalData={flight} |
|
|
|
|
parseTimeToSeconds={parseTimeToSeconds} |
|
|
|
|
timeStringToDateString={timeStringToDateString} |
|
|
|
|
formatDistance={formatDistance} |
|
|
|
|
formatNumber={formatNumber} |
|
|
|
|
/> |
|
|
|
|
<StatisticsSearch |
|
|
|
|
parseTimeToDate={parseTimeToDate} |
|
|
|
|
secondsToDateString={secondsToDateString} |
|
|
|
|
searchData={flightSearch} |
|
|
|
|
searchType={searchType} |
|
|
|
|
categoryTypeOptions={categoryTypeOptions} |
|
|
|
|