本文整理汇总了Java中com.github.mikephil.charting.data.PieDataSet.setValueLinePart1OffsetPercentage方法的典型用法代码示例。如果您正苦于以下问题:Java PieDataSet.setValueLinePart1OffsetPercentage方法的具体用法?Java PieDataSet.setValueLinePart1OffsetPercentage怎么用?Java PieDataSet.setValueLinePart1OffsetPercentage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.PieDataSet
的用法示例。
在下文中一共展示了PieDataSet.setValueLinePart1OffsetPercentage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populatePieData
import com.github.mikephil.charting.data.PieDataSet; //导入方法依赖的package包/类
/**
* Set the pie chart data source
*/
public static PieData populatePieData(List<PieEntry> entries, String label){
PieDataSet dataSet = new PieDataSet(entries, label);
dataSet.setSliceSpace(3f);
dataSet.setSelectionShift(5f);
//dataSet.setColors(populateColors());// add a lot of colors
dataSet.setColors(ColorTemplate.MATERIAL_COLORS);
dataSet.setValueLinePart1OffsetPercentage(80.f);
dataSet.setValueLinePart1Length(0.2f);
dataSet.setValueLinePart2Length(0.4f);
// dataSet.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
dataSet.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
dataSet.setValueTextSize(11f);
return new PieData(dataSet);
}
示例2: setData
import com.github.mikephil.charting.data.PieDataSet; //导入方法依赖的package包/类
private void setData(long tips, long transactionsToRequest) {
ArrayList<PieEntry> entries = new ArrayList<>();
entries.add(new PieEntry(tips, getString(R.string.tips) + " " + "(" + tips + ")"));
entries.add(new PieEntry(transactionsToRequest, getString(R.string.transactions_to_request) + " " + "(" + transactionsToRequest + ")"));
PieDataSet dataSet = new PieDataSet(entries, getString(R.string.transactions) + "\n(" + (tips + transactionsToRequest) + ")");
dataSet.setSliceSpace(3f);
dataSet.setSelectionShift(5f);
// add a lot of colors
ArrayList<Integer> colors = new ArrayList<>();
for (int c : ColorTemplate.LIBERTY_COLORS)
colors.add(c);
dataSet.setColors(colors);
dataSet.setValueLinePart1OffsetPercentage(80.f);
dataSet.setValueLinePart1Length(0.2f);
dataSet.setValueLinePart2Length(0.4f);
dataSet.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
dataSet.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
dataSet.setValueTextColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary));
PieData data = new PieData(dataSet);
data.setValueFormatter(new PercentFormatter());
data.setValueTextSize(12f);
data.setValueTextColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary));
chart.setData(data);
// undo all highlights
chart.highlightValues(null);
chart.invalidate();
}