-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#40 - DashboardView Chart 구현 #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or 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
What? - Chart에 사용되는 Font, StringLiterals 추가 - CellHourlyChart View 구현
What? - CellHourlyChart 부분 모서리에 shadow 속성 추가 - DashboardView 레이아웃 재정비
What? - CellChartData : 차트 전체를 그리기 위함 (기지국 주소, 요일, 한문장 정리, 시간대별 방문순) - HourlyVisit : 차트 항목을 그리기 위함 (시간대별, 요일별, 시간별 - 카운트) - WeekDay : 주말을 Int, Int를 주말처리
What? - CellHourlyChart SubView 구현: 차트 내부 UI 및 기능 구현 - DashboardFeature 계산용 함수 구현, Data 연결 완료 - DashboardView : Chart Section 항목 추가
Why? - DashboardView는 헤더, 섹션, 섹션 안에 카드, 카드 안에 컴포넌트로 이루어지는 복잡한 화면으로 / 한 뷰 안에 코드를 다 넣게 되면 읽기가 매우 어려워집니다. How? - Section : Dashboard를 크게 세 구역으로 나눕니다. - DashboardHeader : 가장 상단 스크롤 없이 고정되는 영역으로 Foundation Model의 요약 결과를 표출하는 타이틀 헤더입니다. - DashboardRankSection : 1위부터 3위까지 순위를 카드 리스트로 보여주는 섹션입니다. - DashboardChartSection : 기지국의 시간대별 빈도를 보여주기 위한 차트 섹션입니다. - SubViews : 이 외 다른 세부 하위 뷰들은 일반 SubViews안에 구분합니다. - `DWLocationCard` : 이 화면은 DashboardView와 OnePageView에서도 함께 사용할 수 있으므로 공통의 Core-Components 부분에 분리합니다.
MuchanKim
approved these changes
Nov 9, 2025
Collaborator
MuchanKim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
짱짱
SUSA24-iOS/SUSA24-iOS/Sources/Presentation/DashboardScene/DashboardFeature.swift
Show resolved
Hide resolved
SUSA24-iOS/SUSA24-iOS/Sources/Presentation/DashboardScene/DashboardFeature.swift
Show resolved
Hide resolved
YooGyeongMo
approved these changes
Nov 10, 2025
Collaborator
YooGyeongMo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p1 p2잇씁니다 ! 일단 어프루브할게용 치명적인건 아닌거같아서요 !
아래 무의 reduce는 동의합니다 저도 누적합 같은거 구할때 reduce를 해당 프젝에 사용하였었습니다.
SUSA24-iOS/SUSA24-iOS/Sources/Presentation/DashboardScene/DashboardView.swift
Outdated
Show resolved
Hide resolved
SUSA24-iOS/SUSA24-iOS/Sources/Presentation/DashboardScene/SubViews/CellChartCard.swift
Outdated
Show resolved
Hide resolved
SUSA24-iOS/SUSA24-iOS/Sources/Presentation/DashboardScene/DashboardFeature.swift
Show resolved
Hide resolved
SUSA24-iOS/SUSA24-iOS/Sources/Presentation/DashboardScene/DashboardFeature.swift
Outdated
Show resolved
Hide resolved
delightPIP
reviewed
Nov 10, 2025
What? - DashboardView hasLoaded를 통한 불필요한 fetch 방지 - makeHourlySummary 메소드 extension으로 안에 포함 - Preview 주석 처리
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Summary
DashboardView에 있는 차트 부분 기능을 구현했습니다.
🔨 What
1. Chart에 들어가는 UI 파일들을 작은 SubViews/Sections 단위로 분리했습니다.
주요 파일 부분만 설명하겠습니다. (어쩌다 보니 거의 다 설명한거군요...)
Model
StayAddress: 상단 TOP3 체류 주소를 표현하기 위한 데이터 모델.CellChartData: 차트 1개 카드에 필요한 모든 데이터 구조. (series, summary, selectedWeekday 등 포함)HourlyVisit: 1시간 단위의 방문 데이터 모델. 차트의 "기본 단위" 데이터로 사용됨.SubViews/Sections
DashboardHeader: 대시보드 상단 헤더 영역 (타이틀, 요약 설명 등)DashboardRankSection: 상단 TOP3 체류 주소 리스트 섹션DashboardChartSection: Top 3 시간대별 기지국 체류 차트를 표시하는 메인 섹션Components
CellChartCard: 차트 + 요약 문구 + 요일 선택기가 포함된 하나의 카드 단위 컴포넌트CellChartGraph: 실제 차트를 그리는 View (Swift Charts 기반)CellChartLegend: “1주차 / 2주차” 등의 색상 범례 표시 ViewWeekdayPillPicker: 요일 선택 컨트롤 (Pill 스타일의 Segment Picker)2. SwiftChart 구현해냈습니다.
차트를 그리기 위해 Charts (Swift Chart) 프레임워크를 사용했습니다.
주요 기능들만 간략하게 소개해보죠.
시간대별 방문 빈도 시각화 : LineMark 와 ForEach 중첩 루프 조합
LineMark: 각 HourlyVisit 데이터를 시간(hour) 축으로 매핑하고, 방문 횟수(count)를 y축에 표현합니다.
interpolationMethod(.catmullRom)을 사용해 곡선이 부드럽게 이어지도록 했습니다.
ForEach(availableWeeks)동일한 요일 내 여러 주차의 데이터(1~4주차)를 중첩 루프로 그려서,
주차별 패턴 비교가 가능하도록 구성했습니다.
기존 Legend 삭제, 커스텀 Legend 사용 (피그마 디자인에 맞추기 위함)
foregroundStyle(by:)와symbol(by:): 주차별로 선 색상과 심볼을 자동 구분하도록 설정했습니다.
weekStyleScale을 이용해 각 주차(1~4주차)에 고유 색상을 매핑했습니다. (3주차, 4주차는 임의의 센스있는 값으로 ^.^)
Tick 표시 최적화
0~24시 중 주요 구간(3시간 단위)만 표시하도록
stride(from:through:by:)로 x축 Tick 값을 제한했습니다.3. DashboardFeature 복잡합니다.
차트를 그리기 위한 각종 계산 메서드들이 아래 Extension 부분에 정의되어 있습니다.
차트 데이터 가공 (
buildCellChartData)요일 변경 처리 (
setChartWeekday)요약 문구 생성 (makeHourlySummary)
<내부 구조>
topAddressStays: 상위 체류 주소를 계산 (TOP3)hourlySeriesForAllWeekdays: 주소별 주차×요일×시간대별 방문 횟수를 계산makeHourlySummary: 주차별 체류 요약 문장 생성👀 Review Notes