public DataSet buildXYDataSet() {
DataProperty domainProperty = getDomainProperty();
DataProperty rangeProperty = getRangeProperty();
ScalarFunction scalarFunction = getRangeScalarFunction();
DataSet sourceDataSet = domainProperty.getDataSet();
CodeBlockTrace trace = new BuildXYDataSetTrace(domainProperty, rangeProperty, scalarFunction).begin();
try {
if (domainProperty == null || domainProperty.getDomain() == null) return null;
if (rangeProperty == null || scalarFunction == null) return null;
// Group the original data set by the domain property.
int pivot = sourceDataSet.getPropertyColumn(domainProperty);
int range = sourceDataSet.getPropertyColumn(rangeProperty);
int[] columns = new int[] {pivot, range};
String[] functionCodes = new String[] {CountFunction.CODE, scalarFunction.getCode()};
return sourceDataSet.groupBy(domainProperty, columns, functionCodes, intervalsSortCriteria, intervalsSortOrder);
} finally {
trace.end();
}
}