getIndexForAngle method
Returns the xIndex for the given angle around the center of the chart. Returns -1 if not found / outofbounds.
@param angle @return
Implementation
@override
int getIndexForAngle(double angle) {
// take the current angle of the chart into consideration
double a = Utils.getNormalizedAngle(angle - getRotationAngle());
double sliceAngle = getSliceAngle();
int max = getData()!.getMaxEntryCountSet()!.getEntryCount();
int index = 0;
for (int i = 0; i < max; i++) {
double referenceAngle = sliceAngle * (i + 1) - sliceAngle / 2;
if (referenceAngle > a) {
index = i;
break;
}
}
return index;
}