|
|
@ -22,7 +22,7 @@ export default function StatisticsSearch({ |
|
|
|
handlerBarTicks, |
|
|
|
handlerBarTicks, |
|
|
|
handlerTitleName, |
|
|
|
handlerTitleName, |
|
|
|
handleChangeSearchType, |
|
|
|
handleChangeSearchType, |
|
|
|
secondsToDateString |
|
|
|
formatSeconds |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
const [total, setTotal] = useState([]); |
|
|
|
const [total, setTotal] = useState([]); |
|
|
|
const [top, setTop] = useState([]); |
|
|
|
const [top, setTop] = useState([]); |
|
|
@ -44,23 +44,20 @@ export default function StatisticsSearch({ |
|
|
|
const filteredData = data => |
|
|
|
const filteredData = data => |
|
|
|
data.filter(i => i && !['nodata', 'NoData'].includes(i)); |
|
|
|
data.filter(i => i && !['nodata', 'NoData'].includes(i)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const graph = filteredData(graphData.map(i => i.value)); |
|
|
|
|
|
|
|
const top = filteredData(topData.map(i => i.value)); |
|
|
|
|
|
|
|
|
|
|
|
if (searchType.category === 'TIME') { |
|
|
|
if (searchType.category === 'TIME') { |
|
|
|
// ['00:00:00', '12:34:56'] -> [0,45296] 초 단위로 변경
|
|
|
|
// ['00:00:00', '12:34:56'] -> [0,45296] 초 단위로 변경
|
|
|
|
const timeGraph = filteredData(graphData.map(i => i.value)); |
|
|
|
const totalValue = parseTimeToSeconds(graph); |
|
|
|
const timeTop = filteredData(topData.map(i => i.value)); |
|
|
|
const topValue = parseTimeToSeconds(top); |
|
|
|
|
|
|
|
|
|
|
|
const totalValue = parseTimeToSeconds(timeGraph); |
|
|
|
|
|
|
|
const topValue = parseTimeToSeconds(timeTop); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTotal(totalValue); |
|
|
|
setTotal(totalValue); |
|
|
|
setTop(topValue); |
|
|
|
setTop(topValue); |
|
|
|
} else if (searchType.category === 'DISTANCE') { |
|
|
|
} else if (searchType.category === 'DISTANCE') { |
|
|
|
// [0.1234, 0.5678] -> [0.1, 0.5]
|
|
|
|
// [0.1234, 0.5678] -> [0.1, 0.5]
|
|
|
|
const distanceTotal = filteredData(graphData.map(i => i.value)); |
|
|
|
const totalValue = graph.map(i => i.toFixed(1)); |
|
|
|
const distanceTop = filteredData(topData.map(i => i.value)); |
|
|
|
const topValue = top.map(i => i.toFixed(1)); |
|
|
|
|
|
|
|
|
|
|
|
const totalValue = distanceTotal.map(i => i.toFixed(1)); |
|
|
|
|
|
|
|
const topValue = distanceTop.map(i => i.toFixed(1)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTotal(totalValue); |
|
|
|
setTotal(totalValue); |
|
|
|
setTop(topValue); |
|
|
|
setTop(topValue); |
|
|
@ -92,7 +89,7 @@ export default function StatisticsSearch({ |
|
|
|
output = ` ${value} 건`; |
|
|
|
output = ` ${value} 건`; |
|
|
|
|
|
|
|
|
|
|
|
if (searchType.category === 'TIME') { |
|
|
|
if (searchType.category === 'TIME') { |
|
|
|
const dateValue = secondsToDateString(value); |
|
|
|
const dateValue = formatSeconds(value); |
|
|
|
return (output = ` ${dateValue}`); |
|
|
|
return (output = ` ${dateValue}`); |
|
|
|
} else if (searchType.category === 'DISTANCE') { |
|
|
|
} else if (searchType.category === 'DISTANCE') { |
|
|
|
return (output = ` ${value} m`); |
|
|
|
return (output = ` ${value} m`); |
|
|
@ -136,7 +133,7 @@ export default function StatisticsSearch({ |
|
|
|
ticks: { |
|
|
|
ticks: { |
|
|
|
callback: function (value, index, values) { |
|
|
|
callback: function (value, index, values) { |
|
|
|
if (searchType.category === 'TIME') { |
|
|
|
if (searchType.category === 'TIME') { |
|
|
|
const dateValue = secondsToDateString(value, 'yAxes'); |
|
|
|
const dateValue = formatSeconds(value); |
|
|
|
return dateValue; |
|
|
|
return dateValue; |
|
|
|
} else if (searchType.category === 'DISTANCE') { |
|
|
|
} else if (searchType.category === 'DISTANCE') { |
|
|
|
return value + 'm'; |
|
|
|
return value + 'm'; |
|
|
@ -188,7 +185,7 @@ export default function StatisticsSearch({ |
|
|
|
output = ` ${label} : ${value} 건`; |
|
|
|
output = ` ${label} : ${value} 건`; |
|
|
|
|
|
|
|
|
|
|
|
if (searchType.category === 'TIME') { |
|
|
|
if (searchType.category === 'TIME') { |
|
|
|
const dateValue = secondsToDateString(value); |
|
|
|
const dateValue = formatSeconds(value); |
|
|
|
return (output = ` ${label} : ${dateValue}`); |
|
|
|
return (output = ` ${label} : ${dateValue}`); |
|
|
|
} else if (searchType.category === 'DISTANCE') { |
|
|
|
} else if (searchType.category === 'DISTANCE') { |
|
|
|
return (output = ` ${label} : ${value} m`); |
|
|
|
return (output = ` ${label} : ${value} m`); |
|
|
|