}
protected void buildDataset()
{
final XYSeriesCollection xySeriesDataset = (XYSeriesCollection) getDatasourceValue();
final List seriesList = xySeriesDataset.getSeries();
final HashMap seriesMap = new HashMap();
for (int i = 0; i < seriesList.size(); i++)
{
final XYSeries series = (XYSeries) seriesList.get(i);
seriesMap.put(series.getKey(), series);
}
final String[] seriesNames = getSeriesName();
final int maxIndex = Math.min(seriesNames.length, Math.min (this.xValueColumns.size(), this.yValueColumns.size()));
for (int i = 0; i < maxIndex; i++)
{
String seriesName = seriesNames[i];
final String xColumn = (String) xValueColumns.get(i);
final String yColumn = (String) yValueColumns.get(i);
final Object xValueObject = getDataRow().get(xColumn);
final Object yValueObject = getDataRow().get(yColumn);
if (isSeriesColumn())
{
final Object tmp = getDataRow().get(seriesName);
if (tmp != null)
{
seriesName = tmp.toString();
}
}
if (xValueObject instanceof Number == false)
{
continue;
}
final Number xValue = (Number) xValueObject;
final Number yValue = (yValueObject instanceof Number) ? (Number) yValueObject : null;
XYSeries series = (XYSeries) seriesMap.get(seriesName);
if (series == null)
{
series = new XYSeries(seriesName);
xySeriesDataset.addSeries(series);
seriesMap.put (seriesName, series);
}
series.add(xValue, yValue);
}
}