Java Code Examples for com.github.mikephil.charting.utils.Utils#getNormalizedAngle()

The following examples show how to use com.github.mikephil.charting.utils.Utils#getNormalizedAngle() . 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: RadarChart.java    From iMoney with Apache License 2.0 5 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    float sliceangle = getSliceAngle();

    for (int i = 0; i < mData.getXValCount(); i++) {
        if (sliceangle * (i + 1) - sliceangle / 2f > a)
            return i;
    }

    return 0;
}
 
Example 2
Source File: PieChart.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    for (int i = 0; i < mAbsoluteAngles.length; i++) {
        if (mAbsoluteAngles[i] > a)
            return i;
    }

    return -1; // return -1 if no index found
}
 
Example 3
Source File: RadarChart.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    float sliceangle = getSliceAngle();

    for (int i = 0; i < mData.getXValCount(); i++) {
        if (sliceangle * (i + 1) - sliceangle / 2f > a)
            return i;
    }

    return 0;
}
 
Example 4
Source File: PieChart.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    for (int i = 0; i < mAbsoluteAngles.length; i++) {
        if (mAbsoluteAngles[i] > a)
            return i;
    }

    return -1; // return -1 if no index found
}
 
Example 5
Source File: RadarChart.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    float sliceangle = getSliceAngle();

    for (int i = 0; i < mData.getXValCount(); i++) {
        if (sliceangle * (i + 1) - sliceangle / 2f > a)
            return i;
    }

    return 0;
}
 
Example 6
Source File: PieChart.java    From iMoney with Apache License 2.0 5 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    for (int i = 0; i < mAbsoluteAngles.length; i++) {
        if (mAbsoluteAngles[i] > a)
            return i;
    }

    return -1; // return -1 if no index found
}
 
Example 7
Source File: PieChart.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    for (int i = 0; i < mAbsoluteAngles.length; i++) {
        if (mAbsoluteAngles[i] > a)
            return i;
    }

    return -1; // return -1 if no index found
}
 
Example 8
Source File: PieChart.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    for (int i = 0; i < mAbsoluteAngles.length; i++) {
        if (mAbsoluteAngles[i] > a)
            return i;
    }

    return -1; // return -1 if no index found
}
 
Example 9
Source File: PieChart.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    for (int i = 0; i < mAbsoluteAngles.length; i++) {
        if (mAbsoluteAngles[i] > a) {
            return i;
        }
    }

    return -1; // return -1 if no index found
}
 
Example 10
Source File: RadarChart.java    From android-kline with Apache License 2.0 4 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    float sliceangle = getSliceAngle();

    int max = mData.getMaxEntryCountSet().getEntryCount();

    int index = 0;

    for (int i = 0; i < max; i++) {

        float referenceAngle = sliceangle * (i + 1) - sliceangle / 2f;

        if (referenceAngle > a) {
            index = i;
            break;
        }
    }

    return index;
}
 
Example 11
Source File: RadarChart.java    From StockChart-MPAndroidChart with MIT License 4 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    float sliceangle = getSliceAngle();

    int max = mData.getMaxEntryCountSet().getEntryCount();

    int index = 0;

    for (int i = 0; i < max; i++) {

        float referenceAngle = sliceangle * (i + 1) - sliceangle / 2f;

        if (referenceAngle > a) {
            index = i;
            break;
        }
    }

    return index;
}
 
Example 12
Source File: RadarChart.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
@Override
public int getIndexForAngle(float angle) {

    // take the current angle of the chart into consideration
    float a = Utils.getNormalizedAngle(angle - getRotationAngle());

    float sliceangle = getSliceAngle();

    int max = mData.getMaxEntryCountSet().getEntryCount();

    int index = 0;

    for (int i = 0; i < max; i++) {

        float referenceAngle = sliceangle * (i + 1) - sliceangle / 2f;

        if (referenceAngle > a) {
            index = i;
            break;
        }
    }

    return index;
}
 
Example 13
Source File: PieRadarChartBase.java    From android-kline with Apache License 2.0 2 votes vote down vote up
/**
 * Set an offset for the rotation of the RadarChart in degrees. Default 270f
 * --> top (NORTH)
 *
 * @param angle
 */
public void setRotationAngle(float angle) {
    mRawRotationAngle = angle;
    mRotationAngle = Utils.getNormalizedAngle(mRawRotationAngle);
}
 
Example 14
Source File: PieRadarChartBase.java    From iMoney with Apache License 2.0 2 votes vote down vote up
/**
 * Set an offset for the rotation of the RadarChart in degrees. Default 270f
 * --> top (NORTH)
 * 
 * @param angle
 */
public void setRotationAngle(float angle) {
    mRawRotationAngle = angle;
    mRotationAngle = Utils.getNormalizedAngle(mRawRotationAngle);
}
 
Example 15
Source File: PieRadarChartBase.java    From Ticket-Analysis with MIT License 2 votes vote down vote up
/**
 * Set an offset for the rotation of the RadarChart in degrees. Default 270f
 * --> top (NORTH)
 *
 * @param angle
 */
public void setRotationAngle(float angle) {
    mRawRotationAngle = angle;
    mRotationAngle = Utils.getNormalizedAngle(mRawRotationAngle);
}
 
Example 16
Source File: PieRadarChartBase.java    From Stayfit with Apache License 2.0 2 votes vote down vote up
/**
 * Set an offset for the rotation of the RadarChart in degrees. Default 270f
 * --> top (NORTH)
 * 
 * @param angle
 */
public void setRotationAngle(float angle) {
    mRawRotationAngle = angle;
    mRotationAngle = Utils.getNormalizedAngle(mRawRotationAngle);
}
 
Example 17
Source File: PieRadarChartBase.java    From NetKnight with Apache License 2.0 2 votes vote down vote up
/**
 * Set an offset for the rotation of the RadarChart in degrees. Default 270f
 * --> top (NORTH)
 * 
 * @param angle
 */
public void setRotationAngle(float angle) {
    mRawRotationAngle = angle;
    mRotationAngle = Utils.getNormalizedAngle(mRawRotationAngle);
}
 
Example 18
Source File: PieRadarChartBase.java    From StockChart-MPAndroidChart with MIT License 2 votes vote down vote up
/**
 * Set an offset for the rotation of the RadarChart in degrees. Default 270f
 * --> top (NORTH)
 *
 * @param angle
 */
public void setRotationAngle(float angle) {
    mRawRotationAngle = angle;
    mRotationAngle = Utils.getNormalizedAngle(mRawRotationAngle);
}