@Override public void drawData(Canvas c) { int width = (int) mViewPortHandler.getChartWidth(); int height = (int) mViewPortHandler.getChartHeight(); Bitmap drawBitmap = mDrawBitmap == null ? null : mDrawBitmap.get(); if (drawBitmap == null || (drawBitmap.getWidth() != width) || (drawBitmap.getHeight() != height)) { if (width > 0 && height > 0) { drawBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444); mDrawBitmap = new WeakReference<>(drawBitmap); mBitmapCanvas = new Canvas(drawBitmap); } else return; } drawBitmap.eraseColor(Color.TRANSPARENT); PieData pieData = mChart.getData(); for (IPieDataSet set : pieData.getDataSets()) { if (set.isVisible() && set.getEntryCount() > 0) drawDataSet(c, set); } }
@Override protected Highlight getClosestHighlight(int index, float x, float y) { IPieDataSet set = mChart.getData().getDataSet(); final Entry entry = set.getEntryForIndex(index); return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency()); } }
return; IPieDataSet dataSet = mChart.getData().getDataSet();
/** * Calculates the sliceSpace to use based on visible values and their size compared to the set sliceSpace. * * @param dataSet * @return */ protected float getSliceSpace(IPieDataSet dataSet) { if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled()) return dataSet.getSliceSpace(); float spaceSizeRatio = dataSet.getSliceSpace() / mViewPortHandler.getSmallestContentExtension(); float minValueRatio = dataSet.getYMin() / mChart.getData().getYValueSum() * 2; float sliceSpace = spaceSizeRatio > minValueRatio ? 0f : dataSet.getSliceSpace(); return sliceSpace; }
continue; IPieDataSet set = mChart.getData() .getDataSetByIndex(indices[i] .getDataSetIndex());
PieData data = mChart.getData(); List<IPieDataSet> dataSets = data.getDataSets();
for (IDataSet<?> set : chart.getData().getDataSets()) set.setDrawValues(!set.isDrawValuesEnabled());
@Override public void drawData(Canvas c) { int width = (int) mViewPortHandler.getChartWidth(); int height = (int) mViewPortHandler.getChartHeight(); if (mDrawBitmap == null || (mDrawBitmap.get().getWidth() != width) || (mDrawBitmap.get().getHeight() != height)) { if (width > 0 && height > 0) { mDrawBitmap = new WeakReference<Bitmap>(Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444)); mBitmapCanvas = new Canvas(mDrawBitmap.get()); } else return; } mDrawBitmap.get().eraseColor(Color.TRANSPARENT); PieData pieData = mChart.getData(); for (IPieDataSet set : pieData.getDataSets()) { if (set.isVisible() && set.getEntryCount() > 0) drawDataSet(c, set); } }
@Override public void drawData(Canvas c) { int width = (int) mViewPortHandler.getChartWidth(); int height = (int) mViewPortHandler.getChartHeight(); if (mDrawBitmap == null || (mDrawBitmap.get().getWidth() != width) || (mDrawBitmap.get().getHeight() != height)) { if (width > 0 && height > 0) { mDrawBitmap = new WeakReference<Bitmap>(Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444)); mBitmapCanvas = new Canvas(mDrawBitmap.get()); } else return; } mDrawBitmap.get().eraseColor(Color.TRANSPARENT); PieData pieData = mChart.getData(); for (IPieDataSet set : pieData.getDataSets()) { if (set.isVisible() && set.getEntryCount() > 0) drawDataSet(c, set); } }
@Override public void drawData(Canvas c) { int width = (int) mViewPortHandler.getChartWidth(); int height = (int) mViewPortHandler.getChartHeight(); if (mDrawBitmap == null || (mDrawBitmap.get().getWidth() != width) || (mDrawBitmap.get().getHeight() != height)) { if (width > 0 && height > 0) { mDrawBitmap = new WeakReference<Bitmap>(Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444)); mBitmapCanvas = new Canvas(mDrawBitmap.get()); } else return; } mDrawBitmap.get().eraseColor(Color.TRANSPARENT); PieData pieData = mChart.getData(); for (IPieDataSet set : pieData.getDataSets()) { if (set.isVisible() && set.getEntryCount() > 0) drawDataSet(c, set); } }
@Override public void drawData(Canvas c) { int width = (int) mViewPortHandler.getChartWidth(); int height = (int) mViewPortHandler.getChartHeight(); Bitmap drawBitmap = mDrawBitmap == null ? null : mDrawBitmap.get(); if (drawBitmap == null || (drawBitmap.getWidth() != width) || (drawBitmap.getHeight() != height)) { if (width > 0 && height > 0) { drawBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444); mDrawBitmap = new WeakReference<>(drawBitmap); mBitmapCanvas = new Canvas(drawBitmap); } else return; } drawBitmap.eraseColor(Color.TRANSPARENT); PieData pieData = mChart.getData(); for (IPieDataSet set : pieData.getDataSets()) { if (set.isVisible() && set.getEntryCount() > 0) drawDataSet(c, set); } }
@Override protected Highlight getClosestHighlight(int index, float x, float y) { IPieDataSet set = mChart.getData().getDataSet(); final Entry entry = set.getEntryForIndex(index); return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency()); } }
@Override protected Highlight getClosestHighlight(int index, float x, float y) { IPieDataSet set = mChart.getData().getDataSet(); final Entry entry = set.getEntryForIndex(index); return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency()); } }
@Override protected Highlight getClosestHighlight(int index, float x, float y) { IPieDataSet set = mChart.getData().getDataSet(); final Entry entry = set.getEntryForIndex(index); return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency()); } }
@Override protected Highlight getClosestHighlight(int index, float x, float y) { IPieDataSet set = mChart.getData().getDataSet(); final Entry entry = set.getEntryForIndex(index); return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency()); } }
/** * Calculates the sliceSpace to use based on visible values and their size compared to the set sliceSpace. * * @param dataSet * @return */ protected float getSliceSpace(IPieDataSet dataSet) { if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled()) return dataSet.getSliceSpace(); float spaceSizeRatio = dataSet.getSliceSpace() / mViewPortHandler.getSmallestContentExtension(); float minValueRatio = dataSet.getYMin() / mChart.getData().getYValueSum() * 2; float sliceSpace = spaceSizeRatio > minValueRatio ? 0f : dataSet.getSliceSpace(); return sliceSpace; }
/** * Calculates the sliceSpace to use based on visible values and their size compared to the set sliceSpace. * * @param dataSet * @return */ protected float getSliceSpace(IPieDataSet dataSet) { if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled()) return dataSet.getSliceSpace(); float spaceSizeRatio = dataSet.getSliceSpace() / mViewPortHandler.getSmallestContentExtension(); float minValueRatio = dataSet.getYMin() / mChart.getData().getYValueSum() * 2; float sliceSpace = spaceSizeRatio > minValueRatio ? 0f : dataSet.getSliceSpace(); return sliceSpace; }
/** * Calculates the sliceSpace to use based on visible values and their size compared to the set sliceSpace. * * @param dataSet * @return */ protected float getSliceSpace(IPieDataSet dataSet) { if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled()) return dataSet.getSliceSpace(); float spaceSizeRatio = dataSet.getSliceSpace() / mViewPortHandler.getSmallestContentExtension(); float minValueRatio = dataSet.getYMin() / mChart.getData().getYValueSum() * 2; float sliceSpace = spaceSizeRatio > minValueRatio ? 0f : dataSet.getSliceSpace(); return sliceSpace; }
/** * Calculates the sliceSpace to use based on visible values and their size compared to the set sliceSpace. * * @param dataSet * @return */ protected float getSliceSpace(IPieDataSet dataSet) { if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled()) return dataSet.getSliceSpace(); float spaceSizeRatio = dataSet.getSliceSpace() / mViewPortHandler.getSmallestContentExtension(); float minValueRatio = dataSet.getYMin() / mChart.getData().getYValueSum() * 2; float sliceSpace = spaceSizeRatio > minValueRatio ? 0f : dataSet.getSliceSpace(); return sliceSpace; }