use of net.sf.mzmine.modules.visualization.tic.TICSumDataSet in project mzmine2 by mzmine.
the class KovatsIndexExtractionDialog method updateChart.
private void updateChart() {
updateParameterSetFromComponents();
if (selectedDataFile == null)
return;
try {
// old charts axes ranges
org.jfree.data.Range domainZoom = chart == null ? null : chart.getChart().getXYPlot().getDomainAxis().getRange();
org.jfree.data.Range rangeZoom = chart == null ? null : chart.getChart().getXYPlot().getRangeAxis().getRange();
Range<Double> rangeMZ = parameterSet.getParameter(KovatsIndexExtractionParameters.mzRange).getValue();
Range<Double> rangeRT = parameterSet.getParameter(KovatsIndexExtractionParameters.rtRange).getValue();
if (rangeMZ == null) {
// set range to specific alkane fragment
rangeMZ = Range.closed(56.6, 57.5);
((MZRangeComponent) getComponentForParameter(KovatsIndexExtractionParameters.mzRange)).setValue(rangeMZ);
}
if (rangeRT == null) {
rangeRT = selectedDataFile[0].getDataRTRange();
((RTRangeComponent) getComponentForParameter(KovatsIndexExtractionParameters.rtRange)).setValue(rangeRT);
}
// create dataset
TICSumDataSet data = new TICSumDataSet(selectedDataFile, rangeRT, rangeMZ, null, TICPlotType.BASEPEAK);
chart = new TICPlot(this);
chart.addTICDataset(data);
if (domainZoom != null)
chart.getChart().getXYPlot().getDomainAxis().setRange(domainZoom);
if (rangeZoom != null)
chart.getChart().getXYPlot().getRangeAxis().setRange(rangeZoom);
// add control for markers
chart.getGestureAdapter().addGestureHandler(new ChartGestureDragDiffHandler(Entity.PLOT, Button.BUTTON1, new Key[] { Key.NONE }, e -> handleMarkerDrag(e)));
chart.getGestureAdapter().addGestureHandler(new ChartGestureHandler(new ChartGesture(Entity.PLOT, Event.RELEASED), e -> {
if (chart != null)
chart.setMouseZoomable(true);
if (currentlyDraggedMarker != null) {
// set value of current marker
logger.info("Marker dragging ended at " + currentlyDraggedMarker.getValue());
int index = markers.indexOf(currentlyDraggedMarker);
double value = e.getCoordinates().getX();
setValue(index, value);
//
currentlyDraggedMarker = null;
}
}));
kovatsValuesChanged();
pnChart.removeAll();
pnChart.add(chart, BorderLayout.CENTER);
revalidate();
repaint();
} catch (Exception e) {
logger.log(Level.WARNING, "Peak picking parameters incorrect");
}
}
Aggregations