Example usage for org.jfree.chart ContextAwareChartPanel ContextAwareChartPanel

List of usage examples for org.jfree.chart ContextAwareChartPanel ContextAwareChartPanel

Introduction

In this page you can find the example usage for org.jfree.chart ContextAwareChartPanel ContextAwareChartPanel.

Prototype

public ContextAwareChartPanel(JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom,
        boolean tooltips) 

Source Link

Usage

From source file:net.sf.maltcms.chromaui.foldChangeViewer.ui.panel.FoldChangeViewPanel.java

/**
 * Creates new form Chromatogram1DViewPanel
 *//*from   ww  w  .j  a v  a2 s  . com*/
public FoldChangeViewPanel(InstanceContent topComponentInstanceContent, Lookup tcLookup,
        ADataset1D<StatisticsContainer, FoldChangeElement> ds) {
    initComponents();
    this.content = topComponentInstanceContent;
    this.lookup = tcLookup;
    chart = new JFreeChart(new XYPlot());
    chartPanel = new ContextAwareChartPanel(chart, true, true, true, true, true);
    Cursor crosshairCursor = new Cursor(Cursor.CROSSHAIR_CURSOR);
    chartPanel.setCursor(crosshairCursor);
    chartPanel.setInitialDelay(100);
    chartPanel.setDismissDelay(30000);
    chartPanel.setReshowDelay(0);
    chartPanel.setFocusable(true);
    chartPanel.setMouseWheelEnabled(true);
    add(chartPanel, BorderLayout.CENTER);
    content.add(chartPanel);
}

From source file:net.sf.maltcms.chromaui.chromatogram1Dviewer.ui.panel.Chromatogram1DViewPanel.java

/**
 * Creates new form Chromatogram1DViewPanel
 *///from  w  ww  .j av  a  2  s .  co m
public Chromatogram1DViewPanel(InstanceContent topComponentInstanceContent, Lookup tcLookup,
        ADataset1D<IChromatogram1D, IScan> ds) {
    initComponents();
    this.content = topComponentInstanceContent;
    this.lookup = tcLookup;
    chart = new JFreeChart(new XYPlot());
    ContextAwareChartPanel chartPanel = new ContextAwareChartPanel(chart, true, true, true, true, true);
    Cursor crosshairCursor = new Cursor(Cursor.CROSSHAIR_CURSOR);
    chartPanel.setCursor(crosshairCursor);
    chartPanel.setInitialDelay(100);
    chartPanel.setDismissDelay(30000);
    chartPanel.setReshowDelay(0);
    chartPanel.setFocusable(true);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPopupMenuActionProvider(new ActionProvider());
    addKeyListener(this);
    this.chartPanel = chartPanel;
    add(chartPanel, BorderLayout.CENTER);
    content.add(chartPanel);
}

From source file:net.sf.maltcms.chromaui.chromatogram2Dviewer.ui.panel.Chromatogram2DViewerPanel.java

/**
 * Creates new form Chromatogram2DViewerPanel
 *///from  w ww  . j a va 2s. c  o m
public Chromatogram2DViewerPanel(InstanceContent topComponentInstanceContent, Lookup tcLookup,
        ADataset2D<IChromatogram2D, IScan2D> ds, PaintScale ps) {
    initComponents();
    this.content = topComponentInstanceContent;
    this.lookup = tcLookup;
    chart = new JFreeChart(new XYPlot());
    chartPanel = new ContextAwareChartPanel(chart, true, true, true, true, true);
    Cursor crosshairCursor = new Cursor(Cursor.CROSSHAIR_CURSOR);
    chartPanel.setCursor(crosshairCursor);
    //        chart.addProgressListener(cdxpanel);
    chartPanel.setInitialDelay(100);
    chartPanel.setDismissDelay(30000);
    chartPanel.setReshowDelay(0);
    chartPanel.setFocusable(true);
    jPanel2.add(chartPanel, BorderLayout.CENTER);
    content.add(chartPanel);
    addKeyListener(this);
    setPaintScale(ps);
}

From source file:net.sf.maltcms.chromaui.chromatogram1Dviewer.ui.panel.Chromatogram1DHeatmapViewerPanel.java

/**
 * Creates new form Chromatogram2DViewerPanel
 *///w ww . j a va 2  s.  c om
public Chromatogram1DHeatmapViewerPanel(InstanceContent topComponentInstanceContent, Lookup tcLookup,
        ADataset2D<IChromatogram1D, IScan> ds) {
    initComponents();
    this.content = topComponentInstanceContent;
    this.lookup = tcLookup;
    chart = new JFreeChart(new XYPlot());
    chartPanel = new ContextAwareChartPanel(chart, true, true, true, true, true);
    Cursor crosshairCursor = new Cursor(Cursor.CROSSHAIR_CURSOR);
    chartPanel.setCursor(crosshairCursor);
    //        chart.addProgressListener(cdxpanel);
    chartPanel.setInitialDelay(100);
    chartPanel.setDismissDelay(30000);
    chartPanel.setReshowDelay(0);
    chartPanel.setFocusable(true);
    jPanel2.add(chartPanel, BorderLayout.CENTER);
    content.add(chartPanel);
    addKeyListener(this);
    dataRange = DatasetUtilities.findDomainBounds(ds);
}

From source file:net.sf.maltcms.chromaui.msviewer.ui.panel.MassSpectrumPanel.java

private void initChartComponents() {

    this.sc = new XYSeriesCollection();
    barDataset = new XYBarDataset(sc, barWidth);
    XYBarRenderer renderer = new XYBarRenderer(0.1d);
    StandardXYBarPainter sp = new StandardXYBarPainter();
    renderer.setBarPainter(sp);/*from   w w w .  j  av  a 2s  . c  o m*/
    renderer.setShadowVisible(false);
    renderer.setDrawBarOutline(false);
    NumberAxis intensityAxis = new NumberAxis("intensity");
    intensityAxis.setNumberFormatOverride(defaultNumberFormat);
    intensityAxis.setUpperMargin(0.10d);
    NumberAxis mzAxis = new NumberAxis("m/z");
    mzAxis.setAutoRangeIncludesZero(false);
    this.plot = new XYPlot(barDataset, mzAxis, intensityAxis, renderer);
    this.plot.setForegroundAlpha(0.85f);

    plot.setDomainCrosshairLockedOnData(true);
    plot.setDomainCrosshairVisible(true);
    ((XYBarRenderer) plot.getRenderer()).setShadowVisible(false);
    ((XYBarRenderer) plot.getRenderer()).setDrawBarOutline(false);
    ((XYBarRenderer) plot.getRenderer()).setBaseFillPaint(Color.RED);
    ((XYBarRenderer) plot.getRenderer()).setBarPainter(new StandardXYBarPainter());
    plot.getRenderer().setBaseItemLabelsVisible(true);
    plot.getRenderer().setBaseToolTipGenerator(new XYToolTipGenerator() {
        @Override
        public String generateToolTip(XYDataset xyd, int i, int i1) {
            Comparable comp = xyd.getSeriesKey(i);
            double x = xyd.getXValue(i, i1);
            double y = xyd.getYValue(i, i1);
            StringBuilder sb = new StringBuilder();
            sb.append(comp);
            sb.append(": ");
            sb.append("x=");
            sb.append(String.format("%.4f", x));
            sb.append(" y=");
            sb.append(String.format("%.4f", y));
            return sb.toString();
        }
    });
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    sc.addChangeListener(plot);
    JFreeChart msChart = new JFreeChart(this.plot);
    msChart.addChangeListener(this.defaultNumberFormat);
    //      System.out.println("Creating ms chart 3");
    this.cp = new ContextAwareChartPanel(msChart, true, true, true, true, true);
    this.cp.setInitialDelay(1);
    this.cp.getChart().getLegend().setVisible(true);
    this.cp.setMouseWheelEnabled(true);
    this.clearActionPerformed(null);
    this.jPanel2.removeAll();
    this.jPanel2.add(cp);
    this.jPanel2.repaint();
    this.massLabelsSpinner.setValue(topK);
}