本文整理汇总了Java中lecho.lib.hellocharts.model.SliceValue.setLabel方法的典型用法代码示例。如果您正苦于以下问题:Java SliceValue.setLabel方法的具体用法?Java SliceValue.setLabel怎么用?Java SliceValue.setLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.SliceValue
的用法示例。
在下文中一共展示了SliceValue.setLabel方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateData
import lecho.lib.hellocharts.model.SliceValue; //导入方法依赖的package包/类
private void generateData() {
List<SliceValue> values = new ArrayList<SliceValue>();
String s1 = String.format("%.2f", ((double) yes / all) * 100);
SliceValue sliceValue1 = new SliceValue(yes, ChartUtils.pickColor());
sliceValue1.setLabel("已报到" + s1 + "%");
values.add(sliceValue1);
String s2 = String.format("%.2f", ((double) no / all) * 100);
SliceValue sliceValue2 = new SliceValue(no, ChartUtils.pickColor());
sliceValue2.setLabel("未报到" + s2 + "%");
values.add(sliceValue2);
data = new PieChartData(values);
data.setHasLabels(true);
data.setHasLabelsOnlyForSelected(false);
data.setHasLabelsOutside(false);
chart.setValueSelectionEnabled(true);
chart.setCircleFillRatio(1.0f);
chart.setPieChartData(data);
}
示例2: generateData
import lecho.lib.hellocharts.model.SliceValue; //导入方法依赖的package包/类
private void generateData() {
List<SliceValue> values = new ArrayList<SliceValue>();
String s1 = String.format("%.2f", ((double) yes / all) * 100);
SliceValue sliceValue1 = new SliceValue(yes, ChartUtils.pickColor());
sliceValue1.setLabel("已报到" + s1 + "%");
values.add(sliceValue1);
String s2 = String.format("%.2f", ((double) no / all) * 100);
SliceValue sliceValue2 = new SliceValue(no, ChartUtils.pickColor());
sliceValue2.setLabel("未报到" + s2 + "%");
values.add(sliceValue2);
data = new PieChartData(values);
data.setHasLabels(true);
data.setHasLabelsOnlyForSelected(false);
data.setHasLabelsOutside(false);
chart.setValueSelectionEnabled(true);
chart.setCircleFillRatio(1.0f);
chart.setPieChartData(data);
}
示例3: generateData
import lecho.lib.hellocharts.model.SliceValue; //导入方法依赖的package包/类
private void generateData() {
List<SliceValue> values = new ArrayList<SliceValue>();
String s1 = String.format("%.2f", ((double) yes / all) * 100);
SliceValue sliceValue1 = new SliceValue(yes, ChartUtils.pickColor());
sliceValue1.setLabel("已报到"+s1+"%");
values.add(sliceValue1);
String s2 = String.format("%.2f", ((double) no / all) * 100);
SliceValue sliceValue2 = new SliceValue(no, ChartUtils.pickColor());
sliceValue2.setLabel("未报到"+s2+"%");
values.add(sliceValue2);
data = new PieChartData(values);
data.setHasLabels(true);
data.setHasLabelsOnlyForSelected(false);
data.setHasLabelsOutside(false);
chart.setValueSelectionEnabled(true);
chart.setCircleFillRatio(1.0f);
chart.setPieChartData(data);
}
示例4: generateData
import lecho.lib.hellocharts.model.SliceValue; //导入方法依赖的package包/类
private void generateData() {
List<SliceValue> values = new ArrayList<SliceValue>();
if (yes != 0) {
SliceValue sliceValue1 = new SliceValue(yes, ChartUtils.pickColor());
sliceValue1.setLabel(this.pay + yes + "人");
values.add(sliceValue1);
}
if (no != 0) {
SliceValue sliceValue2 = new SliceValue(no, ChartUtils.pickColor());
sliceValue2.setLabel(this.notPay+ no + "人");
values.add(sliceValue2);
}
if (loanPay != 0) {
SliceValue sliceValue3 = new SliceValue(loanPay, ChartUtils.pickColor());
sliceValue3.setLabel(this.loanPay1 + loanPay + "人");
values.add(sliceValue3);
}
if (latePay != 0) {
SliceValue sliceValue4 = new SliceValue(latePay, ChartUtils.pickColor());
sliceValue4.setLabel(this.latePay1 + latePay + "人");
values.add(sliceValue4);
}
data = new PieChartData(values);
data.setHasLabels(true);
data.setHasLabelsOnlyForSelected(false);
data.setHasLabelsOutside(false);
chart.setValueSelectionEnabled(true);
chart.setCircleFillRatio(1.0f);
chart.setPieChartData(data);
}
示例5: addSerieToPieChart
import lecho.lib.hellocharts.model.SliceValue; //导入方法依赖的package包/类
private static void addSerieToPieChart(Context context, List<SliceValue> slices, List<String> captions, List<Integer> colors, String category,
double percent, double ects, Grade grade, int color) {
if (percent > 0) {
colors.add(color);
captions.add(category);
SliceValue slice = new EctsSliceValue((float) percent, (float) ects, grade, color);
slice.setLabel(AppUtils.format(context, "%.2f %%", percent));
slices.add(slice);
}
}
示例6: createPieChartSlice
import lecho.lib.hellocharts.model.SliceValue; //导入方法依赖的package包/类
private static PieChartSlice createPieChartSlice(Context context, long duration, long memberId, String memberName) {
SliceValue sliceValue = new SliceValue();
sliceValue.setValue(duration);
String durationString = DateUtils.formatElapsedTime(duration);
sliceValue.setLabel(durationString);
sliceValue.setColor(ChartUtils.getMemberColor(context, memberId));
return new PieChartSlice(sliceValue, memberName);
}
示例7: refreshData
import lecho.lib.hellocharts.model.SliceValue; //导入方法依赖的package包/类
public void refreshData() {
if(dao == null)
dao = new ExpenseManagerDAO(getActivity());
//Refresh list from DB
try {
creditCard = dao.getCreditCardWithCreditPeriod(activeCreditCardId, 0);
creditPeriod = creditCard.getCreditPeriods().get(0);
}catch(CreditCardNotFoundException | CreditPeriodNotFoundException e) {
Toast.makeText(getActivity(), getResources().getString(R.string.err_problem_loading_card_or_no_card_exists), Toast.LENGTH_SHORT).show();
}
//Check if there are no expenses in this period or there is no active credit card
if(creditCard == null || creditPeriod.getExpensesTotal().equals(BigDecimal.ZERO)) {
chart.setVisibility(View.GONE);
mNoExpensesContainer.setVisibility(View.VISIBLE);
return;
}
int numCategories = ExpenseCategory.values().length;
List<BigDecimal> expenseByCategory = creditPeriod.getExpensesByCategory();
List<SliceValue> sliceValues = new ArrayList<>();
for (int i = 0; i < numCategories; ++i) {
//SliceValue sliceValue = new SliceValue(expenseByCategory[i].floatValue(), ContextCompat.getColor(getContext(), ExpenseCategory.values()[i].getColor() ));
SliceValue sliceValue = new SliceValue(20, ContextCompat.getColor(getContext(), ExpenseCategory.values()[i].getColor() ));
sliceValue.setTarget(expenseByCategory.get(i).floatValue());
sliceValue.setLabel(getExpenseLabel(expenseByCategory.get(i), ExpenseCategory.values()[i].getFriendlyName()));
sliceValues.add(sliceValue);
}
//Setup chart
data = new PieChartData(sliceValues);
data.setHasLabels(true);
//data.setHasLabelsOutside(true);
chart.setPieChartData(data);
chart.startDataAnimation(10000);
}
示例8: initData
import lecho.lib.hellocharts.model.SliceValue; //导入方法依赖的package包/类
private void initData() {
List<Subject> subjects = student.getActualSubjects();
//TODO: use enum values instead of static variables
float approvedCount = 0f;
float repprovedCount = 0f;
float waitingCount = 0f;
float totalCount;
for (Subject subject : subjects) {
SubjectStatus actualSubjectStatus = subject.getActualSubjectStatus();
if (actualSubjectStatus == null) continue;
switch (actualSubjectStatus.getFlowSituation()) {
case APPROVED:
approvedCount++;
break;
case REPROVED:
repprovedCount++;
break;
case WAITING:
case WAITING_FINAL:
waitingCount++;
break;
}
}
totalCount = approvedCount + repprovedCount + waitingCount;
PieChartView pieChartView = (PieChartView) findViewById(R.id.graph);
pieChartView.setValueSelectionEnabled(true);
List<SliceValue> sliceValues = new ArrayList<>();
float approvedPercentage = (approvedCount / totalCount) * 100f;
int approvedColor = getResources().getColor(android.R.color.holo_green_light);
SliceValue approvedSliceValue = new SliceValue();
approvedSliceValue.setColor(approvedColor);
approvedSliceValue.setValue(approvedPercentage);
approvedSliceValue.setLabel(getLabelForValue(approvedPercentage));
sliceValues.add(approvedSliceValue);
float repprovedPercentage = (repprovedCount / totalCount) * 100f;
int repprovedColor = getResources().getColor(android.R.color.holo_red_light);
SliceValue repprovedSliceValue = new SliceValue();
repprovedSliceValue.setColor(repprovedColor);
repprovedSliceValue.setValue(repprovedPercentage);
repprovedSliceValue.setLabel(getLabelForValue(repprovedPercentage));
sliceValues.add(repprovedSliceValue);
float waitingPercentage = (waitingCount / totalCount) * 100f;
int waitingColor = getResources().getColor(R.color.unicap_gray_level_2);
SliceValue waitingSliceValue = new SliceValue();
waitingSliceValue.setColor(waitingColor);
waitingSliceValue.setValue(waitingPercentage);
waitingSliceValue.setLabel(getLabelForValue(waitingPercentage));
sliceValues.add(waitingSliceValue);
PieChartData data = new PieChartData(sliceValues);
data.setHasLabelsOnlyForSelected(true);
data.setHasCenterCircle(true);
data.setCenterCircleScale(0.3f);
pieChartView.setPieChartData(data);
}