List of usage examples for org.jfree.chart ChartPanel ChartPanel
public ChartPanel(JFreeChart chart)
From source file:teachersV3.jFreeChart.PieChart.java
/** * Build the PieChart for the student (marks). * /*from w ww .j a va 2 s . co m*/ * @param applicationTitle * Name of the application. * @param chartTitle * Name of the chart. * @param s * The student. */ public PieChart(String applicationTitle, String chartTitle, Student s) { super(applicationTitle); // This will create the dataset PieDataset dataset = createDatasetMarksStudent(s); // based on the dataset we create the chart JFreeChart chart = createChart(dataset, chartTitle); // we put the chart into a panel ChartPanel chartPanel = new ChartPanel(chart); // default size chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); // add it to our application setContentPane(chartPanel); }
From source file:smarthouse_server.LineChart.java
public LineChart() { CategoryDataset catDataset = createDataset(); createChart(catDataset);/*from w ww . j ava2 s. co m*/ chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(500, 270)); //setContentPane(chartPanel); this.add(chartPanel); System.out.println("LINE CHART CREATED " + Global.currentTime); }
From source file:Grafica.java
private void init() { panel = new JPanel(); getContentPane().add(panel);/* ww w.j av a2 s. c o m*/ // Fuente de Datos DefaultPieDataset defaultpiedataset = new DefaultPieDataset(); defaultpiedataset.setValue("Abiertas 81%", new Double(81D)); defaultpiedataset.setValue("Cerradas 19%", new Double(19D)); // defaultpiedataset.setValue("Hacking", new Double(19.5D)); // defaultpiedataset.setValue("SEO", new Double(30.5D)); // defaultpiedataset.setValue("Redes", new Double(2.0D)); // Creando el Grafico JFreeChart chart = ChartFactory.createPieChart3D("Informe De Asignacin De Clases", defaultpiedataset, true, true, false); PiePlot3D pieplot3d = (PiePlot3D) chart.getPlot(); pieplot3d.setDepthFactor(0.5); pieplot3d.setStartAngle(290D); pieplot3d.setDirection(Rotation.CLOCKWISE); pieplot3d.setForegroundAlpha(0.5F); // Mostrar Grafico ChartPanel chartPanel = new ChartPanel(chart); panel.add(chartPanel); }
From source file:Graphics.Linechart.java
public void createGraphic(String titulo, int largura, int altura) { CategoryDataset data = this.createDataset(); grafico = ChartFactory.createLineChart(titulo, xtitle, ytitle, data, PlotOrientation.VERTICAL, true, false, false);//from w w w .j ava 2 s .com 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:regression.gui.RegressionChart.java
public RegressionChart(List<Point> countedPoints, List<Point> points, List<Point> finalProbPoints) { final XYDataset dataset = createLogisticDataset(countedPoints, points, finalProbPoints); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel);// www.j a v a 2s . c o m }
From source file:de.fhffm.jad.demo.view.LineChartPanel.java
/** * Creates a new chart panel/* w w w .j av a2 s .c o m*/ */ public LineChartPanel() { final XYDataset dataset = createDataset(); chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(500, 270)); add(chartPanel); }
From source file:org.datacleaner.util.ChartUtils.java
public static ChartPanel createPanel(JFreeChart chart, int width, int height) { final ChartPanel panel = new ChartPanel(chart); panel.setPreferredSize(new Dimension(width, height)); return panel; }
From source file:cs.register.geraGrafico.java
public geraGrafico(String title, int type, List<partida> L) { super(title); JFreeChart chart = null;/* www.j a v a 2 s .c o m*/ switch (type) { case 0: chart = ChartFactory.createXYLineChart(title, "X", "y", datakill(L), PlotOrientation.VERTICAL, true, true, false); case 1: chart = ChartFactory.createXYLineChart(title, "X", "y", datakda(L), PlotOrientation.VERTICAL, true, true, false); case 2: chart = ChartFactory.createXYLineChart(title, "X", "y", datawld(L), PlotOrientation.VERTICAL, true, true, false); case 3: chart = ChartFactory.createXYLineChart(title, "X", "y", datasocore(L), PlotOrientation.VERTICAL, true, true, false); case 4: chart = ChartFactory.createXYLineChart(title, "X", "y", datarank(L), PlotOrientation.VERTICAL, true, true, false); } graf = new ChartPanel(chart); graf.setPreferredSize(new java.awt.Dimension(560, 367)); XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer rendrer = new XYLineAndShapeRenderer(); rendrer.setSeriesPaint(0, Color.GREEN); rendrer.setSeriesStroke(0, new BasicStroke(4.0f)); plot.setRenderer(rendrer); setContentPane(graf); }
From source file:GUI.ResponseStatistics.java
/** * Creates a sample dataset */ private void InitPieChart(JFreeChart chart) { ChartPanel chartPanel = new ChartPanel(chart); // default size chartPanel.setSize(560, 800);// ww w . j a va2s .c o m Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) ((dimension.getWidth() - chartPanel.getWidth()) / 2); int y = (int) ((dimension.getHeight() - chartPanel.getHeight()) / 2); chartPanel.setLocation(WIDTH, WIDTH); // add it to our application setContentPane(chartPanel); chartPanel.addChartMouseListener(new ChartMouseListener() { public void chartMouseClicked(ChartMouseEvent e) { wait = false; } public void chartMouseMoved(ChartMouseEvent e) { } }); }
From source file:baocaoxla.xuly_compare.java
public ChartPanel displayhistogram(BufferedImage image) { HistogramDataset dataset = new HistogramDataset(); final int w = image.getWidth(); final int h = image.getHeight(); double[] r = new double[w * h]; double[] g = new double[w * h]; double[] b = new double[w * h]; int dem = 0;/*from www. j a v a2s . c om*/ for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { Color c = new Color(image.getRGB(j, i)); r[dem] = c.getRed(); g[dem] = c.getGreen(); b[dem] = c.getBlue(); dem++; } } //r = raster.getSamples(0, 0, w, h, 0, r); dataset.addSeries("Red", r, 256); //r = raster.getSamples(0, 0, w, h, 1, r); dataset.addSeries("Green", g, 256); // r = raster.getSamples(0, 0, w, h, 2, r); dataset.addSeries("Blue", b, 256); // chart JFreeChart chart = ChartFactory.createHistogram("Histogram", "Value", "Count", dataset, PlotOrientation.VERTICAL, true, true, false); ChartPanel panel = new ChartPanel(chart); return panel; }