AndroidCharts
A simple Android charts library.
Known Uses in
Including in Your Project
Eclipse
- Import
/AndroidCharts
folder. - Move
/java
folder to/src
folder. mkdir libs
, copyandroid-support-v4.jar
to/libs
.
Gradle
repositories {
jcenter()
}
compile 'im.dacer:AndroidCharts:1.0.4'
Usage
Line Chart
<HorizontalScrollView>
<view
android:layout_width="wrap_content"
android:layout_height="300dp"
class="im.dacer.androidcharts.LineView"
android:id="@+id/line_view" />
</HorizontalScrollView>
LineView lineView = (LineView)findViewById(R.id.line_view);
lineView.setDrawDotLine(false); //optional
lineView.setShowPopup(LineView.SHOW_POPUPS_MAXMIN_ONLY); //optional
LineView.setBottomTextList(strList);
lineView.setColorArray(new int[]{Color.BLACK,Color.GREEN,Color.GRAY,Color.CYAN});
lineView.setDataList(dataLists); //or lineView.setFloatDataList(floatDataLists)
Bar Chart
<HorizontalScrollView>
<view
android:layout_width="wrap_content"
android:layout_height="300dp"
class="im.dacer.androidcharts.BarView"
android:id="@+id/bar_view" />
</HorizontalScrollView>
BarView barView = (BarView)findViewById(R.id.bar_view);\
barView.setBottomTextList(strList);
barView.setDataList(dataList,100);
Clock Pie Chart
<view
android:layout_width="300dp"
android:layout_height="wrap_content"
class="im.dacer.androidcharts.ClockPieView"
android:id="@+id/clock_pie_view" />
ClockPieView pieView = (ClockPieView)findViewById(R.id.clock_pie_view);
ArrayList<ClockPieHelper> pieHelperArrayList = new ArrayList<ClockPieHelper>();
pieView.setDate(pieHelperArrayList);
Pie Chart
<view
android:layout_width="300dp"
android:layout_height="wrap_content"
class="im.dacer.androidcharts.PieView"
android:id="@+id/pie_view" />
PieView pieView = (PieView)findViewById(R.id.pie_view);
ArrayList<PieHelper> pieHelperArrayList = new ArrayList<PieHelper>();
pieView.setDate(pieHelperArrayList);
pieView.selectedPie(2); //optional
pieView.setOnPieClickListener(listener) //optional
pieView.showPercentLabel(false); //optional