Example usage for org.jfree.chart ChartPanel ChartPanel

List of usage examples for org.jfree.chart ChartPanel ChartPanel

Introduction

In this page you can find the example usage for org.jfree.chart ChartPanel ChartPanel.

Prototype

public ChartPanel(JFreeChart chart) 

Source Link

Document

Constructs a panel that displays the specified chart.

Usage

From source file:daylightchart.gui.LocationsTabbedPane.java

/**
 * Add a new tab for the location.//from  w  w w . j av  a2 s .  c om
 *
 * @param daylightChartReport
 *        Daylight Chart report
 */
public void addLocationTab(final DaylightChartReport daylightChartReport) {
    final Location location = daylightChartReport.getLocation();
    final DaylightChart chart = daylightChartReport.getChart();

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setName(location.toString());
    chartPanel.setPreferredSize(ChartConfiguration.chartDimension);

    addTab(location.toString(), new CloseTabIcon(), chartPanel, LocationFormatter.getToolTip(location));
    setSelectedIndex(getTabCount() - 1);
}

From source file:Graphics.Barchart.java

public void createGraphic(String titulo, int largura, int altura) {
    CategoryDataset data = this.createDataset();
    grafico = ChartFactory.createBarChart(titulo, xtitle, ytitle, data, PlotOrientation.HORIZONTAL, true, false,
            false);//from w w  w . j a  va2s  .co m
    this.altura = altura;
    this.largura = largura;
    ChartPanel ch = new ChartPanel(grafico);
    ch.setSize(largura, altura);
    ch.setBounds(0, 0, largura, altura);
    this.setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
    this.setContentPane(ch);
}

From source file:userInterface.StateAdminRole.DecisionCartJPanel2.java

public DecisionCartJPanel2(JPanel userProcessContainer, PhdEnterprise e) {
    initComponents();// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    this.userProcessContainer = userProcessContainer;
    this.e = e;// www . ja  v  a2s  . c  o  m
    JFreeChart jfreechart1 = createChart1(createDataset1());
    ChartPanel chartpanel1 = new ChartPanel(jfreechart1);
    chartpanel1.setPreferredSize(new Dimension(1000, 540));
    jPanel1.add(chartpanel1);
    CardLayout layout1 = (CardLayout) jPanel1.getLayout();
    layout1.next(jPanel1);
}

From source file:view.Histogram.java

public Histogram(String applicationTitle, String TituloGrafico, List<ArtefatoFrequencia> Lista) {
    super(applicationTitle);

    DefaultCategoryDataset DatasetGrafico = new DefaultCategoryDataset();
    int quantidade = 0;
    int i;//www  .j a  v  a 2 s .  c o m
    for (i = 0; i < Lista.size() - 1; i++) {
        quantidade = quantidade + Lista.get(i).getQuantidade();
        DatasetGrafico.addValue(Lista.get(i).getQuantidade(), Lista.get(i).getAtributo(),
                "Number of artefacts affected by review accumulated");
    }
    //DatasetGrafico.addValue(101, "Frequencia", "termo b");
    //DatasetGrafico.addValue(150, "termc1", "termo c2");*/
    //for (ArtefatoFrequencia c:Lista2)
    //  DatasetGrafico.addValue(c.getQuantidade(), c.getAtributo(), "Number of artefacts affected by review");

    JFreeChart grafico = ChartFactory.createBarChart(TituloGrafico, "Legends",
            "Accumulation of Number of Review", DatasetGrafico);

    this.add(new ChartPanel(grafico));
    this.pack();
}

From source file:no.imr.sea2data.guibase.chart.XYBarChart.java

public XYBarChart() {
    dataset = new XYSeriesCollection(new XYSeries("Series 1"));
    JFreeChart chart = ChartFactory.createXYBarChart("", "X axis", false, "Y axis", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    chart.setBackgroundPaint(Color.white);
    chart.getTitle().setPaint(Color.black);
    chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, 12));
    chart.addSubtitle(trendLegend);// www. j a v a  2  s.  c o m
    chart.addSubtitle(trendLegend2);
    trendLegend.setPosition(RectangleEdge.TOP);
    trendLegend2.setPosition(RectangleEdge.TOP);
    plot = (XYPlot) chart.getPlot();
    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setShadowVisible(false);
    chartPanel = new ChartPanel(chart);
    plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
}

From source file:com.waitwha.nessus.trendanalyzer.gui.PieChartPanel.java

public PieChartPanel(String title, PieDataset dataset) {
    super(new BorderLayout());

    JFreeChart chart = ChartFactory.createPieChart(title, dataset, true, true, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionOutlinesVisible(true);
    plot.setNoDataMessage("No data available");

    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);/* w w  w . ja v  a 2s  . co m*/
    this.add(panel, BorderLayout.CENTER);
    this.validate();
}

From source file:com.ohalo.cn.awt.JFreeChartTest2.java

public static JPanel createPanel() {
    JFreeChart chart = createChart(createDataset());
    return new ChartPanel(chart); // chartPanel??ChartPanelJpanel
}

From source file:es.bsc.autonomic.powermodeller.graphics.TotalPowerVsTotalPrediction.java

public static JPanel createPanel() {
    //Axis configuration
    NumberAxis sampleAxis = new NumberAxis("Sample");
    sampleAxis.setAutoRangeIncludesZero(false);
    NumberAxis powerAxis = new NumberAxis("Power (Watts)");
    powerAxis.setAutoRangeIncludesZero(false);

    XYSplineRenderer xysplinerenderer = new XYSplineRenderer();

    XYPlot xyplot = new XYPlot(data, sampleAxis, powerAxis, xysplinerenderer);
    for (int i = 0; i < data.getSeriesCount(); i++) {
        xyplot.getRenderer().setSeriesShape(i, new Rectangle());
    }//  w  ww . ja v  a  2 s  .  com

    //Panel layout configuration
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

    JFreeChart jfreechart = new JFreeChart(NAME, JFreeChart.DEFAULT_TITLE_FONT, xyplot, true);

    ChartUtilities.applyCurrentTheme(jfreechart);
    ChartPanel chartpanel = new ChartPanel(jfreechart);

    return chartpanel;
}

From source file:pwm.visualizer.MotivationDistributionPanel.java

private JPanel createPanel(String title) {
    IntervalXYDataset xybardataset = new XYBarDataset(motivationDataSet, 0.2D);
    JFreeChart jfreechart = ChartFactory.createXYBarChart(title, "", false, "Likelihood", xybardataset,
            PlotOrientation.VERTICAL, true, false, false);
    xyplot = (XYPlot) jfreechart.getPlot();
    NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setDrawBarOutline(false);

    return new ChartPanel(jfreechart);
}

From source file:com.fisher.mainFrame.java

private void startButtonActionPerformed(ActionEvent e) {
    // TODO add your code here
    this.logger.log("starting the application");
    this.handler = new DataHandler(fileLogger); // kick start the connection in the DataHandler constructor

    // Create and attach chart panel
    this.plotter = new BotDataPlotter();
    this.handler.setPlotter(this.plotter);

    this.plotter.setKalmanTickSource(this.handler.m_kalmanBot.m_midTicks);
    this.plotter.setKalmanOutputSource(this.handler.m_kalmanBot.m_output);
    this.plotter.setKalmanSignalSource(this.handler.m_kalmanBot.m_kFilter.buySellSignal);

    this.chart = plotter.createKalmanChart();
    this.plotter.customizeChart();

    this.chartPanel = new ChartPanel(this.chart);
    this.plotScrollPane = new JScrollPane();
    this.plotScrollPane.add(chartPanel);
    this.plotScrollPane.setViewportView(chartPanel);

    Container pane = this.getContentPane();

    pane.add(this.plotScrollPane, BorderLayout.SOUTH);

    this.plotScrollPane.setVisible(true);

    pane.setVisible(false);/* w  ww.  j ava 2 s.  c o  m*/
    pane.setVisible(true);

    this.startButton.setEnabled(false);
    this.stopButton.setEnabled(true);

}