use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.
the class ScanSelectPanel method applySelectionState.
private void applySelectionState() {
boolean selected = btnToggleUse.isSelected();
EChartPanel chart = getChart();
if (chart != null) {
chart.getChart().getXYPlot().setBackgroundPaint(selected ? Color.WHITE : errorColor);
}
}
use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.
the class IsotopePeakScannerSetupDialog method addDialogComponents.
@Override
protected void addDialogComponents() {
super.addDialogComponents();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
pnlChart = new EChartPanel(chart);
pnlChart.setPreferredSize(new Dimension((int) (screenSize.getWidth() / 3), (int) (screenSize.getHeight() / 3)));
pnlPreview.add(pnlChart, BorderLayout.CENTER);
// get components
cmpAutoCarbon = (OptionalModuleComponent) this.getComponentForParameter(IsotopePeakScannerParameters.autoCarbonOpt);
cmpAutoCarbonCbx = (JCheckBox) cmpAutoCarbon.getComponent(0);
cmpPreview = (JCheckBox) this.getComponentForParameter(IsotopePeakScannerParameters.showPreview);
// i want to have the checkbox below the pattern settings
cmpPreview.setSelected(false);
// but it should be disabled by default. Thats why it's hardcoded here.
// get parameters
pElement = parameterSet.getParameter(IsotopePeakScannerParameters.element);
pMinIntensity = parameterSet.getParameter(IsotopePeakScannerParameters.minPatternIntensity);
pCharge = parameterSet.getParameter(IsotopePeakScannerParameters.charge);
pMergeWidth = parameterSet.getParameter(IsotopePeakScannerParameters.mergeWidth);
pAutoCarbon = parameterSet.getParameter(IsotopePeakScannerParameters.autoCarbonOpt);
autoCarbonParameters = pAutoCarbon.getEmbeddedParameters();
pMinC = autoCarbonParameters.getParameter(AutoCarbonParameters.minCarbon);
pMaxC = autoCarbonParameters.getParameter(AutoCarbonParameters.maxCarbon);
pMinSize = autoCarbonParameters.getParameter(AutoCarbonParameters.minPatternSize);
// set up gui
form = new NumberFormatter(NumberFormat.getInstance());
form.setValueClass(Integer.class);
form.setFormat(new DecimalFormat("0"));
form.setAllowsInvalid(true);
form.setMinimum(minC);
form.setMaximum(maxC);
btnPrevPattern = new JButton("Previous");
btnPrevPattern.addActionListener(this);
btnPrevPattern.setMinimumSize(btnPrevPattern.getPreferredSize());
btnPrevPattern.setEnabled(cmpAutoCarbonCbx.isSelected());
txtCurrentPatternIndex = new JFormattedTextField(form);
txtCurrentPatternIndex.addActionListener(this);
txtCurrentPatternIndex.setText(String.valueOf((minC + maxC) / 2));
txtCurrentPatternIndex.setPreferredSize(new Dimension(50, 25));
txtCurrentPatternIndex.setEditable(true);
txtCurrentPatternIndex.setEnabled(cmpAutoCarbonCbx.isSelected());
btnNextPattern = new JButton("Next");
btnNextPattern.addActionListener(this);
btnNextPattern.setPreferredSize(btnNextPattern.getMinimumSize());
btnNextPattern.setEnabled(cmpAutoCarbonCbx.isSelected());
chart = ChartFactory.createXYBarChart("Isotope pattern preview", "m/z", false, "Abundance", new XYSeriesCollection(new XYSeries("")));
chart.getPlot().setBackgroundPaint(Color.WHITE);
chart.getXYPlot().setDomainGridlinePaint(Color.GRAY);
chart.getXYPlot().setRangeGridlinePaint(Color.GRAY);
pnlPreviewButtons.add(btnPrevPattern);
pnlPreviewButtons.add(txtCurrentPatternIndex);
pnlPreviewButtons.add(btnNextPattern);
pack();
}
use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.
the class SpectrumChartFactory method createMirrorChartPanel.
public static EChartPanel createMirrorChartPanel(String labelA, double precursorMZA, double rtA, DataPoint[] dpsA, String labelB, double precursorMZB, double rtB, DataPoint[] dpsB, boolean showTitle, boolean showLegend) {
PseudoSpectrumDataSet data = dpsA == null ? null : createMSMSDataSet(precursorMZA, rtA, dpsA, labelA);
PseudoSpectrumDataSet dataMirror = dpsB == null ? null : createMSMSDataSet(precursorMZB, rtB, dpsB, labelB);
NumberFormat mzForm = MZmineCore.getConfiguration().getMZFormat();
NumberFormat intensityFormat = new DecimalFormat("0.#");
// set the X axis (retention time) properties
NumberAxis xAxis = new NumberAxis("m/z");
xAxis.setNumberFormatOverride(mzForm);
xAxis.setUpperMargin(0.08);
xAxis.setLowerMargin(0.00);
xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20));
xAxis.setAutoRangeIncludesZero(false);
xAxis.setMinorTickCount(5);
PseudoSpectraRenderer renderer1 = new PseudoSpectraRenderer(Color.BLACK, false);
PseudoSpectraRenderer renderer2 = new PseudoSpectraRenderer(Color.BLACK, false);
// create subplot 1...
final NumberAxis rangeAxis1 = new NumberAxis("rel. intensity [%]");
final XYPlot subplot1 = new XYPlot(data, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
rangeAxis1.setNumberFormatOverride(intensityFormat);
rangeAxis1.setAutoRangeIncludesZero(true);
rangeAxis1.setAutoRangeStickyZero(true);
// create subplot 2...
final NumberAxis rangeAxis2 = new NumberAxis("rel. intensity [%]");
rangeAxis2.setNumberFormatOverride(intensityFormat);
rangeAxis2.setAutoRangeIncludesZero(true);
rangeAxis2.setAutoRangeStickyZero(true);
rangeAxis2.setInverted(true);
final XYPlot subplot2 = new XYPlot(dataMirror, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
plot.setGap(0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
// set the plot properties
plot.setBackgroundPaint(Color.white);
plot.setAxisOffset(RectangleInsets.ZERO_INSETS);
// set rendering order
plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
// set crosshair (selection) properties
plot.setDomainCrosshairVisible(false);
plot.setRangeCrosshairVisible(false);
// return a new chart containing the overlaid plot...
JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
chart.setBackgroundPaint(Color.white);
chart.getTitle().setVisible(false);
// chart.getXYPlot().setRangeZeroBaselineVisible(true);
chart.getTitle().setVisible(showTitle);
chart.getLegend().setVisible(showLegend);
return new EChartPanel(chart);
}
use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.
the class IsotopePatternPreviewDialog method addDialogComponents.
@Override
protected void addDialogComponents() {
super.addDialogComponents();
pFormula = parameterSet.getParameter(IsotopePatternPreviewParameters.formula);
pMinIntensity = parameterSet.getParameter(IsotopePatternPreviewParameters.minIntensity);
pMergeWidth = parameterSet.getParameter(IsotopePatternPreviewParameters.mergeWidth);
pCharge = parameterSet.getParameter(IsotopePatternPreviewParameters.charge);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
cmpMinIntensity = (PercentComponent) getComponentForParameter(IsotopePatternPreviewParameters.minIntensity);
cmpMergeWidth = (DoubleComponent) getComponentForParameter(IsotopePatternPreviewParameters.mergeWidth);
cmpCharge = (IntegerComponent) getComponentForParameter(IsotopePatternPreviewParameters.charge);
cmpFormula = (StringComponent) getComponentForParameter(IsotopePatternPreviewParameters.formula);
// panels
newMainPanel = new JPanel(new BorderLayout());
pnText = new JScrollPane();
pnlChart = new EChartPanel(chart);
pnSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, pnlChart, pnText);
table = new JTable();
pnlParameters = new JPanel(new FlowLayout());
pnlControl = new JPanel(new BorderLayout());
pnText.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
pnText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
pnText.setMinimumSize(new Dimension(350, 300));
pnlChart.setMinimumSize(new Dimension(350, 200));
// TODO: can you do this cleaner?
pnlChart.setPreferredSize(new Dimension((int) (screenSize.getWidth() / 3), (int) (screenSize.getHeight() / 3)));
table.setMinimumSize(new Dimension(350, 300));
table.setDefaultEditor(Object.class, null);
// controls
ttGen = new SpectraToolTipGenerator();
theme = new EIsotopePatternChartTheme();
theme.initialize();
// reorganize
getContentPane().remove(mainPanel);
organizeParameterPanel();
pnlControl.add(pnlParameters, BorderLayout.CENTER);
pnlControl.add(pnlButtons, BorderLayout.SOUTH);
newMainPanel.add(pnSplit, BorderLayout.CENTER);
newMainPanel.add(pnlControl, BorderLayout.SOUTH);
getContentPane().add(newMainPanel);
pnlButtons.remove(super.btnCancel);
chart = ChartFactory.createXYBarChart("Isotope pattern preview", "m/z", false, "Abundance", new XYSeriesCollection(new XYSeries("")));
pnlChart.setChart(chart);
pnText.setViewportView(table);
updateMinimumSize();
pack();
}
use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.
the class GraphicsExportDialog method openDialogI.
protected void openDialogI(JFreeChart chart) {
try {
// create new chart to decouple from original chart
JFreeChart copy = chart;
try {
copy = (JFreeChart) chart.clone();
} catch (Exception e) {
LOG.log(Level.WARNING, "Chart cannot be cloned", e);
}
addChartToPanel(new EChartPanel(copy), true);
setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations