Search in sources :

Example 66 with ChartPanel

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

the class BuyAndSellSignalsToChart method displayChart.

/**
 * Displays a chart in a frame.
 * @param chart the chart to be displayed
 */
private static void displayChart(JFreeChart chart) {
    // Chart panel
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new Dimension(1024, 400));
    // Application frame
    ApplicationFrame frame = new ApplicationFrame("Ta4j example - Buy and sell signals to chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}
Also used : ChartPanel(org.jfree.chart.ChartPanel) ApplicationFrame(org.jfree.ui.ApplicationFrame)

Aggregations

ChartPanel (org.jfree.chart.ChartPanel)66 JFreeChart (org.jfree.chart.JFreeChart)42 XYPlot (org.jfree.chart.plot.XYPlot)19 Color (java.awt.Color)16 Dimension (java.awt.Dimension)16 NumberAxis (org.jfree.chart.axis.NumberAxis)16 JPanel (javax.swing.JPanel)15 XYSeries (org.jfree.data.xy.XYSeries)14 XYSeriesCollection (org.jfree.data.xy.XYSeriesCollection)14 XYDataset (org.jfree.data.xy.XYDataset)12 BasicStroke (java.awt.BasicStroke)11 XYLineAndShapeRenderer (org.jfree.chart.renderer.xy.XYLineAndShapeRenderer)11 DecimalFormat (java.text.DecimalFormat)7 JButton (javax.swing.JButton)7 JLabel (javax.swing.JLabel)7 StandardXYToolTipGenerator (org.jfree.chart.labels.StandardXYToolTipGenerator)7 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)6 FormLayout (com.jgoodies.forms.layout.FormLayout)6 Font (java.awt.Font)6 GridBagLayout (java.awt.GridBagLayout)6