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)));
}
}
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;
}
}
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)));
}
}
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);
}
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();
}
Aggregations