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();
}
use of org.jfree.chart.ChartPanel in project EnrichmentMapApp by BaderLab.
the class LegendPanel method createChartPanel.
private ChartPanel createChartPanel(Collection<EMDataSet> dataSets) {
JFreeChart chart = null;
List<EMDataSet> sortedDataSets = ChartUtil.sortDataSets(dataSets);
ChartType chartType = options.getChartOptions() != null ? options.getChartOptions().getType() : null;
switch(chartType) {
case RADIAL_HEAT_MAP:
chart = ChartUtil.createRadialHeatMapLegend(sortedDataSets, options.getChartOptions());
break;
case HEAT_MAP:
chart = ChartUtil.createHeatMapLegend(sortedDataSets, options.getChartOptions());
break;
case HEAT_STRIPS:
chart = ChartUtil.createHeatStripsLegend(sortedDataSets, options.getChartOptions());
break;
default:
break;
}
ChartPanel chartPanel = chart != null ? new ChartPanel(chart) : null;
if (chartPanel != null) {
chartPanel.setPopupMenu(null);
chartPanel.setMouseZoomable(false);
}
return chartPanel;
}
use of org.jfree.chart.ChartPanel in project jgnash by ccavanaugh.
the class SecuritiesHistoryDialog method initComponents.
private void initComponents() {
dateField = new DatePanel();
closeField = new JFloatField();
lowField = new JFloatField();
highField = new JFloatField();
securityCombo = new SecurityComboBox();
volumeField = new JIntegerField();
updateButton = new JButton(rb.getString("Button.UpdateOnline"), IconUtils.getIcon("/jgnash/resource/applications-internet.png"));
deleteButton = new JButton(rb.getString("Button.Delete"));
clearButton = new JButton(rb.getString("Button.Clear"));
applyButton = new JButton(rb.getString("Button.Add"));
closeButton = new JButton(rb.getString("Button.Close"));
model = new HistoryModel();
table = new HistoryTable();
table.setModel(model);
table.setPreferredScrollableViewportSize(new Dimension(150, 120));
table.setCellSelectionEnabled(false);
table.setColumnSelectionAllowed(false);
table.setRowSelectionAllowed(true);
table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table.setRowSorter(new TableRowSorter<>(model));
table.setFillsViewportHeight(true);
// create an empty chart for panel construction
chartPanel = new ChartPanel(new JFreeChart(new XYPlot()));
chartPanel.setPreferredSize(new Dimension(150, 90));
applyButton.addActionListener(this);
clearButton.addActionListener(this);
deleteButton.addActionListener(this);
updateButton.addActionListener(this);
securityCombo.addActionListener(this);
closeButton.addActionListener(this);
}
use of org.jfree.chart.ChartPanel in project processdash by dtuma.
the class AbstractEVChart method buildChart.
private ChartPanel buildChart(D data, Map environment, Map parameters) {
data = getAdjustedData(data);
JFreeChart chart = createChart(data);
if (chart != null) {
chart.getPlot().setNoDataMessage(resources.getString("No_Data_Message"));
adjustPlot((P) chart.getPlot(), data, environment, parameters);
}
ChartPanel panel = getChartPanel(chart, data);
panel.setInitialDelay(50);
panel.setDismissDelay(60000);
return panel;
}
use of org.jfree.chart.ChartPanel in project processdash by dtuma.
the class AbstractEVChart method writeChartAsHtml.
public void writeChartAsHtml(Writer out, Map environment, Map parameters) throws IOException {
Map htmlEnv = new HashMap(environment);
htmlEnv.put(EVSnippetEnvironment.HTML_OUTPUT_KEY, Boolean.TRUE);
D dataset = createDataset(htmlEnv, parameters);
ChartPanel chartPanel = buildChart(dataset, htmlEnv, parameters);
JFreeChart chart = chartPanel.getChart();
if (chart != null) {
new HtmlWriter(out, parameters, chart).writeChartHtml();
}
}
Aggregations