Set<String> localRangeAxisIds = new HashSet<String>();
RangeAxisPanel axisPanel = null;
for (int i = 0; i < datasets.size(); i++) {
Dataset dataset = datasets.get(i);
final String rangeAxisId = dataset.getAxisId(0);
RangeAxis rangeAxis = id2rangeAxis.get(rangeAxisId);
// Determine if the rangeAxis should be added to the left or right range panel
int numLeftAxes = leftPanel.getChildCount();
int numRightAxes = rightPanel.getChildCount();
boolean useLeftPanel = (numLeftAxes <= numRightAxes);
CompositeAxisPanel compositePanel = useLeftPanel || !plot.isMultiaxis() ? leftPanel : rightPanel;
if (rangeAxis == null) {
rangeAxis = new RangeAxis(dataset.getRangeLabel(), rangeAxisId);
rangeAxis.setPlot(plot);
rangeAxis.setView(view);
rangeAxis.setAxisIndex(i);
id2rangeAxis.put(rangeAxisId, rangeAxis);
}