Search in sources :

Example 11 with EChartPanel

use of net.sf.mzmine.chartbasics.gui.swing.EChartPanel in project mzmine2 by mzmine.

the class KendrickMassPlotTask method run.

@Override
public void run() {
    setStatus(TaskStatus.PROCESSING);
    logger.info("Create Kendrick mass plot of " + peakList);
    // Task canceled?
    if (isCanceled())
        return;
    JFreeChart chart = null;
    // 2D, if no third dimension was selected
    if (zAxisLabel.equals("none")) {
        chart = create2DKendrickMassPlot();
    } else // 3D, if a third dimension was selected
    {
        chart = create3DKendrickMassPlot();
    }
    chart.setBackgroundPaint(Color.white);
    // create chart JPanel
    EChartPanel chartPanel = new EChartPanel(chart, true, true, true, true, false);
    // Create Kendrick mass plot Window
    KendrickMassPlotWindow frame = new KendrickMassPlotWindow(chart, parameters, chartPanel);
    frame.add(chartPanel, BorderLayout.CENTER);
    // set title properties
    TextTitle chartTitle = chart.getTitle();
    chartTitle.setMargin(5, 0, 0, 0);
    chartTitle.setFont(titleFont);
    LegendTitle legend = chart.getLegend();
    legend.setVisible(false);
    frame.setTitle(title);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setBackground(Color.white);
    frame.setVisible(true);
    frame.pack();
    setStatus(TaskStatus.FINISHED);
    logger.info("Finished creating Kendrick mass plot of " + peakList);
}
Also used : TextTitle(org.jfree.chart.title.TextTitle) EChartPanel(net.sf.mzmine.chartbasics.gui.swing.EChartPanel) LegendTitle(org.jfree.chart.title.LegendTitle) JFreeChart(org.jfree.chart.JFreeChart)

Aggregations

EChartPanel (net.sf.mzmine.chartbasics.gui.swing.EChartPanel)11 JFreeChart (org.jfree.chart.JFreeChart)6 Dimension (java.awt.Dimension)3 BorderLayout (java.awt.BorderLayout)2 DecimalFormat (java.text.DecimalFormat)2 JButton (javax.swing.JButton)2 ChartGroup (net.sf.mzmine.chartbasics.chartgroups.ChartGroup)2 ChartViewWrapper (net.sf.mzmine.chartbasics.gui.wrapper.ChartViewWrapper)2 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)2 Scan (net.sf.mzmine.datamodel.Scan)2 XYItemRenderer (org.jfree.chart.renderer.xy.XYItemRenderer)2 LegendTitle (org.jfree.chart.title.LegendTitle)2 TextTitle (org.jfree.chart.title.TextTitle)2 XYSeries (org.jfree.data.xy.XYSeries)2 XYSeriesCollection (org.jfree.data.xy.XYSeriesCollection)2 Color (java.awt.Color)1 FlowLayout (java.awt.FlowLayout)1 Font (java.awt.Font)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridLayout (java.awt.GridLayout)1