XYSeries series = null;
XYSeriesCollection seriesCollection = new XYSeriesCollection();
for (int i = 0; i < values.length; i++)
{
XYChartValue value = (XYChartValue) values[i];
if (series == null || !series.getKey().equals(value.getSeries()))
{
if (series != null)
{
seriesCollection.addSeries(series);
}
series = new XYSeries(value.getSeries());
}
series.add(value.getValue(), value.getYValue());
}
if (series != null) seriesCollection.addSeries(series);
return seriesCollection;