Search in sources :

Example 41 with ChartPanel

use of org.jfree.chart.ChartPanel in project mzmine2 by mzmine.

the class ChartGestureMouseAdapter method mouseExited.

@Override
public void mouseExited(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.EXITED))
        return;
    if (e.getComponent() instanceof ChartPanel) {
        ChartPanel chartPanel = (ChartPanel) e.getComponent();
        ChartEntity entity = findChartEntity(chartPanel, e);
        ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
        Button button = Button.getButton(e.getButton());
        // handle event
        handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.EXITED, button)));
    }
}
Also used : ChartGesture(net.sf.mzmine.chartbasics.gestures.ChartGesture) ChartPanel(org.jfree.chart.ChartPanel) Button(net.sf.mzmine.chartbasics.gestures.ChartGesture.Button) ChartGestureEvent(net.sf.mzmine.chartbasics.gestures.ChartGestureEvent) Entity(net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity) ChartEntity(org.jfree.chart.entity.ChartEntity)

Example 42 with ChartPanel

use of org.jfree.chart.ChartPanel in project mzmine2 by mzmine.

the class ChartGestureMouseAdapter method mouseReleased.

@Override
public void mouseReleased(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.RELEASED))
        return;
    if (e.getComponent() instanceof ChartPanel) {
        ChartPanel chartPanel = (ChartPanel) e.getComponent();
        ChartEntity entity = findChartEntity(chartPanel, e);
        ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
        Button button = Button.getButton(e.getButton());
        // last gesture was dragged? keep the same chartEntity
        if (lastDragEvent != null) {
            entity = lastDragEvent.getEntity();
            gestureEntity = lastDragEvent.getGesture().getEntity();
        }
        // handle event
        handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.RELEASED, button)));
        // reset drag
        lastDragEvent = null;
    }
}
Also used : ChartGesture(net.sf.mzmine.chartbasics.gestures.ChartGesture) ChartPanel(org.jfree.chart.ChartPanel) Button(net.sf.mzmine.chartbasics.gestures.ChartGesture.Button) ChartGestureEvent(net.sf.mzmine.chartbasics.gestures.ChartGestureEvent) Entity(net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity) ChartEntity(org.jfree.chart.entity.ChartEntity)

Example 43 with ChartPanel

use of org.jfree.chart.ChartPanel in project mzmine2 by mzmine.

the class ChartGestureMouseAdapter method mouseMoved.

@Override
public void mouseMoved(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty() || !listensFor(Event.MOVED))
        return;
    if (e.getComponent() instanceof ChartPanel) {
        ChartPanel chartPanel = (ChartPanel) e.getComponent();
        ChartEntity entity = findChartEntity(chartPanel, e);
        ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
        Button button = Button.getButton(e.getButton());
        // handle event
        handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.MOVED, button)));
    }
}
Also used : ChartGesture(net.sf.mzmine.chartbasics.gestures.ChartGesture) ChartPanel(org.jfree.chart.ChartPanel) Button(net.sf.mzmine.chartbasics.gestures.ChartGesture.Button) ChartGestureEvent(net.sf.mzmine.chartbasics.gestures.ChartGestureEvent) Entity(net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity) ChartEntity(org.jfree.chart.entity.ChartEntity)

Example 44 with ChartPanel

use of org.jfree.chart.ChartPanel in project gephi by gephi.

the class JFreeChartDialog method initialize.

private void initialize(JFreeChart chart) {
    initComponents();
    if (chart == null) {
        throw new IllegalArgumentException("Chart panel can't be null");
    }
    this.chartPanel = new ChartPanel(chart, true);
    scroll.setViewportView(chartPanel);
    adaptChartPanelSizeToScrollSize();
    scroll.revalidate();
    scroll.repaint();
    setVisible(true);
}
Also used : ChartPanel(org.jfree.chart.ChartPanel)

Example 45 with ChartPanel

use of org.jfree.chart.ChartPanel in project EnrichmentMapApp by BaderLab.

the class LegendPanel method updateNodeChartPanel.

private void updateNodeChartPanel(Collection<EMDataSet> dataSets, EnrichmentMap map) {
    JPanel p = getNodeChartPanel();
    chartLegendPanel.removeAll();
    CyNetworkView netView = options.getNetworkView();
    VisualStyle style = netView != null ? visualMappingManager.getVisualStyle(netView) : null;
    NetworkViewRenderer renderer = applicationManager.getCurrentNetworkViewRenderer();
    if (renderer == null)
        renderer = applicationManager.getDefaultNetworkViewRenderer();
    VisualLexicon lexicon = renderer.getRenderingEngineFactory(NetworkViewRenderer.DEFAULT_CONTEXT).getVisualLexicon();
    VisualProperty<?> vp = lexicon.lookup(CyNode.class, "NODE_CUSTOMGRAPHICS_1");
    Object cg = vp != null ? style.getDefaultValue(vp) : null;
    ChartType chartType = options.getChartOptions() != null ? options.getChartOptions().getType() : null;
    if (chartType != null && cg instanceof CyCustomGraphics2 && dataSets != null && dataSets.size() > 1) {
        ChartPanel chart = createChartPanel(dataSets);
        if (chart != null) {
            JLabel titleLabel = new JLabel("" + options.getChartOptions().getData());
            titleLabel.setHorizontalAlignment(JLabel.CENTER);
            makeSmall(titleLabel);
            chartLegendPanel.add(chart, BorderLayout.CENTER);
            chartLegendPanel.add(titleLabel, BorderLayout.SOUTH);
        }
        p.setVisible(true);
    } else {
        p.setVisible(false);
    }
    p.revalidate();
}
Also used : JPanel(javax.swing.JPanel) CyCustomGraphics2(org.cytoscape.view.presentation.customgraphics.CyCustomGraphics2) BasicVisualLexicon(org.cytoscape.view.presentation.property.BasicVisualLexicon) VisualLexicon(org.cytoscape.view.model.VisualLexicon) ChartPanel(org.jfree.chart.ChartPanel) JLabel(javax.swing.JLabel) ChartType(org.baderlab.csplugins.enrichmentmap.style.ChartType) VisualStyle(org.cytoscape.view.vizmap.VisualStyle) CyNetworkView(org.cytoscape.view.model.CyNetworkView) NetworkViewRenderer(org.cytoscape.application.NetworkViewRenderer)

Aggregations

ChartPanel (org.jfree.chart.ChartPanel)84 JFreeChart (org.jfree.chart.JFreeChart)50 XYPlot (org.jfree.chart.plot.XYPlot)20 Dimension (java.awt.Dimension)18 JPanel (javax.swing.JPanel)17 Color (java.awt.Color)16 NumberAxis (org.jfree.chart.axis.NumberAxis)16 ChartEntity (org.jfree.chart.entity.ChartEntity)15 XYSeries (org.jfree.data.xy.XYSeries)15 XYSeriesCollection (org.jfree.data.xy.XYSeriesCollection)15 XYDataset (org.jfree.data.xy.XYDataset)12 BasicStroke (java.awt.BasicStroke)11 XYLineAndShapeRenderer (org.jfree.chart.renderer.xy.XYLineAndShapeRenderer)11 ChartGesture (net.sf.mzmine.chartbasics.gestures.ChartGesture)8 Button (net.sf.mzmine.chartbasics.gestures.ChartGesture.Button)8 Entity (net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity)8 ChartGestureEvent (net.sf.mzmine.chartbasics.gestures.ChartGestureEvent)8 DecimalFormat (java.text.DecimalFormat)7 JButton (javax.swing.JButton)7 JLabel (javax.swing.JLabel)7