final Object o = getDatasourceValue();
if (!(o instanceof TimeSeriesCollection))
{
return;
}
final TimeSeriesCollection timeSeriesDataset = (TimeSeriesCollection) o;
final int maxIndex = Math.min(getSeriesNameCount(), Math.min (this.valueColumns.size(), timeValueColumns.size()));
for (int i = 0; i < maxIndex; i++)
{
String seriesName = getSeriesName(i);
final String column = (String) valueColumns.get(i);
final Object valueObject = getDataRow().get(column);
final String timeColumn = (String) timeValueColumns.get(i);
final Object timeValueObject = getDataRow().get(timeColumn);
if (isSeriesColumn())
{
final Object tmp = getDataRow().get(seriesName);
if (tmp != null)
{
seriesName = tmp.toString();
}
}
final Number value = (valueObject instanceof Number) ? (Number) valueObject : null;
final Date timeValue;
if (timeValueObject instanceof Date)
{
timeValue = (Date) timeValueObject;
}
else
{
timeValue = new Date();
}
TimeSeries series = null;
try
{
series = timeSeriesDataset.getSeries(seriesName);
}
catch (Exception ignored)
{
}
final Class timePeriodClass = getTimePeriodClass(getDomainPeriodType());
if (series == null)
{
series = new TimeSeries(seriesName, timePeriodClass);
timeSeriesDataset.addSeries(series);
}
final RegularTimePeriod regularTimePeriod =
RegularTimePeriod.createInstance(timePeriodClass, timeValue, TimeZone.getDefault());
final TimeSeriesDataItem timeSeriesDataItem = new TimeSeriesDataItem(regularTimePeriod, value);