lecho.lib.hellocharts.view.PieChartView Java Examples
The following examples show how to use
lecho.lib.hellocharts.view.PieChartView.
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: ReviewActivity.java From aptoide-client with GNU General Public License v2.0 | 6 votes |
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); }
Example #2
Source File: ReviewActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
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"); }
Example #3
Source File: PieChartRotationAnimatorV14.java From hellocharts-android with Apache License 2.0 | 5 votes |
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); }
Example #4
Source File: PieChartTouchHandler.java From hellocharts-android with Apache License 2.0 | 5 votes |
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. }
Example #5
Source File: PieChartActivity.java From hellocharts-android with Apache License 2.0 | 5 votes |
@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; }
Example #6
Source File: DataChartActivity.java From Memory-capsule with Apache License 2.0 | 4 votes |
private void initPieChart(){//设置饼状图 pieChartView=new PieChartView(this); List<SliceValue> values = new ArrayList<SliceValue>(); int pieWidth=(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,400, getResources().getDisplayMetrics()); int pieHeigth=(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,400, getResources().getDisplayMetrics()); RelativeLayout.LayoutParams pieChartParams=new RelativeLayout.LayoutParams(pieWidth,pieHeigth); pieChartParams.addRule(RelativeLayout.CENTER_HORIZONTAL); pieChartParams.addRule(RelativeLayout.CENTER_VERTICAL); for (int i = 0; i < 5; ++i) { SliceValue sliceValue = new SliceValue((float) typesNum.get(i), colorData[i]); values.add(sliceValue); } pieChartView.setViewportCalculationEnabled(true); pieChartView.setChartRotationEnabled(false); pieChartView.setAlpha(0.9f); pieChartView.setCircleFillRatio(1f); pieChartView.setValueSelectionEnabled(true); final PieChartData pieChartData=new PieChartData(); pieChartData.setHasLabels(true); pieChartData.setHasLabelsOnlyForSelected(false); pieChartData.setHasLabelsOutside(false); pieChartData.setHasCenterCircle(true); pieChartData.setCenterCircleColor(Color.WHITE); pieChartData.setCenterCircleScale(0.5f); pieChartData.setCenterText1Color(integer0); pieChartData.setCenterText2Color(Color.BLUE); pieChartData.setValues(values); pieChartView.setPieChartData(pieChartData); pieChartView.setOnValueTouchListener(new PieChartOnValueSelectListener() { @Override public void onValueSelected(int arcIndex, SliceValue value) { pieChartData.setCenterText1Color(integer0); pieChartData.setCenterText1FontSize(12); pieChartData.setCenterText1(stateChar[arcIndex]); pieChartData.setCenterText2Color(integer0); pieChartData.setCenterText2FontSize(16); pieChartData.setCenterText2(value.getValue()+"("+getCenterStringfromData(arcIndex)+")"); } @Override public void onValueDeselected() { } }); relativeLayout.addView(pieChartView,pieChartParams); }
Example #7
Source File: ReviewActivity.java From aptoide-client with GNU General Public License v2.0 | 4 votes |
private void init() { final View speed_chart = findViewById(R.id.speed_chart); final View usability_chart = findViewById(R.id.usability_chart); final View addictive_chart = findViewById(R.id.addictive_chart); final View stability_chart = findViewById(R.id.stability_chart); speedChart = (PieChartView) speed_chart.findViewById(R.id.chart); usabilityChart = (PieChartView) usability_chart.findViewById(R.id.chart); addictiveChart = (PieChartView) addictive_chart.findViewById(R.id.chart); stabilityChart = (PieChartView) stability_chart.findViewById(R.id.chart); screenshots = new ArrayList<>(); screenshots.add((ImageView) speed_chart.findViewById(R.id.screenshot)); screenshots.add((ImageView) usability_chart.findViewById(R.id.screenshot)); screenshots.add((ImageView) addictive_chart.findViewById(R.id.screenshot)); screenshots.add((ImageView) stability_chart.findViewById(R.id.screenshot)); bigImage = (ImageView) findViewById(R.id.bigImage); speedLabel = (TextView) speed_chart.findViewById(R.id.designation); usabilityLabel = (TextView) usability_chart.findViewById(R.id.designation); addictiveLabel = (TextView) addictive_chart.findViewById(R.id.designation); stabilityLabel = (TextView) stability_chart.findViewById(R.id.designation); speedLabel.setText(R.string.review_speed); usabilityLabel.setText(R.string.review_usability); addictiveLabel.setText(R.string.review_addictive); stabilityLabel.setText(R.string.review_stability); title = (TextView) findViewById(R.id.app_name); finalVeredict = (TextView) findViewById(R.id.final_veredict); reviewer = (TextView) findViewById(R.id.reviewer); rating = (TextView) findViewById(R.id.rating); appIcon = (ImageView) findViewById(R.id.app_icon); avatar = (ImageView) findViewById(R.id.avatar); speedData = new PieChartData(); usabilityData = new PieChartData(); addictiveData = new PieChartData(); stabilityData = new PieChartData(); prosLabel = (TextView) findViewById(R.id.pros_label); consLabel = (TextView) findViewById(R.id.cons_label); vername_date = (TextView) findViewById(R.id.vername_date); consContainer = (LinearLayout) findViewById(R.id.cons_container); prosContainer = (LinearLayout) findViewById(R.id.pros_container); }
Example #8
Source File: PieChartRotationAnimatorV8.java From hellocharts-android with Apache License 2.0 | 4 votes |
public PieChartRotationAnimatorV8(PieChartView chart) { this(chart, FAST_ANIMATION_DURATION); }
Example #9
Source File: PieChartRotationAnimatorV8.java From hellocharts-android with Apache License 2.0 | 4 votes |
public PieChartRotationAnimatorV8(PieChartView chart, long duration) { this.chart = chart; this.duration = duration; this.handler = new Handler(); }
Example #10
Source File: PieChartRotationAnimatorV14.java From hellocharts-android with Apache License 2.0 | 4 votes |
public PieChartRotationAnimatorV14(PieChartView chart) { this(chart, FAST_ANIMATION_DURATION); }