@Override @Nonnull public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) { PeakList peakLists[] = parameters.getParameter(CVParameters.peakLists) .getValue().getMatchingPeakLists(); for (PeakList pl : peakLists) { // Create dataset & paint scale AbstractXYZDataset dataset = new LogratioDataset(pl, parameters); InterpolatingLookupPaintScale paintScale = new InterpolatingLookupPaintScale(); paintScale.add(-1.00, new Color(0, 255, 0)); paintScale.add(0.00, new Color(0, 0, 0)); paintScale.add(1.00, new Color(255, 0, 0)); // Create & show window RTMZAnalyzerWindow window = new RTMZAnalyzerWindow(dataset, pl, paintScale); window.setVisible(true); } return ExitCode.OK; }
public RTMZAnalyzerWindow(AbstractXYZDataset dataset, PeakList peakList, InterpolatingLookupPaintScale paintScale) { super(""); toolbar = new RTMZToolbar(this); add(toolbar, BorderLayout.EAST); plot = new RTMZPlot(this, dataset, paintScale); add(plot, BorderLayout.CENTER); String title = peakList.getName(); title = title.concat(" : "); title = title.concat(dataset.toString()); this.setTitle(title); pack(); }
@Override @Nonnull public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) { PeakList peakLists[] = parameters.getParameter(CVParameters.peakLists) .getValue().getMatchingPeakLists(); for (PeakList pl : peakLists) { // Create dataset & paint scale AbstractXYZDataset dataset = new CVDataset(pl, parameters); InterpolatingLookupPaintScale paintScale = new InterpolatingLookupPaintScale(); paintScale.add(0.00, new Color(0, 0, 0)); paintScale.add(0.15, new Color(102, 255, 102)); paintScale.add(0.30, new Color(51, 102, 255)); paintScale.add(0.45, new Color(255, 0, 0)); // Create & show window RTMZAnalyzerWindow window = new RTMZAnalyzerWindow(dataset, pl, paintScale); window.setVisible(true); } return ExitCode.OK; }
public RTMZRenderer(AbstractXYZDataset dataset, PaintScale paintScale) { super(false, true); this.dataset = dataset; this.paintScale = paintScale; this.setSeriesShape(0, dataPointsShape); setDrawSeriesLineAsPath(true); }
public RTMZPlot(RTMZAnalyzerWindow masterFrame, AbstractXYZDataset dataset, InterpolatingLookupPaintScale paintScale) { super(null); this.paintScale = paintScale; chart = ChartFactory.createXYAreaChart("", "Retention time", "m/z", dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.white); setChart(chart); // title TextTitle chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chart.removeSubtitle(chartTitle); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); NumberFormat rtFormat = MZmineCore.getConfiguration().getRTFormat(); NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setNumberFormatOverride(rtFormat); xAxis.setUpperMargin(0.001); xAxis.setLowerMargin(0.001); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setAutoRangeIncludesZero(false); yAxis.setNumberFormatOverride(mzFormat); plot.setDataset(dataset); spotRenderer = new RTMZRenderer(dataset, paintScale); plot.setRenderer(spotRenderer); spotRenderer.setDefaultToolTipGenerator(new RTMZToolTipGenerator()); // Add a paintScaleLegend to chart paintScaleAxis = new NumberAxis("Logratio"); paintScaleAxis.setRange(paintScale.getLowerBound(), paintScale.getUpperBound()); paintScaleLegend = new PaintScaleLegend(paintScale, paintScaleAxis); paintScaleLegend.setPosition(plot.getDomainAxisEdge()); paintScaleLegend.setMargin(5, 25, 5, 25); chart.addSubtitle(paintScaleLegend); }