一. 配置
(1)model下build.gradle
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
(2)project下build.gradle
allprojects { repositories { jcenter() maven { url 'https://jitpack.io' } } }
二. 使用
(1)main_layout布局
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <com.github.mikephil.charting.charts.LineChart android:id="@+id/lineChart" android:layout_width="match_parent" android:layout_height="300dp" android:layout_centerInParent="true" /> </RelativeLayout>
(