List of usage examples for org.jfree.chart ChartPanel ChartPanel
public ChartPanel(JFreeChart chart)
From source file:systeminformation.Main.java
public void chart(String path) { Hdd h = i.getDisk(path + ""); PieDataset pieDataset = c.createPieDataSet(h); JFreeChart chart = c.create3DPieChart(pieDataset); chartPanel = new ChartPanel(chart); chartPanel.setSize(300, 200);//from www .ja v a 2s . co m jPanel3.removeAll(); // jPanel3.setLayout(new GridLayout(1,5)); jPanel3.add(chartPanel); jPanel3.repaint(); }
From source file:javatest.IndicatorsToChart.java
/** * Displays a chart in a frame.//from w w w .ja v a2 s. c o m * @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 java.awt.Dimension(1000, 540)); // Application frame ApplicationFrame frame = new ApplicationFrame("neli - Indicators to chart"); frame.setContentPane(panel); frame.pack(); RefineryUtilities.centerFrameOnScreen(frame); frame.setVisible(true); }
From source file:com.oracle.cch.swingtest.ChartJFrame.java
/** * Creates new form ChartJFrame/*from w w w . j av a2 s.com*/ */ public ChartJFrame() { initComponents(); XYSeries Goals = new XYSeries("Goals Scored"); Goals.add(1, 1.0); Goals.add(2, 3.0); Goals.add(3, 2.0); Goals.add(4, 0.0); Goals.add(5, 3.0); XYDataset xyDataset = new XYSeriesCollection(Goals); chart = ChartFactory.createXYLineChart("Goals Scored Over Time", "Fixture Number", "Goals", xyDataset, PlotOrientation.VERTICAL, true, true, false); ChartPanel cp = new ChartPanel(chart) { @Override public Dimension getPreferredSize() { return new Dimension(320, 240); } }; FlowLayout fl = new FlowLayout(); this.setLayout(fl); this.add(cp); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); }
From source file:Diagramas.LineChart_AWT.java
public LineChart_AWT(String applicationTitle, String chartTitle) throws IOException { super(applicationTitle); JFreeChart lineChart = ChartFactory.createLineChart(chartTitle, "Years", "Number of Schools", createDataset(), PlotOrientation.VERTICAL, true, true, false); int width = 640; /* Width of the image */ int height = 480; /* Height of the image */ File lineCharts = new File("LineChart.png"); ChartUtilities.saveChartAsPNG(lineCharts, lineChart, width, height); ChartPanel chartPanel = new ChartPanel(lineChart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); setContentPane(chartPanel);// w w w .j av a2 s . c o m }
From source file:tp2_poo.Vue_camembert.java
@Override public void update() { charts = c.createChart(c.createSampleDataset(prom)); panel = new ChartPanel(charts); this.setContentPane(panel); }
From source file:com.jml.main.Graph.java
public void drawScatterPlot(String title, XYDataset xYDataset) { JFreeChart chart = ChartFactory.createScatterPlot(title, "X axis label", "Y axis label", xYDataset); XYPlot plot = chart.getXYPlot();/* w w w.ja va 2 s . c o m*/ Random random = new Random(); for (int i = 0; i < dataset.getSeriesCount(); ++i) { plot.getRenderer().setSeriesPaint(i, new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255))); } panel = new ChartPanel(chart); this.add(panel); this.pack(); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); }
From source file:techtonic.Exports.java
/** * Creates new form Exports//w w w . ja va 2s. c o m */ public Exports(java.awt.Frame parent, boolean modal) { super(parent, "Exporting :-TechTonic-", true); initComponents(); fBg.add(jpg); fBg.add(png); jpg.setSelected(true); setResizable(false); this.width.setText("" + Techtonic.geteWidth()); this.height.setText("" + Techtonic.geteHeight()); ChartPanel cp = new ChartPanel(Techtonic.getFreeChart()); cp.setMouseZoomable(true, true); exportSavePanel.setLayout(new java.awt.BorderLayout()); exportSavePanel.add(cp, BorderLayout.CENTER); exportSavePanel.validate(); }
From source file:com.kiyoshi.gui.AreaChart.java
public JPanel getChart() { // create a dataset... final double[][] data = new double[][] { { 1.0, 4.0, 3.0, 5.0, 5.0, 7.0, 7.0, 8.0 }, { 5.0, 7.0, 6.0, 8.0, 4.0, 4.0, 2.0, 1.0 }, { 4.0, 3.0, 2.0, 3.0, 6.0, 3.0, 4.0, 3.0 } }; final CategoryDataset dataset = DatasetUtilities.createCategoryDataset("Series ", "Type ", data); // create the chart... final JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart); JPanel b = new JPanel(); JPanel c = (JPanel) b.add(chartPanel); return c;/* ww w . j ava2 s . c o m*/ }
From source file:studio.ui.LineChart.java
public LineChart(KTableModel table) { JFreeChart chart = createDataset(table); if (chart != null) { frame = new JFrame("Studio for kdb+ [chart]"); chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setMouseZoomable(true, false); frame.setContentPane(chartPanel); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setIconImage(Util.getImage(Config.imageBase2 + "chart_24.png").getImage()); frame.pack();/*from w w w .j a va 2 s . c o m*/ frame.setVisible(true); frame.requestFocus(); frame.toFront(); } }
From source file:SyntheticData.XYLineChart.java
public XYLineChart(String applicationTitle, String chartTitle, String xaxislabel, String yaxislabel, XYSeriesCollection dataset) throws IOException { super(applicationTitle); JFreeChart xylinechart = ChartFactory.createXYLineChart(chartTitle, xaxislabel, yaxislabel, dataset, PlotOrientation.VERTICAL, true, true, false); ChartPanel cpanel = new ChartPanel(xylinechart); cpanel.setPreferredSize(new java.awt.Dimension(500, 500)); final XYPlot xyplot = xylinechart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesStroke(0, new BasicStroke(2.0f)); xyplot.setRenderer(renderer);/* www . j a va 2 s. c om*/ setContentPane(cpanel); File saveImageFile = new File("" + applicationTitle + ".jpg"); ChartUtilities.saveChartAsJPEG(saveImageFile, xylinechart, 1920, 1080); }