본문 바로가기

전체 글

(65)
[안드로이드][프로젝트1] 내가 MPAndroid X axis 값을 날짜와 시간으로 변환한 방법(firebase 연동) 1. DataPoint 클래스의 xValue를 long값으로 바꿔준다. public class DataPoint { long xValue; int yValue; public DataPoint(long xValue, int yValue) { this.xValue = xValue; this.yValue = yValue; } public DataPoint(){ } public long getxValue() { return xValue; } public int getyValue() { return yValue; } } 참고:https://youtu.be/WcwhZztfY2g 2. SimpleDateFormat 지정해주자. SimpleDateFormat sdf = new SimpleDateFormat("MM-dd..
[프로젝트1][안드로이드] 내가 Firebase와 연동한 상태로 MPAndroidchart 를 이용하여 Line Chart를 만든 법 0. gradle 환경 설정은 필수. 1.RegisterActivity와 MainActivity(로그인 액티비티)에 다음 문구를 추가한다. hashMap.put("ChartValues",""); // will add later 2. fragment_calendar.xml 레이아웃을 다음과 같이 짜준다. 3. DataPoint 클래스를 만들어준다. public class DataPoint { int xValue, yValue; public DataPoint(int xValue, int yValue) { this.xValue = xValue; this.yValue = yValue; } public DataPoint(){ } public int getxValue() { return xValue; } publi..
[안드로이드][프로젝트1] MPAndroidChart를 활용한 LineChart 사용 1. settings.gradle에 다음 코드를 추가하고 싱크를 맞춰준다. maven { url 'https://jitpack.io' } 2. build.gradle(모듈)에 다음 코드를 추가하고 싱크를 맞춰준다. implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' 3. layout의 xml 파일에 다음 코드를 추가한다. 4. activity에 다음 코드를 추가한다. import android.graphics.Color; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import com.github.mikephil.charting.charts.LineChart; im..