当前位置: 首页>>代码示例>>Java>>正文


Java SliceValue.setTarget方法代码示例

本文整理汇总了Java中lecho.lib.hellocharts.model.SliceValue.setTarget方法的典型用法代码示例。如果您正苦于以下问题:Java SliceValue.setTarget方法的具体用法?Java SliceValue.setTarget怎么用?Java SliceValue.setTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lecho.lib.hellocharts.model.SliceValue的用法示例。


在下文中一共展示了SliceValue.setTarget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareDataAnimation

import lecho.lib.hellocharts.model.SliceValue; //导入方法依赖的package包/类
/**
 * To animate values you have to change targets values and then call {@link Chart#startDataAnimation()}
 * method(don't confuse with View.animate()).
 */
private void prepareDataAnimation() {
    for (SliceValue value : data.getValues()) {
        value.setTarget((float) Math.random() * 30 + 15);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:PieChartActivity.java

示例2: 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);

}
 
开发者ID:abicelis,项目名称:CreditCardExpenseManager,代码行数:43,代码来源:ChartCategoryFragment.java


注:本文中的lecho.lib.hellocharts.model.SliceValue.setTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。