org.jfree.data.xy.AbstractXYZDataset Java Examples

The following examples show how to use org.jfree.data.xy.AbstractXYZDataset. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LogratioPlotModule.java    From mzmine3 with GNU General Public License v2.0 6 votes vote down vote up
@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.show();

  }

  return ExitCode.OK;
}
 
Example #2
Source File: LogratioPlotModule.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #3
Source File: RTMZAnalyzerWindow.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
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();

}
 
Example #4
Source File: CVPlotModule.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
@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.show();

  }

  return ExitCode.OK;

}
 
Example #5
Source File: RTMZRenderer.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
public RTMZRenderer(AbstractXYZDataset dataset, PaintScale paintScale) {
  super(false, true);
  this.dataset = dataset;
  this.paintScale = paintScale;
  this.setSeriesShape(0, dataPointsShape);

  setDrawSeriesLineAsPath(true);
}
 
Example #6
Source File: CVPlotModule.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
@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;

}
 
Example #7
Source File: RTMZRenderer.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
public RTMZRenderer(AbstractXYZDataset dataset, PaintScale paintScale) {
  super(false, true);
  this.dataset = dataset;
  this.paintScale = paintScale;
  this.setSeriesShape(0, dataPointsShape);

  setDrawSeriesLineAsPath(true);
}
 
Example #8
Source File: RTMZPlot.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
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);

  // reset zoom history
  ZoomHistory history = getZoomHistory();
  if (history != null)
    history.clear();
}
 
Example #9
Source File: RTMZAnalyzerWindow.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
public RTMZAnalyzerWindow(AbstractXYZDataset dataset, PeakList peakList,
    InterpolatingLookupPaintScale paintScale) {

  mainPane = new BorderPane();
  mainScene = new Scene(mainPane);

  // Use main CSS
  mainScene.getStylesheets()
      .addAll(MZmineCore.getDesktop().getMainWindow().getScene().getStylesheets());
  setScene(mainScene);

  setMinWidth(600.0);
  setMinHeight(500.0);

  toolbar = new ToolBar();
  toolbar.setOrientation(Orientation.VERTICAL);
  Button axesButton = new Button(null, new ImageView(axesIcon));
  axesButton.setTooltip(new Tooltip("Setup ranges for axes"));
  Button colorButton = new Button(null, new ImageView(colorbarIcon));
  colorButton.setTooltip(new Tooltip("Setup color palette"));
  toolbar.getItems().addAll(axesButton, colorButton);
  mainPane.setRight(toolbar);

  plot = new RTMZPlot(this, dataset, paintScale);
  mainPane.setCenter(plot);

  axesButton.setOnAction(e -> {
    AxesSetupDialog dialog = new AxesSetupDialog(this, plot.getChart().getXYPlot());
    dialog.showAndWait();
  });

  colorButton.setOnAction(e -> {
      Platform.runLater(new Runnable() {
        @Override
        public void run() {
          InterpolatingLookupPaintScaleSetupDialogFX colorDialog =
                  new InterpolatingLookupPaintScaleSetupDialogFX(plot.getPaintScale());
          colorDialog.showAndWait();

          if (colorDialog.getExitCode() == ExitCode.OK)
            plot.setPaintScale(colorDialog.getPaintScale());
        }
      });

    });

  String title = peakList.getName();
  title = title.concat(" : ");
  title = title.concat(dataset.toString());
  this.setTitle(title);

  // Add the Windows menu
  WindowsMenu.addWindowsMenu(mainScene);

}
 
Example #10
Source File: RTMZPlot.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
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);


  // reset zoom history
  ZoomHistory history = getZoomHistory();
  if (history != null)
    history.clear();
}