Java Code Examples for com.github.mikephil.charting.interfaces.datasets.IPieDataSet#getSliceSpace()

The following examples show how to use com.github.mikephil.charting.interfaces.datasets.IPieDataSet#getSliceSpace() . 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: PieChartRenderer.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: PieChartRenderer.java    From Ticket-Analysis with MIT License 3 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: PieChartRenderer.java    From android-kline with Apache License 2.0 3 votes vote down vote up
/**
 * 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;
}