createOrUpdateSegments method
void
createOrUpdateSegments(
)
Implementation
@protected
void createOrUpdateSegments() {
if (dataCount == 0) {
segments.clear();
return;
}
final int segmentsCount = segments.length;
if (segmentsCount == dataCount) {
for (int i = 0; i < segmentsCount; i++) {
final ChartSegment segment = segments[i];
setData(i, segment);
}
} else if (segmentsCount > dataCount) {
_segments = segments.sublist(0, dataCount);
for (int i = 0; i < dataCount; i++) {
final ChartSegment segment = segments[i];
setData(i, segment);
}
} else {
for (int i = 0; i < segmentsCount; i++) {
final ChartSegment segment = segments[i];
setData(i, segment);
}
for (int i = segmentsCount; i < dataCount; i++) {
final ChartSegment segment = createSegment();
setData(i, segment);
segments.add(segment);
}
}
_calculateEffectiveSelectedIndexes();
}