Java Code Examples for lecho.lib.hellocharts.model.SliceValue#setColor()

The following examples show how to use lecho.lib.hellocharts.model.SliceValue#setColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NoteInfoModel.java    From Memory-capsule with Apache License 2.0 6 votes vote down vote up
@Override
public List<SliceValue> getPieChartNumberfromData() {//获取饼状图的数据
    List<SliceValue>mlist=new ArrayList<>();
    List<Integer> colors=new ArrayList<>();
    List<String> types=new ArrayList<>();
    types.add(0,"生活");
    types.add(1,"工作");
    types.add(2,"学习");
    types.add(3,"日记");
    types.add(4,"旅行");
    colors.add(0,R.color.colorlive);
    colors.add(1,R.color.colorwork);
    colors.add(2,R.color.colorstudy);
    colors.add(3,R.color.colordiary);
    colors.add(4,R.color.colortravel);
    for (int i=0;i<5;i++){
        SliceValue sliceValue=new SliceValue();
        sliceValue.setColor(colors.get(i));
        sliceValue.setLabel(types.get(i));
        sliceValue.setValue(QueryEveryTypeSumfromDataByType(types.get(i)));
    }
    return mlist;
}
 
Example 2
Source File: ReviewActivity.java    From aptoide-client with GNU General Public License v2.0 6 votes vote down vote up
private void setGraph(PieChartView graph, PieChartData data,int color){
    ArrayList<SliceValue> sliceValues = new ArrayList<>();
    SliceValue sliceValue2 = new SliceValue(1);
    SliceValue sliceValue = new SliceValue(0);

    sliceValues.add(sliceValue);
    sliceValues.add(sliceValue2);

    sliceValue.setColor(color);
    sliceValue2.setColor(getResources().getColor(R.color.dark_custom_gray));
    data.setHasCenterCircle(true);
    data.setCenterCircleColor(Color.BLACK);
    data.setValues(sliceValues);
    data.setCenterText1FontSize(12);
    data.setCenterText1Typeface(Typeface.DEFAULT_BOLD);
    data.setCenterText1Color(Color.WHITE);
    graph.setPieChartData(data);
    graph.setChartRotationEnabled(false);
}