• Stars
    star
    202
  • Rank 193,691 (Top 4 %)
  • Language
    Java
  • Created over 8 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

饼状图图形报表控件

PieChartView

####饼状图图形报表控件,可自行设定多种参数

alt text

##使用方法,将PieChartView类和attr_pie_chart_view.xml文件直接拷贝到工程下,然后直接在xml布局中使用既可

      <com.dahanis.piechart.PieChartView
              android:id="@+id/pie_chart"
              android:layout_width="match_parent"
              android:layout_height="400dp"
              android:background="#ccc"
              android:paddingBottom="40dp"
              android:paddingLeft="20dp"
              app:circleRadius="100dp"
              app:textSize="13sp" />
  • circleRadius:饼状图的半径
  • textSize:指示文字的大小

##java类中的使用

        PieChartView pieChartView = (PieChartView) findViewById(R.id.pie_chart);

        List<PieChartView.PieceDataHolder> pieceDataHolders = new ArrayList<>();

        pieceDataHolders.add(new PieChartView.PieceDataHolder(100,0xFF77CCAA, "今天,1"));
        pieceDataHolders.add(new PieChartView.PieceDataHolder(1000, 0xFF11AA33, "明天,2"));
        pieceDataHolders.add(new PieChartView.PieceDataHolder(1200, Color.GRAY, "就是风,3"));
        pieceDataHolders.add(new PieChartView.PieceDataHolder(5000, Color.YELLOW, "呵呵,4"));
        pieceDataHolders.add(new PieChartView.PieceDataHolder(10000, Color.RED, "小京,5"));
        pieceDataHolders.add(new PieChartView.PieceDataHolder(13000, Color.BLUE, "花花,6"));

        pieChartView.setData(pieceDataHolders);