com.github.mikephil.charting.charts.PieChart Java Examples
The following examples show how to use
com.github.mikephil.charting.charts.PieChart.
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: ProgressChartCard.java From ResearchStack with Apache License 2.0 | 6 votes |
private void initializeViews() { titleTextView = (TextView) findViewById(R.id.view_chart_progress_title); titleTextView.setText(titleText); titleTextView.setTextColor(titleTextColor); titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize); titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL)); finishView = (TextView) findViewById(R.id.view_chart_progress_finish); finishView.setText(finishText); finishView.setTextColor(finishTextColor); tabLayout = (TabLayout) findViewById(R.id.view_chart_progress_tabs); tabLayout.setSelectedTabIndicatorColor(tabIndicatorColor); tabLayout.setTabTextColors(tabTextColor, tabSelectedTextColor); chart = (PieChart) findViewById(R.id.view_chart_progress_chart); chart.setDrawSliceText(false); chart.setTouchEnabled(false); chart.setHoleColor(Color.TRANSPARENT); chart.setHoleRadius(95f); chart.getLegend().setEnabled(false); chart.setDescription(""); chart.setCenterTextColor(centerTextColor); chart.setCenterTextSize(centerTextSize); chart.setCenterTextTypeface(Typeface.create(centerTextTypeface, Typeface.NORMAL)); }
Example #2
Source File: PieChartCard.java From ResearchStack with Apache License 2.0 | 6 votes |
private void initializeViews() { titleTextView = (TextView) findViewById(R.id.view_chart_pie_title); titleTextView.setText(titleText); titleTextView.setTextColor(titleTextColor); titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize); titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL)); chart = (PieChart) findViewById(R.id.view_chart_pie); chart.setDrawSliceText(false); chart.setTouchEnabled(false); chart.setHoleRadius(0); chart.setTransparentCircleRadius(0); chart.getLegend().setEnabled(false); chart.setDescription(""); chart.setDrawCenterText(false); rowContainer = (LinearLayout) findViewById(R.id.view_chart_pie_rows); }
Example #3
Source File: PieChartRenderer.java From NetKnight with Apache License 2.0 | 6 votes |
public PieChartRenderer(PieChart chart, ChartAnimator animator, ViewPortHandler viewPortHandler) { super(animator, viewPortHandler); mChart = chart; mHolePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mHolePaint.setColor(Color.WHITE); mHolePaint.setStyle(Style.FILL); mTransparentCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTransparentCirclePaint.setColor(Color.WHITE); mTransparentCirclePaint.setStyle(Style.FILL); mTransparentCirclePaint.setAlpha(105); mCenterTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mCenterTextPaint.setColor(Color.BLACK); mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f)); mValuePaint.setTextSize(Utils.convertDpToPixel(13f)); mValuePaint.setColor(Color.WHITE); mValuePaint.setTextAlign(Align.CENTER); mValueLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mValueLinePaint.setStyle(Style.STROKE); }
Example #4
Source File: PieChartFrag.java From Stayfit with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.frag_simple_pie, container, false); mChart = (PieChart) v.findViewById(R.id.pieChart1); mChart.setDescription(""); Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "OpenSans-Light.ttf"); mChart.setCenterTextTypeface(tf); mChart.setCenterText(generateCenterText()); mChart.setCenterTextSize(10f); mChart.setCenterTextTypeface(tf); // radius of the center hole in percent of maximum radius mChart.setHoleRadius(45f); mChart.setTransparentCircleRadius(50f); Legend l = mChart.getLegend(); l.setPosition(LegendPosition.RIGHT_OF_CHART); mChart.setData(generatePieData()); return v; }
Example #5
Source File: PieChartRenderer.java From Stayfit with Apache License 2.0 | 6 votes |
public PieChartRenderer(PieChart chart, ChartAnimator animator, ViewPortHandler viewPortHandler) { super(animator, viewPortHandler); mChart = chart; mHolePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mHolePaint.setColor(Color.WHITE); mHolePaint.setStyle(Style.FILL); mTransparentCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTransparentCirclePaint.setColor(Color.WHITE); mTransparentCirclePaint.setStyle(Style.FILL); mTransparentCirclePaint.setAlpha(105); mCenterTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mCenterTextPaint.setColor(Color.BLACK); mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f)); mValuePaint.setTextSize(Utils.convertDpToPixel(13f)); mValuePaint.setColor(Color.WHITE); mValuePaint.setTextAlign(Align.CENTER); }
Example #6
Source File: StatisticViewHolder.java From BrainPhaser with GNU General Public License v3.0 | 6 votes |
/** * Applies a most played / failed / succeeded chart to the chart in the mItemView view * * @param type the statistic type of the chart to be applied */ public void applyMostPlayedChart(StatisticType type) { //Apply chart PieChart chart = (PieChart) mItemView.findViewById(R.id.statisticsChart); mShownChallenges = mStatisticsLogic.fillChart(chart, type); //Add chart selection listener chart.setOnChartValueSelectedListener(new ChartValueSelectedListener(this)); //Select first entry if (chart.getData() != null) { chart.highlightValue(0, 0); TextView text = (TextView) mItemView.findViewById(R.id.challengeView); String question = mChallengeDataSource.getById(mShownChallenges.get(0)).getQuestion(); if (text != null) text.setText(question); } TextView title = (TextView) mItemView.findViewById(R.id.titleView); if (title != null) title.setText(getTitle(type)); }
Example #7
Source File: PieChartRenderer.java From iMoney with Apache License 2.0 | 6 votes |
public PieChartRenderer(PieChart chart, ChartAnimator animator, ViewPortHandler viewPortHandler) { super(animator, viewPortHandler); mChart = chart; mHolePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mHolePaint.setColor(Color.WHITE); mHolePaint.setStyle(Style.FILL); mTransparentCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTransparentCirclePaint.setColor(Color.WHITE); mTransparentCirclePaint.setStyle(Style.FILL); mTransparentCirclePaint.setAlpha(100); mCenterTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mCenterTextPaint.setColor(Color.BLACK); mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f)); mCenterTextPaint.setTextAlign(Align.CENTER); mValuePaint.setTextSize(Utils.convertDpToPixel(13f)); mValuePaint.setColor(Color.WHITE); mValuePaint.setTextAlign(Align.CENTER); }
Example #8
Source File: ChartUtils.java From AccountBook with GNU General Public License v3.0 | 6 votes |
/** * 初始化饼状图 * @param chart pieChart */ public static void initPieChart(PieChart chart){ chart.setNoDataText(UiUtils.getString(R.string.empty_data)); chart.setUsePercentValues(true); chart.getDescription().setEnabled(false); chart.setExtraOffsets(5, 10, 5, 5); chart.setDragDecelerationFrictionCoef(0.95f); chart.setDrawHoleEnabled(true); chart.setDrawEntryLabels(false);// 设置条目标签 chart.setHoleColor(Color.WHITE); chart.setTransparentCircleColor(Color.WHITE); chart.setTransparentCircleAlpha(110); chart.setHoleRadius(58f); chart.setTransparentCircleRadius(61f); chart.setDrawCenterText(true); chart.setRotationAngle(0); chart.setRotationEnabled(true); chart.setHighlightPerTapEnabled(true); chart.getLegend().setEnabled(false); }
Example #9
Source File: RealmDatabaseActivityPie.java From Stayfit with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_piechart_noseekbar); mChart = (PieChart) findViewById(R.id.chart1); setup(mChart); mChart.setCenterText(generateCenterSpannableText()); }
Example #10
Source File: StatisticsFragment.java From Expense-Tracker-App with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_statistics, container, false); pcCategories = (PieChart) rootView.findViewById(R.id.pc_categories); bcCategories = (BarChart) rootView.findViewById(R.id.bc_categories); tvPcCategoriesEmpty = (TextView)rootView.findViewById(R.id.tv_bar_chart_category_empty); tvBcCategoriesEmpty = (TextView)rootView.findViewById(R.id.tv_pie_categories_chart_empty); selectDateFragment = (SelectDateFragment)getChildFragmentManager().findFragmentById(R.id.select_date_fragment); selectDateFragment.setSelectDateFragment(this); return rootView; }
Example #11
Source File: ReportAdapter.java From outlay with Apache License 2.0 | 5 votes |
private void updateChartData(PieChart chart) { ArrayList<PieEntry> entries = new ArrayList<>(); ArrayList<Integer> colors = new ArrayList<>(); double sum = 0; for (int i = 0; i < categorizedExpenses.getCategories().size(); i++) { Category c = categorizedExpenses.getCategory(i); Report r = categorizedExpenses.getReport(c); sum += r.getTotalAmount().doubleValue(); entries.add(new PieEntry((int) (r.getTotalAmount().doubleValue() * 1000), c.getTitle())); colors.add(c.getColor()); } PieDataSet dataSet = new PieDataSet(entries, "Outlay"); dataSet.setSliceSpace(2f); dataSet.setSelectionShift(10f); dataSet.setColors(colors); PieData data = new PieData(dataSet); data.setValueFormatter((value, entry, dataSetIndex, viewPortHandler) -> NumberUtils.formatAmount((double) value / 1000)); data.setValueTextSize(11f); data.setValueTextColor(Color.WHITE); chart.setData(data); chart.setCenterText(NumberUtils.formatAmount(sum)); chart.highlightValues(null); chart.invalidate(); }
Example #12
Source File: ProductDetailActivity.java From FaceT with Mozilla Public License 2.0 | 5 votes |
private void setData(PieChart colorPie, float value) { ArrayList<PieEntry> entries = new ArrayList<PieEntry>(); float result = value / 5f; Log.d(TAG + " result ", result + ""); entries.add(new PieEntry(result, 0)); entries.add(new PieEntry(1 - result, 1)); // NOTE: The order of the entries when being added to the entries array determines their position around the center of // the chart. // colorPie.setCenterTextTypeface(mTfLight); int centerTextColor = android.graphics.Color.argb(255, 57, 197, 193); colorPie.setCenterTextColor(centerTextColor); PieDataSet dataSet = new PieDataSet(entries, ""); dataSet.setSliceSpace(3f); dataSet.setSelectionShift(3f); // add a lot of colors ArrayList<Integer> colors = new ArrayList<Integer>(); colors.add(Color.argb(120, 57, 197, 193)); colorPie.setCenterText(value + ""); colorPie.setCenterTextSize(30); colors.add(Color.argb(100, 214, 214, 214)); dataSet.setColors(colors); PieData data = new PieData(dataSet); data.setValueFormatter(new PercentFormatter()); data.setValueTextSize(0f); data.setValueTextColor(Color.WHITE); colorPie.setData(data); // undo all highlights colorPie.highlightValues(null); colorPie.invalidate(); }
Example #13
Source File: ProductDetailActivity.java From FaceT with Mozilla Public License 2.0 | 5 votes |
private void setEffectPieChart(PieChart colorPie) { colorPie.animateXY(1500, 1500, Easing.EasingOption.EaseInBounce, Easing.EasingOption.EaseInBounce); colorPie.invalidate(); colorPie.setDrawHoleEnabled(true); colorPie.setExtraOffsets(10, 10, 10, 10); colorPie.setContentDescription(""); colorPie.setDragDecelerationFrictionCoef(0.95f); colorPie.setDrawCenterText(true); colorPie.setRotationAngle(0); // enable rotation of the chart by touch colorPie.setRotationEnabled(true); colorPie.setHighlightPerTapEnabled(true); colorPie.setDrawHoleEnabled(true); colorPie.setHoleColor(Color.WHITE); colorPie.getLegend().setFormSize(10f); colorPie.getLegend().setFormToTextSpace(5f); //disable the label and description colorPie.getDescription().setEnabled(false); colorPie.getLegend().setEnabled(false); colorPie.setTransparentCircleColor(Color.WHITE); colorPie.setTransparentCircleAlpha(80); colorPie.setElevation(10f); colorPie.setHoleRadius(90f); colorPie.setTransparentCircleRadius(61f); // add a selection listener colorPie.setOnChartValueSelectedListener(this); }
Example #14
Source File: ColorDetectionActivity.java From FaceT with Mozilla Public License 2.0 | 5 votes |
private void seteffect(PieChart colorPie) { colorPie.animateXY(2000, 2000, Easing.EasingOption.EaseInBounce, Easing.EasingOption.EaseInBounce); colorPie.invalidate(); colorPie.setDrawHoleEnabled(true); colorPie.setExtraOffsets(10, 10, 10, 10); colorPie.setContentDescription(""); colorPie.setDragDecelerationFrictionCoef(0.95f); colorPie.setDrawCenterText(true); colorPie.setRotationAngle(0); // enable rotation of the chart by touch colorPie.setRotationEnabled(true); colorPie.setHighlightPerTapEnabled(true); colorPie.setDrawHoleEnabled(true); colorPie.setHoleColor(Color.WHITE); //disable the label and description colorPie.getDescription().setEnabled(false); colorPie.getLegend().setEnabled(false); colorPie.setTransparentCircleColor(Color.WHITE); colorPie.setTransparentCircleAlpha(80); colorPie.setElevation(10f); colorPie.setHoleRadius(60f); colorPie.setTransparentCircleRadius(61f); // add a selection listener colorPie.setOnChartValueSelectedListener(this); }
Example #15
Source File: PredictionsFragment.java From SEAL-Demo with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_predictions_layout, container, false); ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(R.string.title_fragment_predictions); mChart = (PieChart) v.findViewById(R.id.chart); mHighPercentage = (TextView) v.findViewById(R.id.highClassificationValue); mMediumPercentage = (TextView) v.findViewById(R.id.mediumClassificationValue); mLowPercentage = (TextView) v.findViewById(R.id.lowClassificationValue); mProgressBar = (ProgressBar) v.findViewById(R.id.predictionProgress); // chart settings mChart.setUsePercentValues(true); mChart.getDescription().setEnabled(false); mChart.setExtraOffsets(10, 10, 10, 10); mChart.setDragDecelerationFrictionCoef(0.95f); mChart.setDrawHoleEnabled(false); mChart.setDrawCenterText(false); mChart.setRotationAngle(0); mChart.animateY(400, Easing.EasingOption.EaseInOutQuad); // enable rotation of the mChart by touch mChart.setRotationEnabled(true); mChart.setHighlightPerTapEnabled(true); mChart.getLegend().setEnabled(false); asyncGetIntensities(); return v; }
Example #16
Source File: PieRadarHighlighter.java From android-kline with Apache License 2.0 | 5 votes |
@Override public Highlight getHighlight(float x, float y) { float touchDistanceToCenter = mChart.distanceToCenter(x, y); // check if a slice was touched if (touchDistanceToCenter > mChart.getRadius()) { // if no slice was touched, highlight nothing return null; } else { float angle = mChart.getAngleForPoint(x, y); if (mChart instanceof PieChart) { angle /= mChart.getAnimator().getPhaseY(); } int index = mChart.getIndexForAngle(angle); // check if the index could be found if (index < 0 || index >= mChart.getData().getMaxEntryCountSet().getEntryCount()) { return null; } else { return getClosestHighlight(index, x, y); } } }
Example #17
Source File: LoadFolderSpaceData.java From PowerFileExplorer with GNU General Public License v3.0 | 5 votes |
public LoadFolderSpaceData(Context c, AppTheme appTheme, PieChart chart, BaseFile f) { context = c; this.appTheme = appTheme; this.chart = chart; file = f; LEGENDS = new String[]{context.getString(R.string.size), context.getString(R.string.used_by_others), context.getString(R.string.free)}; COLORS = new int[]{getColor(c, R.color.piechart_red), getColor(c, R.color.piechart_blue), getColor(c, R.color.piechart_green)}; }
Example #18
Source File: PieChartRenderer.java From StockChart-MPAndroidChart with MIT License | 5 votes |
public PieChartRenderer(PieChart chart, ChartAnimator animator, ViewPortHandler viewPortHandler) { super(animator, viewPortHandler); mChart = chart; mHolePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mHolePaint.setColor(Color.WHITE); mHolePaint.setStyle(Style.FILL); mTransparentCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTransparentCirclePaint.setColor(Color.WHITE); mTransparentCirclePaint.setStyle(Style.FILL); mTransparentCirclePaint.setAlpha(105); mCenterTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mCenterTextPaint.setColor(Color.BLACK); mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f)); mValuePaint.setTextSize(Utils.convertDpToPixel(13f)); mValuePaint.setColor(Color.BLACK); mValuePaint.setTextAlign(Align.CENTER); mEntryLabelsPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mEntryLabelsPaint.setColor(Color.BLACK); mEntryLabelsPaint.setTextAlign(Align.CENTER); mEntryLabelsPaint.setTextSize(Utils.convertDpToPixel(13f)); mValueLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mValueLinePaint.setStyle(Style.STROKE); }
Example #19
Source File: PieRadarHighlighter.java From StockChart-MPAndroidChart with MIT License | 5 votes |
@Override public Highlight getHighlight(float x, float y) { float touchDistanceToCenter = mChart.distanceToCenter(x, y); // check if a slice was touched if (touchDistanceToCenter > mChart.getRadius()) { // if no slice was touched, highlight nothing return null; } else { float angle = mChart.getAngleForPoint(x, y); if (mChart instanceof PieChart) { angle /= mChart.getAnimator().getPhaseY(); } int index = mChart.getIndexForAngle(angle); // check if the index could be found if (index < 0 || index >= mChart.getData().getMaxEntryCountSet().getEntryCount()) { return null; } else { return getClosestHighlight(index, x, y); } } }
Example #20
Source File: MainActivityInstrumentationTest.java From android-ponewheel with MIT License | 5 votes |
@Test public void testBatteryGrid(){ //onView(withId(R.id.editText)).perform(typeText(STRING_TO_BE_TYPED), closeSoftKeyboard()); //line 1 //onView(withText("Say hello!")).perform(click()); //line 2 final PieChart pieChart = mActivityRule.getActivity().findViewById(R.id.batteryPieChart); mActivityRule.getActivity().updateBatteryRemaining(50); assertTrue(pieChart.getCenterText().equals("50%")); mActivityRule.getActivity().updateBatteryRemaining(20); assertTrue(pieChart.getCenterText().equals("20%")); }
Example #21
Source File: PieChartRenderer.java From Ticket-Analysis with MIT License | 5 votes |
public PieChartRenderer(PieChart chart, ChartAnimator animator, ViewPortHandler viewPortHandler) { super(animator, viewPortHandler); mChart = chart; mHolePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mHolePaint.setColor(Color.WHITE); mHolePaint.setStyle(Style.FILL); mTransparentCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTransparentCirclePaint.setColor(Color.WHITE); mTransparentCirclePaint.setStyle(Style.FILL); mTransparentCirclePaint.setAlpha(105); mCenterTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mCenterTextPaint.setColor(Color.BLACK); mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f)); mValuePaint.setTextSize(Utils.convertDpToPixel(13f)); mValuePaint.setColor(Color.WHITE); mValuePaint.setTextAlign(Align.CENTER); mEntryLabelsPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mEntryLabelsPaint.setColor(Color.WHITE); mEntryLabelsPaint.setTextAlign(Align.CENTER); mEntryLabelsPaint.setTextSize(Utils.convertDpToPixel(13f)); mValueLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mValueLinePaint.setStyle(Style.STROKE); }
Example #22
Source File: PieRadarHighlighter.java From Ticket-Analysis with MIT License | 5 votes |
@Override public Highlight getHighlight(float x, float y) { float touchDistanceToCenter = mChart.distanceToCenter(x, y); // check if a slice was touched if (touchDistanceToCenter > mChart.getRadius()) { // if no slice was touched, highlight nothing return null; } else { float angle = mChart.getAngleForPoint(x, y); if (mChart instanceof PieChart) { angle /= mChart.getAnimator().getPhaseY(); } int index = mChart.getIndexForAngle(angle); // check if the index could be found if (index < 0 || index >= mChart.getData().getMaxEntryCountSet().getEntryCount()) { return null; } else { return getClosestHighlight(index, x, y); } } }
Example #23
Source File: PieChartRenderer.java From android-kline with Apache License 2.0 | 5 votes |
public PieChartRenderer(PieChart chart, ChartAnimator animator, ViewPortHandler viewPortHandler) { super(animator, viewPortHandler); mChart = chart; mHolePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mHolePaint.setColor(Color.WHITE); mHolePaint.setStyle(Style.FILL); mTransparentCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTransparentCirclePaint.setColor(Color.WHITE); mTransparentCirclePaint.setStyle(Style.FILL); mTransparentCirclePaint.setAlpha(105); mCenterTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mCenterTextPaint.setColor(Color.BLACK); mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f)); mValuePaint.setTextSize(Utils.convertDpToPixel(13f)); mValuePaint.setColor(Color.WHITE); mValuePaint.setTextAlign(Align.CENTER); mEntryLabelsPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mEntryLabelsPaint.setColor(Color.WHITE); mEntryLabelsPaint.setTextAlign(Align.CENTER); mEntryLabelsPaint.setTextSize(Utils.convertDpToPixel(13f)); mValueLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mValueLinePaint.setStyle(Style.STROKE); }
Example #24
Source File: PieChartManager.java From react-native-mp-android-chart with MIT License | 4 votes |
@ReactProp(name = "holeColor") public void setHoleColor(PieChart chart, String color) { chart.setHoleColor(Color.parseColor(color)); }
Example #25
Source File: GraphicActivity.java From ToDay with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_graphic); pieChart = (PieChart) findViewById(R.id.idPieChart); pieChart.setRotationEnabled(true); pieChart.setHoleRadius(25f); pieChart.setTransparentCircleAlpha(0); pieChart.setCenterText("Төлөвлөгөө"); pieChart.setCenterTextSize(10); pieChart.setDrawEntryLabels(true); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); addDataSet(); pieChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() { @Override public void onValueSelected(Entry e, Highlight h) { Log.d(TAG, "onValueSelected: Value select from chart."); Log.d(TAG, "onValueSelected: " + e.toString()); Log.d(TAG, "onValueSelected: " + h.toString()); int pos1 = e.toString().indexOf("(sum): "); String sales = e.toString().substring(pos1 + 7); for(int i = 0; i < yData.length; i++){ if(yData[i] == Float.parseFloat(sales)){ pos1 = i; break; } } String employee = xData[pos1 + 1]; Toast.makeText(GraphicActivity.this, "Employee " + employee + "\n" + "Sales: $" + sales + "K", Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected() { } }); }
Example #26
Source File: ProgressChartCard.java From ResearchStack with Apache License 2.0 | 4 votes |
public PieChart getChart() { return chart; }
Example #27
Source File: FragmentPieChart.java From fingen with Apache License 2.0 | 4 votes |
public FgPieChartRenderer(PieChart chart, ChartAnimator animator, ViewPortHandler viewPortHandler) { super(chart, animator, viewPortHandler); }
Example #28
Source File: PieChartCard.java From ResearchStack with Apache License 2.0 | 4 votes |
public PieChart getChart() { return chart; }
Example #29
Source File: PercentFormatter.java From StockChart-MPAndroidChart with MIT License | 4 votes |
public PercentFormatter(PieChart pieChart) { this(); this.pieChart = pieChart; }
Example #30
Source File: PercentFormatter.java From StockChart-MPAndroidChart with MIT License | 4 votes |
public PercentFormatter(PieChart pieChart, boolean percentSignSeparated) { this(pieChart); this.percentSignSeparated = percentSignSeparated; }