// get canvas size
Dimension size = getSize();
// get scan numbers, one data point per each scan
RawDataFile dataFile = peak.getDataFile();
int scanNumbers[] = peak.getScanNumbers();
// If we have no data, just return
if (scanNumbers.length == 0)
return;
// for each datapoint, find [X:Y] coordinates of its point in painted
// image
int xValues[] = new int[scanNumbers.length];
int yValues[] = new int[scanNumbers.length];
// find one datapoint with maximum intensity in each scan
for (int i = 0; i < scanNumbers.length; i++) {
double dataPointIntensity = 0;
DataPoint dataPoint = peak.getDataPoint(scanNumbers[i]);
if (dataPoint != null)
dataPointIntensity = dataPoint.getIntensity();
// get retention time (X value)
double retentionTime = dataFile.getScan(scanNumbers[i])
.getRetentionTime();
// calculate [X:Y] coordinates
xValues[i] = (int) Math.floor((retentionTime - rtRange.getMin())
/ rtRange.getSize() * (size.width - 1));