@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 }
@Override protected float[] getMarkerPosition(Highlight highlight) { MPPointF center = getCenterCircleBox(); float r = getRadius(); float off = r / 10f * 3.6f; if (isDrawHoleEnabled()) { off = (r - (r / 100f * getHoleRadius())) / 2f; } r -= off; // offset to keep things inside the chart float rotationAngle = getRotationAngle(); int entryIndex = (int) highlight.getX(); // offset needed to center the drawn text in the slice float offset = mDrawAngles[entryIndex] / 2; // calculate the text position float x = (float) (r * Math.cos(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset) * mAnimator.getPhaseY())) + center.x); float y = (float) (r * Math.sin(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset) * mAnimator.getPhaseY())) + center.y); MPPointF.recycleInstance(center); return new float[]{x, y}; }
float angle = mChart.getRotationAngle();
protected void drawDataSet(Canvas c, IPieDataSet dataSet) { float rotationAngle = mChart.getRotationAngle();
float rotationAngle = mChart.getRotationAngle();
float rotationAngle = mChart.getRotationAngle(); float[] drawAngles = mChart.getDrawAngles(); float[] absoluteAngles = mChart.getAbsoluteAngles();
chart.spin(1000, chart.getRotationAngle(), chart.getRotationAngle() + 360, Easing.EaseInOutCubic); break;
chart.spin(1000, chart.getRotationAngle(), chart.getRotationAngle() + 360, Easing.EaseInOutCubic); break;
@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 }
@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 }
@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 }
@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 }
@Override protected float[] getMarkerPosition(Highlight highlight) { MPPointF center = getCenterCircleBox(); float r = getRadius(); float off = r / 10f * 3.6f; if (isDrawHoleEnabled()) { off = (r - (r / 100f * getHoleRadius())) / 2f; } r -= off; // offset to keep things inside the chart float rotationAngle = getRotationAngle(); int entryIndex = (int) highlight.getX(); // offset needed to center the drawn text in the slice float offset = mDrawAngles[entryIndex] / 2; // calculate the text position float x = (float) (r * Math.cos(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset) * mAnimator.getPhaseY())) + center.x); float y = (float) (r * Math.sin(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset) * mAnimator.getPhaseY())) + center.y); MPPointF.recycleInstance(center); return new float[]{x, y}; }
@Override protected float[] getMarkerPosition(Highlight highlight) { MPPointF center = getCenterCircleBox(); float r = getRadius(); float off = r / 10f * 3.6f; if (isDrawHoleEnabled()) { off = (r - (r / 100f * getHoleRadius())) / 2f; } r -= off; // offset to keep things inside the chart float rotationAngle = getRotationAngle(); int entryIndex = (int) highlight.getX(); // offset needed to center the drawn text in the slice float offset = mDrawAngles[entryIndex] / 2; // calculate the text position float x = (float) (r * Math.cos(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset) * mAnimator.getPhaseY())) + center.x); float y = (float) (r * Math.sin(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset) * mAnimator.getPhaseY())) + center.y); MPPointF.recycleInstance(center); return new float[]{x, y}; }
@Override protected float[] getMarkerPosition(Highlight highlight) { MPPointF center = getCenterCircleBox(); float r = getRadius(); float off = r / 10f * 3.6f; if (isDrawHoleEnabled()) { off = (r - (r / 100f * getHoleRadius())) / 2f; } r -= off; // offset to keep things inside the chart float rotationAngle = getRotationAngle(); int entryIndex = (int) highlight.getX(); // offset needed to center the drawn text in the slice float offset = mDrawAngles[entryIndex] / 2; // calculate the text position float x = (float) (r * Math.cos(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset) * mAnimator.getPhaseY())) + center.x); float y = (float) (r * Math.sin(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset) * mAnimator.getPhaseY())) + center.y); MPPointF.recycleInstance(center); return new float[]{x, y}; }
@Override protected float[] getMarkerPosition(Highlight highlight) { MPPointF center = getCenterCircleBox(); float r = getRadius(); float off = r / 10f * 3.6f; if (isDrawHoleEnabled()) { off = (r - (r / 100f * getHoleRadius())) / 2f; } r -= off; // offset to keep things inside the chart float rotationAngle = getRotationAngle(); int entryIndex = (int) highlight.getX(); // offset needed to center the drawn text in the slice float offset = mDrawAngles[entryIndex] / 2; // calculate the text position float x = (float) (r * Math.cos(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset) * mAnimator.getPhaseY())) + center.x); float y = (float) (r * Math.sin(Math.toRadians((rotationAngle + mAbsoluteAngles[entryIndex] - offset) * mAnimator.getPhaseY())) + center.y); MPPointF.recycleInstance(center); return new float[]{x, y}; }
float angle = mChart.getRotationAngle();
float angle = mChart.getRotationAngle();
float angle = mChart.getRotationAngle();
float angle = mChart.getRotationAngle();