-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feat/#46
- Loading branch information
Showing
8 changed files
with
179 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import ECharts from "echarts-for-react" | ||
|
||
const poseTypeLabels: any = { | ||
TURTLE_NECK: "거북목", | ||
SHOULDER_TWIST: "어깨 틀어짐", | ||
CHIN_UTP: "턱 괴기", | ||
TAILBONE_SIT: "꼬리뼈로 앉기", | ||
} | ||
|
||
const PoseAnalysisChart = ({ data }: { data: any[] }) => { | ||
const options = { | ||
tooltip: { | ||
trigger: "axis", | ||
axisPointer: { | ||
type: "shadow", | ||
}, | ||
}, | ||
legend: { | ||
data: Object.values(poseTypeLabels), | ||
top: 20, | ||
}, | ||
grid: { | ||
left: "3%", | ||
right: "3%", | ||
bottom: "5%", | ||
top: "25%", | ||
containLabel: true, | ||
}, | ||
xAxis: { | ||
type: "category", | ||
data: data.map((item) => item.date), | ||
}, | ||
yAxis: { | ||
type: "value", | ||
minInterval: 1, | ||
axisLabel: { | ||
formatter: "{value}", | ||
}, | ||
}, | ||
series: Object.keys(poseTypeLabels).map((poseType) => ({ | ||
name: poseTypeLabels[poseType], | ||
type: "line", | ||
data: data.map((item) => { | ||
const poseCount = item.count.find((c: any) => c.type === poseType) | ||
return poseCount ? poseCount.count : 0 | ||
}), | ||
})), | ||
} | ||
|
||
return <ECharts option={options} opts={{ renderer: "svg" }} style={{ height: "100%", width: "100%" }} /> | ||
} | ||
|
||
export default PoseAnalysisChart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { getTodayPoseAnalysis, getTotalPoseAnalysis } from "@/api/analysis" | ||
import { useQueries } from "@tanstack/react-query" | ||
|
||
export const usePoseAnalysis = () => { | ||
const results = useQueries({ | ||
queries: [ | ||
{ | ||
queryKey: ["todayAnalysis"], | ||
queryFn: getTodayPoseAnalysis, | ||
}, | ||
{ | ||
queryKey: ["totalAnalysis"], | ||
queryFn: getTotalPoseAnalysis, | ||
}, | ||
], | ||
}) | ||
|
||
const [todayAnalysis, totalAnalysis] = results | ||
|
||
return { | ||
todayAnalysis: todayAnalysis.data, | ||
totalAnalysis: totalAnalysis.data, | ||
isLoading: results.some((result) => result.isLoading), | ||
isError: results.some((result) => result.isError), | ||
errors: results.map((result) => result.error).filter(Boolean), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1270,6 +1270,22 @@ eastasianwidth@^0.2.0: | |
resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz" | ||
integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== | ||
|
||
echarts-for-react@^3.0.2: | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/echarts-for-react/-/echarts-for-react-3.0.2.tgz#ac5859157048a1066d4553e34b328abb24f2b7c1" | ||
integrity sha512-DRwIiTzx8JfwPOVgGttDytBqdp5VzCSyMRIxubgU/g2n9y3VLUmF2FK7Icmg/sNVkv4+rktmrLN9w22U2yy3fA== | ||
dependencies: | ||
fast-deep-equal "^3.1.3" | ||
size-sensor "^1.0.1" | ||
|
||
echarts@^5.5.1: | ||
version "5.5.1" | ||
resolved "https://registry.yarnpkg.com/echarts/-/echarts-5.5.1.tgz#8dc9c68d0c548934bedcb5f633db07ed1dd2101c" | ||
integrity sha512-Fce8upazaAXUVUVsjgV6mBnGuqgO+JNDlcgF79Dksy4+wgGpQB2lmYoO4TSweFg/mZITdpGHomw/cNBJZj1icA== | ||
dependencies: | ||
tslib "2.3.0" | ||
zrender "5.6.0" | ||
|
||
electron-to-chromium@^1.5.4: | ||
version "1.5.6" | ||
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.6.tgz" | ||
|
@@ -3001,6 +3017,11 @@ signal-exit@^4.0.1: | |
resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz" | ||
integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== | ||
|
||
size-sensor@^1.0.1: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/size-sensor/-/size-sensor-1.0.2.tgz#b8f8da029683cf2b4e22f12bf8b8f0a1145e8471" | ||
integrity sha512-2NCmWxY7A9pYKGXNBfteo4hy14gWu47rg5692peVMst6lQLPKrVjhY+UTEsPI5ceFRJSl3gVgMYaUi/hKuaiKw== | ||
|
||
slash@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" | ||
|
@@ -3289,6 +3310,11 @@ tsconfig-paths@^3.15.0: | |
minimist "^1.2.6" | ||
strip-bom "^3.0.0" | ||
|
||
[email protected]: | ||
version "2.3.0" | ||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.0.tgz#803b8cdab3e12ba581a4ca41c8839bbb0dacb09e" | ||
integrity sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg== | ||
|
||
tslib@^1.8.1: | ||
version "1.14.1" | ||
resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" | ||
|
@@ -3556,6 +3582,13 @@ yocto-queue@^0.1.0: | |
resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" | ||
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== | ||
|
||
[email protected]: | ||
version "5.6.0" | ||
resolved "https://registry.yarnpkg.com/zrender/-/zrender-5.6.0.tgz#01325b0bb38332dd5e87a8dbee7336cafc0f4a5b" | ||
integrity sha512-uzgraf4njmmHAbEUxMJ8Oxg+P3fT04O+9p7gY+wJRVxo8Ge+KmYv0WJev945EH4wFuc4OY2NLXz46FZrWS9xJg== | ||
dependencies: | ||
tslib "2.3.0" | ||
|
||
zustand@^4.5.5: | ||
version "4.5.5" | ||
resolved "https://registry.npmjs.org/zustand/-/zustand-4.5.5.tgz" | ||
|