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:org.jfree.chart.demo.BubbleChartDemo1.java

public static JPanel createDemoPanel() {
    JFreeChart jfreechart = createChart(createDataset());
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setDomainZoomable(true);/*  w  ww . ja  va  2 s  .  co  m*/
    chartpanel.setRangeZoomable(true);
    return chartpanel;
}

From source file:PlotsBuilding.PlotPanel.java

public PlotPanel(ArrayList<PlotsData> plotscollection, Plotcr frame) {
    pointsPanel = new JPanel();
    pointsPanel.setLayout(new BoxLayout(pointsPanel, BoxLayout.X_AXIS));
    cursorInfo = new JTextArea(2, 10);
    cursorInfo.setVisible(true);/*from www . j a  va2s  .  co  m*/
    chartPanel = new ChartPanel(fillCollection(plotscollection));
    chartPanel.addChartMouseListener(new MyChartMouseListener());
    chartPanel.setPreferredSize(new Dimension(800, 450));
    pointsPanel.setMaximumSize(new Dimension(chartPanel.getWidth(), 70));
    pointsPanel.add(cursorInfo);
    chartPanel.setBackground(Color.WHITE);
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(chartPanel);
    add(pointsPanel);
}

From source file:gov.sandia.umf.platform.ui.jobs.Raster.java

public JPanel createGraphPanel() {
    JFreeChart chart = createChart(dataset);
    return new ChartPanel(chart);
}

From source file:view.tankDepthDetails.BarrChart.java

/**
 * Creates new form BarrChart//www  .  j a va2  s  . c o m
 */
public BarrChart() {
    initComponents();

    DefaultCategoryDataset dcd = new DefaultCategoryDataset();
    float s = 8;
    dcd.setValue(s, "Marks", "Dumindu");
    dcd.setValue(88.80, "Marks", "lakal");
    dcd.setValue(78.80, "Marks", "Charitha");
    dcd.setValue(7.80, "Marks", "lahiru");
    dcd.setValue(76.80, "Marks", "mahin");
    dcd.setValue(90.80, "Marks", "gin");

    JFreeChart Jchart = ChartFactory.createBarChart("Tank Level Records", "Time", "Tank Level", dcd,
            PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot plot = Jchart.getCategoryPlot();
    plot.setRangeGridlinePaint(java.awt.Color.black);

    ChartFrame chartfra = new ChartFrame("Tank Level Records", Jchart, true);
    //   chartfra.setVisible(true);
    chartfra.setSize(400, 500);

    ChartPanel chartPanel = new ChartPanel(Jchart);

    jPanel2.removeAll();
    jPanel2.add(chartPanel);
    jPanel2.updateUI();

}

From source file:com.mycompany.istudy.principalservices.GraphicalView.java

/**
 * Overwrites the method of createXYLineChart from ChartFactory interface
 * and creates a XYLine Chart./*from ww  w  . j  a v a 2 s  .co m*/
 * @param applicationTitle
 * @param chartTitle
 * @param investedHoursPerWeek
 * @param hoursToBeInvested 
 */
public GraphicalView(String applicationTitle, String chartTitle, Map<Double, Double> investedHoursPerWeek,
        Map<Double, Double> hoursToBeInvested) {
    super(applicationTitle);
    xylineChart = ChartFactory.createXYLineChart(chartTitle, "Calender Weeks", "Invested Study-hours",
            createDataset(investedHoursPerWeek, hoursToBeInvested), PlotOrientation.VERTICAL, true, true,
            false);
    ChartPanel chartPanel = new ChartPanel(xylineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    final XYPlot plot = xylineChart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesPaint(0, Color.BLUE);
    renderer.setSeriesPaint(1, Color.RED);
    renderer.setSeriesStroke(0, new BasicStroke(4.0f));
    plot.setRenderer(renderer);
    setContentPane(chartPanel);
}

From source file:com.sjsu.uidesign.SystemUsage.java

public SystemUsage() {
    super();// w  w w  .j  a  v a 2s.  c  om
    super.setTitle("System Usage");
    super.setSize(500, 500);
    super.setResizable(true);
    super.setLocationRelativeTo(null);

    //JLabel usageImage = new JLabel();
    //usageImage.setIcon(new ImageIcon("Pie_3.png"));

    //usageImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/sjsu/uidesign/Pie_3.png"))); // NOI18N
    //add(usageImage);

    DefaultPieDataset pieDataset = new DefaultPieDataset();
    pieDataset.setValue("System Idle", 30);
    pieDataset.setValue("System Busy", 70);

    JFreeChart pieChart = ChartFactory.createPieChart3D("System Usage", pieDataset, true, true, true);

    Plot Pie = pieChart.getPlot();
    ChartPanel piePanel = new ChartPanel(pieChart);

    JPanel panelPie = new JPanel();
    panelPie.removeAll();
    panelPie.add(piePanel, BorderLayout.CENTER);
    panelPie.validate();

    add(panelPie);

}

From source file:iad_2_gg.gui.ChartDialog.java

public ChartDialog(java.awt.Frame parent, boolean modal, String chartTitle, String xLabel, String yLabel,
        List<Double> values1, String sName1, List<Double> values2, String sName2, int interval) {
    super(parent, modal);

    JFreeChart lineChart = ChartFactory.createXYLineChart(chartTitle, xLabel, yLabel,
            createDataset(values1, sName1, values2, sName2, interval), PlotOrientation.VERTICAL, true, true,
            false);/*from   w ww .jav a 2s . c o  m*/

    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new Dimension(1200, 600));
    setContentPane(chartPanel);
    initComponents();
}

From source file:tp2_poo.Vue_histogramme.java

@Override
public void update() {
    charts = h.createChart(h.createDataset(prom));
    panel = new ChartPanel(charts);
    this.setContentPane(panel);
}

From source file:io.github.mzmine.util.jfreechart.JFreeChartUtils.java

public static void printChart(ChartViewer chartNode) {

    // As of java 1.8.0_74, the JavaFX printing support seems to do poor
    // job. It creates pixelated, low-resolution print outs. For that
    // reason, we use the AWT PrinterJob class, until the JavaFX printing
    // support is improved.
    SwingUtilities.invokeLater(() -> {
        PrinterJob job = PrinterJob.getPrinterJob();
        PageFormat pf = job.defaultPage();
        PageFormat pf2 = job.pageDialog(pf);
        if (pf2 == pf)
            return;
        ChartPanel p = new ChartPanel(chartNode.getChart());
        job.setPrintable(p, pf2);//ww  w.  j a  va  2  s .  c om
        if (!job.printDialog())
            return;
        try {
            job.print();
        } catch (PrinterException e) {
            e.printStackTrace();
            MZmineGUI.displayMessage("Error printing: " + e.getMessage());
        }
    });
}

From source file:userInterface.StateAdminRole.DecisionChart4JPanel.java

public DecisionChart4JPanel(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;//from w  w w.j a  va2  s. 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);
}