*
* @param index the index of the label
* @return the label at the index
*/
private TextSprite getOrCreateLabel(int index) {
final TextSprite textLabel;
// Re-use existing textLabel or create a new one
if (index < labels.size()) {
textLabel = labels.get(index);
} else {
textLabel = labelConfig.copy();
labels.add(textLabel);
chart.addSprite(textLabel);
}
textLabel.setX(0);
textLabel.setY(0);
textLabel.setText(labelProvider.getLabel(labelNames.get(index * labelStepRatio)));
return textLabel;
}