Search in sources :

Example 16 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)

Example 17 with ChartPanel

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;
}
Also used : ChartPanel(org.jfree.chart.ChartPanel) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) ChartType(org.baderlab.csplugins.enrichmentmap.style.ChartType) JFreeChart(org.jfree.chart.JFreeChart)

Example 18 with 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);
}
Also used : JIntegerField(jgnash.ui.components.JIntegerField) ChartPanel(org.jfree.chart.ChartPanel) JFloatField(jgnash.ui.components.JFloatField) XYPlot(org.jfree.chart.plot.XYPlot) DatePanel(jgnash.ui.components.DatePanel) JButton(javax.swing.JButton) SecurityComboBox(jgnash.ui.components.SecurityComboBox) Dimension(java.awt.Dimension) JFreeChart(org.jfree.chart.JFreeChart)

Example 19 with ChartPanel

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;
}
Also used : ChartPanel(org.jfree.chart.ChartPanel) JFreeChart(org.jfree.chart.JFreeChart)

Example 20 with ChartPanel

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();
    }
}
Also used : ChartPanel(org.jfree.chart.ChartPanel) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) JFreeChart(org.jfree.chart.JFreeChart)

Aggregations

ChartPanel (org.jfree.chart.ChartPanel)20 JFreeChart (org.jfree.chart.JFreeChart)17 JPanel (javax.swing.JPanel)7 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)6 FormLayout (com.jgoodies.forms.layout.FormLayout)6 JButton (javax.swing.JButton)6 DatePanel (jgnash.ui.components.DatePanel)6 XYPlot (org.jfree.chart.plot.XYPlot)6 LocalDate (java.time.LocalDate)5 JCheckBox (javax.swing.JCheckBox)5 Account (jgnash.engine.Account)5 Dimension (java.awt.Dimension)4 AccountType (jgnash.engine.AccountType)4 RowSpec (com.jgoodies.forms.layout.RowSpec)3 EventQueue (java.awt.EventQueue)3 ActionListener (java.awt.event.ActionListener)3 BigDecimal (java.math.BigDecimal)3 DateFormat (java.text.DateFormat)3 NumberFormat (java.text.NumberFormat)3 SimpleDateFormat (java.text.SimpleDateFormat)3