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


Java PieChartView类代码示例

本文整理汇总了Java中lecho.lib.hellocharts.view.PieChartView的典型用法代码示例。如果您正苦于以下问题:Java PieChartView类的具体用法?Java PieChartView怎么用?Java PieChartView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: PieChartRotationAnimatorV8

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
public PieChartRotationAnimatorV8(PieChartView chart, long duration) {
    this.interpolator = new AccelerateDecelerateInterpolator();
    this.isAnimationStarted = false;
    this.startRotation = 0.0f;
    this.targetRotation = 0.0f;
    this.animationListener = new DummyChartAnimationListener();
    this.runnable = new Runnable() {
        public void run() {
            long elapsed = SystemClock.uptimeMillis() - PieChartRotationAnimatorV8.this.start;
            if (elapsed > PieChartRotationAnimatorV8.this.duration) {
                PieChartRotationAnimatorV8.this.isAnimationStarted = false;
                PieChartRotationAnimatorV8.this.handler.removeCallbacks(PieChartRotationAnimatorV8.this.runnable);
                PieChartRotationAnimatorV8.this.chart.setChartRotation((int) PieChartRotationAnimatorV8.this.targetRotation, false);
                PieChartRotationAnimatorV8.this.animationListener.onAnimationFinished();
                return;
            }
            PieChartRotationAnimatorV8.this.chart.setChartRotation((int) ((((PieChartRotationAnimatorV8.this.startRotation + ((PieChartRotationAnimatorV8.this.targetRotation - PieChartRotationAnimatorV8.this.startRotation) * Math.min(PieChartRotationAnimatorV8.this.interpolator.getInterpolation(((float) elapsed) / ((float) PieChartRotationAnimatorV8.this.duration)), 1.0f))) % 360.0f) + 360.0f) % 360.0f), false);
            PieChartRotationAnimatorV8.this.handler.postDelayed(this, 16);
        }
    };
    this.chart = chart;
    this.duration = duration;
    this.handler = new Handler();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:PieChartRotationAnimatorV8.java

示例2: initMealsPie

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
public static void initMealsPie(PieChartView pieChartView, TodayDiets todayDiets) {
    List<SliceValue> values = new ArrayList();
    if (todayDiets.breakfast != null && todayDiets.breakfast.percentage > 0.0f) {
        values.add(new SliceValue(todayDiets.breakfast.percentage, MEALS_COLORS[0]).setLabel(
                ((int) (todayDiets.breakfast.percentage * 100.0f)) + "%早餐"));
    }
    if (todayDiets.lunch != null && todayDiets.lunch.percentage > 0.0f) {
        values.add(new SliceValue(todayDiets.lunch.percentage, MEALS_COLORS[1]).setLabel((
                (int) (todayDiets.lunch.percentage * 100.0f)) + "%午餐"));
    }
    if (todayDiets.dinner != null && todayDiets.dinner.percentage > 0.0f) {
        values.add(new SliceValue(todayDiets.dinner.percentage, MEALS_COLORS[2]).setLabel((
                (int) (todayDiets.dinner.percentage * 100.0f)) + "%晚餐"));
    }
    PieChartData data = new PieChartData(values);
    data.setHasLabels(true);
    data.setHasLabelsOnlyForSelected(false);
    data.setHasLabelsOutside(false);
    data.setHasCenterCircle(false);
    data.setSlicesSpacing(3);
    data.setValueLabelBackgroundColor(0);
    data.setValueLabelBackgroundEnabled(true);
    pieChartView.setValueSelectionEnabled(true);
    pieChartView.setPieChartData(data);
    pieChartView.startDataAnimation();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:ChartAnalysisHelper.java

示例3: onCreateView

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);
    View rootView = inflater.inflate(R.layout.fragment_pie_chart, container, false);
    chart = (PieChartView) rootView.findViewById(R.id.chart);
    chart.setOnValueTouchListener(new PieChartOnValueSelectListener() {
        @Override
        public void onValueSelected(int arcIndex, SliceValue value) {
            Toast.makeText(getActivity(), String.valueOf(value.getLabelAsChars()), Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onValueDeselected() {

        }
    });

    toggleLabelForSelected();
    return rootView;
}
 
开发者ID:shenyanf,项目名称:AccountBook,代码行数:21,代码来源:PieChartActivity.java

示例4: onCreateView

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    View rootView = inflater.inflate(R.layout.fragment_chart_categories, container, false);
    chart = (PieChartView) rootView.findViewById(R.id.chart_categories_piechart);
    mNoExpensesContainer = (RelativeLayout) rootView.findViewById(R.id.chart_categories_no_expenses_container);


    try {
        activeCreditCardId = SharedPreferencesUtils.getInt(getContext(), Constants.ACTIVE_CC_ID);

    }catch(SharedPreferenceNotFoundException e) {
        //This shouldn't happen
    }

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

示例5: setGraph

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
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);
}
 
开发者ID:Aptoide,项目名称:aptoide-client,代码行数:20,代码来源:ReviewActivity.java

示例6: initPieChart

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
private void initPieChart(final PieChartView pieChart) {
    initBaseChart(pieChart);

    pieChart.setChartRotationEnabled(false);
    pieChart.setChartRotation(180, false);

    pieChart.setOnValueTouchListener(new PieChartOnValueSelectListener() {
        @Override
        public void onValueSelected(int arcIndex, SliceValue value) {
            SliceValue slice = pieChart.getPieChartData().getValues().get(arcIndex);
            if (slice instanceof EctsSliceValue) {
                pieChart.getPieChartData().setCenterText1(AppUtils.format(getContext(), "%.2f ECTS", ((EctsSliceValue) slice).getEcts()));
                Grade grade = ((EctsSliceValue) slice).getGrade();
                if (grade != null) {
                    pieChart.getPieChartData().setCenterText2(getContext().getString(grade.getStringResID()));
                }
            }
        }

        @Override
        public void onValueDeselected() {
            pieChart.getPieChartData().setCenterText1(null);
            pieChart.getPieChartData().setCenterText2(null);
        }
    });
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:27,代码来源:StatCardAdapter.java

示例7: PieChartRotationAnimatorV14

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
public PieChartRotationAnimatorV14(PieChartView chart, long duration) {
    this.chart = chart;
    animator = ValueAnimator.ofFloat(0.0f, 1.0f);
    animator.setDuration(duration);
    animator.addListener(this);
    animator.addUpdateListener(this);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:PieChartRotationAnimatorV14.java

示例8: PieChartTouchHandler

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
public PieChartTouchHandler(Context context, PieChartView chart) {
    super(context, chart);
    pieChart = (PieChartView) chart;
    scroller = ScrollerCompat.create(context);
    gestureDetector = new GestureDetector(context, new ChartGestureListener());
    scaleGestureDetector = new ScaleGestureDetector(context, new ChartScaleGestureListener());
    isZoomEnabled = false;// Zoom is not supported by PieChart.
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:PieChartTouchHandler.java

示例9: onCreateView

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);
    View rootView = inflater.inflate(R.layout.fragment_pie_chart, container, false);

    chart = (PieChartView) rootView.findViewById(R.id.chart);
    chart.setOnValueTouchListener(new ValueTouchListener());

    generateData();

    return rootView;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:PieChartActivity.java

示例10: PieChartRotationAnimatorV14

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
public PieChartRotationAnimatorV14(PieChartView chart, long duration) {
    this.startRotation = 0.0f;
    this.targetRotation = 0.0f;
    this.animationListener = new DummyChartAnimationListener();
    this.chart = chart;
    this.animator = ValueAnimator.ofFloat(new float[]{0.0f, 1.0f});
    this.animator.setDuration(duration);
    this.animator.addListener(this);
    this.animator.addUpdateListener(this);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:PieChartRotationAnimatorV14.java

示例11: PieChartTouchHandler

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
public PieChartTouchHandler(Context context, PieChartView chart) {
    super(context, chart);
    this.pieChart = chart;
    this.scroller = ScrollerCompat.create(context);
    this.gestureDetector = new GestureDetector(context, new ChartGestureListener());
    this.scaleGestureDetector = new ScaleGestureDetector(context, new ChartScaleGestureListener());
    this.isZoomEnabled = false;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:PieChartTouchHandler.java

示例12: initNutrientsPie

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
public static void initNutrientsPie(PieChartView pieChartView, TodayNutrients todayNutrients) {
    List<SliceValue> values = new ArrayList();
    if (todayNutrients.carbohydrate != null && todayNutrients.carbohydrate.percentage > 0.0f) {
        values.add(new SliceValue(todayNutrients.carbohydrate.percentage,
                NUTRIENTS_COLORS[0]).setLabel((todayNutrients.carbohydrate.percentage < 0.0f
                ? "0" : Integer.valueOf((int) (todayNutrients.carbohydrate.percentage * 100
        .0f))) + "% 碳水"));
    }
    if (todayNutrients.fat != null && todayNutrients.fat.percentage > 0.0f) {
        values.add(new SliceValue(todayNutrients.fat.percentage, NUTRIENTS_COLORS[1])
                .setLabel((todayNutrients.fat.percentage < 0.0f ? "0" : Integer.valueOf((int)
                        (todayNutrients.fat.percentage * 100.0f))) + "% 脂肪"));
    }
    if (todayNutrients.protein != null && todayNutrients.protein.percentage > 0.0f) {
        values.add(new SliceValue(todayNutrients.protein.percentage, NUTRIENTS_COLORS[2])
                .setLabel(todayNutrients.protein.percentage < 0.0f ? "0" : ((int)
                        (todayNutrients.protein.percentage * 100.0f)) + "% 蛋白质"));
    }
    PieChartData data = new PieChartData(values);
    data.setHasLabels(true);
    data.setHasLabelsOnlyForSelected(false);
    data.setHasLabelsOutside(false);
    data.setHasCenterCircle(false);
    data.setSlicesSpacing(3);
    pieChartView.setValueSelectionEnabled(true);
    data.setValueLabelBackgroundColor(0);
    pieChartView.setPieChartData(data);
    pieChartView.startDataAnimation();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:30,代码来源:ChartAnalysisHelper.java

示例13: onActivityCreated

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState){
    super.onActivityCreated(savedInstanceState);

    mPieChartView=(PieChartView)view.findViewById(R.id.disease_piechart);

    //设置环形图数据
    setPieDatas();

    //设置点击事件
    mPieChartView.setOnValueTouchListener(new ValueTouchListener());
}
 
开发者ID:lupwei,项目名称:Croprotector,代码行数:13,代码来源:disease_chart_fragment.java

示例14: setValue

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
private void setValue(PieChartData data, int score, TextView label,PieChartView chartView){
    int color = getColorBasedOnScore(score);
    setGraph(chartView, data,color);
    label.setBackgroundColor(color);
    data.getValues().get(0).setTarget(score);
    data.getValues().get(1).setTarget(10-score);
    data.setCenterText1(score + "/10");
}
 
开发者ID:Aptoide,项目名称:aptoide-client,代码行数:9,代码来源:ReviewActivity.java

示例15: setupChart

import lecho.lib.hellocharts.view.PieChartView; //导入依赖的package包/类
private static void setupChart(Context context,
                               PieChartContentBinding pieChartBinding,
                               List<PieChartSlice> pieChartSlices) {
    PieChartData data = new PieChartData();
    data.setHasLabels(true);
    //data.setHasLabelsOutside(true);

    Collections.sort(pieChartSlices, PIE_CHART_SLICE_COMPARATOR);
    while (pieChartSlices.size() > MAX_VALUES) {
        pieChartSlices.remove(pieChartSlices.size() - 1);
    }

    List<SliceValue> sliceValues = new ArrayList<>();
    pieChartBinding.legend.removeAllViews();
    for (PieChartSlice pieChartSlice : pieChartSlices) {
        sliceValues.add(pieChartSlice.sliceValue);
        ChartUtils.addLegendEntry(context,
                pieChartBinding.legend,
                pieChartSlice.legendLabel,
                pieChartSlice.sliceValue.getColor());
    }

    data.setValues(sliceValues);
    PieChartView pieChartView = pieChartBinding.memberSpeakingTimeChart;
    pieChartView.setPieChartData(data);
    pieChartView.setInteractive(false);
    pieChartView.setZoomEnabled(true);
    pieChartView.setZoomType(ZoomType.HORIZONTAL_AND_VERTICAL);
    // https://github.com/lecho/hellocharts-android/issues/268
    //pieChartView.setCircleFillRatio(0.4f);
}
 
开发者ID:caarmen,项目名称:scrumchatter,代码行数:32,代码来源:MemberSpeakingTimePieChart.java


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