热久久国产,天天摸夜夜添狠狠添高潮出水,亚洲精品国偷自产在线99正片,女人高潮叫床污话

mpandroidchartlibrary-2-1-6.jar PC版

  • 軟件版本:PC版
  • 軟件授權(quán):免費(fèi)軟件
  • 軟件類型:國產(chǎn)軟件
  • 軟件語言:簡體中文
  • 應(yīng)用平臺(tái):Win All
  • 更新時(shí)間:2021-11-25
  • 軟件大小:0.45MB
  • 軟件評(píng)分:
立即下載 0.45MB
軟件介紹
mpandroidchartlibrary-2-1-6.jar包是一個(gè)Android開源圖表庫MPAndroidChart的jar包,下載了mpandroidchartlibrary包即可使用后線圖和餅圖,支持選擇、縮放和拖放。

文件預(yù)覽

使用實(shí)例

  下面主要實(shí)現(xiàn)以下餅狀圖:

  1.下載最新mpandroidchartlibrary.jar包, 然后copy到項(xiàng)目的libs中

  2.定義xml文件

  3.主要Java邏輯代碼如下,注釋已經(jīng)都添加上了。

  package com.jackie.mpandroidpiechart;

  import java.util.ArrayList;

  import com.github.mikephil.charting.charts.PieChart;

  import com.github.mikephil.charting.components.Legend;

  import com.github.mikephil.charting.components.Legend.LegendPosition;

  import com.github.mikephil.charting.data.Entry;

  import com.github.mikephil.charting.data.PieData;

  import com.github.mikephil.charting.data.PieDataSet;

  import android.support.v7.app.ActionBarActivity;

  import android.graphics.Color;

  import android.os.Bundle;

  import android.util.DisplayMetrics;

  public class MainActivity extends ActionBarActivity {

  private PieChart mChart;

  @Override

  protected void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);

  mChart = (PieChart) findViewById(R.id.spread_pie_chart);

  PieData mPieData = getPieData(4, 100);

  showChart(mChart, mPieData);

  }

  private void showChart(PieChart pieChart, PieData pieData) {

  pieChart.setHoleColorTransparent(true);

  pieChart.setHoleRadius(60f); //半徑

  pieChart.setTransparentCircleRadius(64f); // 半透明圈

  //pieChart.setHoleRadius(0) //實(shí)心圓

  pieChart.setDescription("測試餅狀圖");

  // mChart.setDrawYValues(true);

  pieChart.setDrawCenterText(true); //餅狀圖中間可以添加文字

  pieChart.setDrawHoleEnabled(true);

  pieChart.setRotationAngle(90); // 初始旋轉(zhuǎn)角度

  // draws the corresponding description value into the slice

  // mChart.setDrawXValues(true);

  // enable rotation of the chart by touch

  pieChart.setRotationEnabled(true); // 可以手動(dòng)旋轉(zhuǎn)

  // display percentage values

  pieChart.setUsePercentValues(true); //顯示成百分比

  // mChart.setUnit(" €");

  // mChart.setDrawUnitsInChart(true);

  // add a selection listener

  // mChart.setOnChartValueSelectedListener(this);

  // mChart.setTouchEnabled(false);

  // mChart.setOnAnimationListener(this);

  pieChart.setCenterText("Quarterly Revenue"); //餅狀圖中間的文字

  //設(shè)置數(shù)據(jù)

  pieChart.setData(pieData);

  // undo all highlights

  // pieChart.highlightValues(null);

  // pieChart.invalidate();

  Legend mLegend = pieChart.getLegend(); //設(shè)置比例圖

  mLegend.setPosition(LegendPosition.RIGHT_OF_CHART); //最右邊顯示

  // mLegend.setForm(LegendForm.LINE); //設(shè)置比例圖的形狀,默認(rèn)是方形

  mLegend.setXEntrySpace(7f);

  mLegend.setYEntrySpace(5f);

  pieChart.animateXY(1000, 1000); //設(shè)置動(dòng)畫

  // mChart.spin(2000, 0, 360);

  }

  /**

  *

  * @param count 分成幾部分

  * @param range

  */

  private PieData getPieData(int count, float range) {

  ArrayList<String> xValues = new ArrayList<String>(); //xVals用來表示每個(gè)餅塊上的內(nèi)容

  for (int i = 0; i < count; i++) {

  xValues.add("Quarterly" + (i + 1)); //餅塊上顯示成Quarterly1, Quarterly2, Quarterly3, Quarterly4

  }

  ArrayList<Entry> yValues = new ArrayList<Entry>(); //yVals用來表示封裝每個(gè)餅塊的實(shí)際數(shù)據(jù)

  // 餅圖數(shù)據(jù)

  /**

  * 將一個(gè)餅形圖分成四部分, 四部分的數(shù)值比例為14:14:34:38

  * 所以 14代表的百分比就是14%

  */

  float quarterly1 = 14;

  float quarterly2 = 14;

  float quarterly3 = 34;

  float quarterly4 = 38;

  yValues.add(new Entry(quarterly1, 0));

  yValues.add(new Entry(quarterly2, 1));

  yValues.add(new Entry(quarterly3, 2));

  yValues.add(new Entry(quarterly4, 3));

  //y軸的集合

  PieDataSet pieDataSet = new PieDataSet(yValues, "Quarterly Revenue 2014"/*顯示在比例圖上*/);

  pieDataSet.setSliceSpace(0f); //設(shè)置個(gè)餅狀圖之間的距離

  ArrayList<Integer> colors = new ArrayList<Integer>();

  // 餅圖顏色

  colors.add(Color.rgb(205, 205, 205));

  colors.add(Color.rgb(114, 188, 223));

  colors.add(Color.rgb(255, 123, 124));

  colors.add(Color.rgb(57, 135, 200));

  pieDataSet.setColors(colors);

  DisplayMetrics metrics = getResources().getDisplayMetrics();

  float px = 5 * (metrics.densityDpi / 160f);

  pieDataSet.setSelectionShift(px); // 選中態(tài)多出的長度

  PieData pieData = new PieData(xValues, pieDataSet);

  return pieData;

  }

  }

  效果圖如下:

  主要是一些基本屬性和API的調(diào)用,具體每個(gè)API都有什么樣的效果和作用,只能靠自己去嘗試。后面還會(huì)陸陸續(xù)續(xù)為大家介紹MPAndroidChart其他類型的圖表。