用于生成圖表Android類庫:AndroidCharts
AndroidCharts是一款易于使用的Android圖表動畫類庫。包含曲線/折線圖、餅圖、時鐘圖、柱狀圖。
用法:
曲線圖:

<HorizontalScrollView> <view android:layout_width="wrap_content" android:layout_height="300dp" 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.setDataList(dataLists);
柱狀圖:

<HorizontalScrollView> <view android:layout_width="wrap_content" android:layout_height="300dp" android:id="@+id/bar_view" /> </HorizontalScrollView>
BarView barView = (BarView)findViewById(R.id.bar_view); barView.setBottomTextList(strList); barView.setDataList(dataList,100);
時鐘餅圖:

<view android:layout_width="300dp" android:layout_height="wrap_content" android:id="@+id/clock_pie_view" />
ClockPieView pieView = (ClockPieView)findViewById(R.id.clock_pie_view); ArrayList<ClockPieHelper> pieHelperArrayList = new ArrayList<ClockPieHelper>(); pieView.setDate(pieHelperArrayList);
餅圖:

<view android:layout_width="300dp" android:layout_height="wrap_content" 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
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!