Skip to content

✨ Awesome Charts for Android OS. It's supported real time vital chart like ECG.

License

Notifications You must be signed in to change notification settings

masterchen/AndroidInfoChart

Repository files navigation

symbol

Generic badge Generic badge

InfoCharts-Android

InfoChartsInfoMining Co., Ltd의 앱에 사용될 자체 제작 차트 라이브러리 입니다.

iOS 버전의 라이브러리를 사용하고자 한다면, 여기를 눌러주십시오.

⚙️ Setting

Gradle

  1. Project 단위의 build.gradle에 다음과 같은 내용을 추가합니다.

    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }
  2. Dependency를 추가합니다.

    dependencies {
        implementation 'com.github.infodevelop:AndroidInfoChart:vX.Y.Z'
    }

Maven

  1. build filejitPack Repository 정보를 추가합니다.

    <repositories>
    	<repository>
    	    <id>jitpack.io</id>
    	    <url>https://jitpack.io</url>
    	</repository>
    </repositories>
    
  2. Dependency를 추가합니다.

    <dependency>
        <groupId>com.github.infodevelop</groupId>
        <artifactId>AndroidInfoChart</artifactId>
        <version>Tag</version>
    </dependency>
    

📈 Charts

1. RealTimeVitalChart

RealTimeVitalChart Video

ECG 등의 실시간 생체 신호를 표시해주는 차트입니다. 실제 의료기기에서 표시되는 동일한 애니메이션이 지원됩니다.

How To Use?

  1. XML에 차트를 그리세요.

    <com.infomining.infochartlib.chart.RealTimeVitalChart
            android:id="@+id/chart_vital"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
  2. 코드에서 차트 View를 바인딩한 후, 실시간 출력에 대한 스펙을 설정합니다.

    Java

    RealTimeVitalChart chart;
    
    chart = findViewById(R.id.chart_vital);
    chart.setRealTimeSpec(new Spec(500, 5, 0.2f, 1.0f, -0.2f));

    Kotlin

    lateinit var chart: RealTimeVitalChart
    
    chart = findViewById(R.id.chart_vital)
    chart.setRealTimeSpec(Spec(500, 5, 0.2f, 1.0f, -0.2f))

    ※ Spec Class

    Spec(int mOneSecondDataCount, int mVisibleSecondRange, float mRefreshGraphInterval, 
    			float mVitalMaxValue, float mVitalMinValue)
    
    /*
    	1. mOneSecondDataCount   : 1초 동안 들어오는 데이터 갯수
    	2. mVisibleSecondRage    : 보여질 시간 (초 단위)
    	3. mRefreshGraphInterval : 새로고침 되는 그래프와 이전 그래프와의 간격
    	4. mVitalMaxValue        : 바이탈 최대 값
    	5. mVitalMinValue        : 바이탈 최소 값
    */
  3. 차트에 표시하고자 하는 실시간 데이터DataHandler에 넣어줍니다. 데이터를 넣으면, 차트 애니메이션이 시작되면서 실시간 차트가 표시됩니다.

    Java

    chart.getDataHandler().enqueue(2f);

    Kotlin

    chart.dataHandler.enqueue(2f)
  4. 차트가 그려진 Activity 혹은 Fragment의 생명주기가 끝나거나, 더 이상 차트를 표시할 일이 없다차트의 자원을 해제해줍니다.

    Java

    @Override
    public void onDestroy() {
    	super.onDestory();
    	chart.getDataHandler().destroy();
    }

    Kotlin

    override fun onDestory() {
    	super.onDestory()
    	chart.dataHandler.destroy()
    }

Details

1) 차트 설정 관련

  • setRealTimeSpec(Spec) : 실시간 차트의 스펙을 설정합니다. 1초 당 출력 데이터 갯수, 보여질 시간, 최대 최소 값 등의 정보를 담고 있습니다.
  • reset() : 차트를 리셋합니다. 그려진 데이터와 아직 출력되지 않은 데이터를 초기화 하고 애니메이션을 중단합니다.
  • setLineColor(int) : 그래프의 색을 변경합니다.
  • setLineWidth(float) : 그래프의 두께를 변경합니다.
  • setEnabledValueCircleIndicator(boolean) : 가장 마지막으로 그려진 값을 표시하는 인디케이터 활성 여부를 설정합니다.
  • setValueCircleIndicatorRadius(float) : 가장 마지막으로 그려진 값을 표시하는 인디케이터의 크기를 설정합니다.
  • setValueCircleIndicatorColor(int) : 가장 마지막으로 그려진 값을 표시하는 인디케이터의 색상을 설정합니다.
  • setChartBackground(int), setChartBackground(Drawable) : 차트의 백그라운드를 설정합니다.
  • destory() : 차트에 할당된 자원을 해제합니다. (* 이를 하지 않을 경우 스케쥴러 및 렌더링 스레드로 인하여 앱 성능 저하의 원인이 될 수 있습니다.)

2) 데이터 관련

  • getDataHandler() : 실시간 데이터를 관리하는 핸들러 객체를 가져옵니다. DataHandler는 균일하지 못하거나 무작위로 들어오는 데이터로 인한 위상 지연 현상 등을 해결하기 위해 데이터를 관리하는 객체입니다.
  • getDataHandler().enqueue(float) : 핸들러에 출력할 데이터를 추가합니다. 차트가 정지되어 있다면 데이터를 출력하는 동작도 함께 실행합니다.
  • getDataHandler().run() : 실시간 데이터를 차트에 출력합니다. 핸들러에 출력할 데이터가 남아있다면 해당 데이터들을 순차적으로 차트에 출력하고, 없다면 기본값이 출력됩니다.
  • getDataHandler().stop() : 차트에 실시간 데이터 출력을 정지합니다.
  • getDataHandler().reset() : 핸들러에 있는 데이터를 초기화 합니다. 실시간 데이터 출력에 영향을 미치지 않습니다.

📄 Documentaion

  • SDK에 대한 상세한 정보는 JavaDoc을 통해 확인하실 수 있습니다.

📃 License

Copyright 2021 InfoMining Co., Ltd

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

✨ Awesome Charts for Android OS. It's supported real time vital chart like ECG.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published