List of usage examples for org.jfree.chart ChartFrame setVisible
public void setVisible(boolean b)
From source file:dumbara.view.Chart1.java
public static void ViewLineChart(String[] agencyID, String[] sslesDate, ArrayList<String[]> arrayList) throws SQLException, ClassNotFoundException { XYSeries series1 = new XYSeries("Agency 1"); XYSeries series2 = new XYSeries("Agency 2"); XYSeries series3 = new XYSeries("Agency 3"); XYSeries series4 = new XYSeries("Agency 4"); for (String[] strings : arrayList) { for (int i = 0; i < sslesDate.length; i++) { System.out.println(sslesDate[i].split("-")[1] + ""); series1.add(Double.parseDouble(sslesDate[i].split("-")[1] + ""), Double.parseDouble(arrayList.get(0)[i])); }/*from w ww. jav a 2 s .c o m*/ for (int i = 0; i < sslesDate.length; i++) { series2.add(Double.parseDouble(sslesDate[i].split("-")[1] + ""), Double.parseDouble(arrayList.get(1)[i])); } for (int i = 0; i < sslesDate.length; i++) { series3.add(Double.parseDouble(sslesDate[i].split("-")[1] + ""), Double.parseDouble(arrayList.get(2)[i])); } for (int i = 0; i < sslesDate.length; i++) { series4.add(Double.parseDouble(sslesDate[i].split("-")[1] + ""), Double.parseDouble(arrayList.get(3)[i])); } } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series1); dataset.addSeries(series2); dataset.addSeries(series3); dataset.addSeries(series4); XYDataset dataset1 = dataset; JFreeChart chart = ChartFactory.createXYLineChart("", "Test Id", "Average Marks", dataset1, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(0, true); renderer.setSeriesLinesVisible(1, true); renderer.setSeriesShapesVisible(1, true); renderer.setSeriesLinesVisible(2, true); renderer.setSeriesShapesVisible(2, true); renderer.setSeriesFillPaint(2, Color.MAGENTA); plot.setRenderer(renderer); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 300)); //(chartPanel); ChartFrame frame = new ChartFrame("Dumbara Water Management System", chart); frame.setLocationRelativeTo(null); frame.pack(); frame.setVisible(true); }
From source file:tools.descartes.bungee.chart.ChartGenerator.java
public static void showChart(JFreeChart chart, String title) { final ChartFrame frame = new ChartFrame(title, chart); frame.setVisible(true); }
From source file:lectorarchivos.VerCSV.java
public static void mostrarGrafica(JTable jTableInfoCSV) { //Fuente de datos DefaultCategoryDataset dataset = new DefaultCategoryDataset(); //Recorremos la columna del consumo de la tabla for (int i = jTableInfoCSV.getRowCount() - 1; i >= 0; i--) { if (Double.parseDouble(jTableInfoCSV.getValueAt(i, 4).toString()) > 0) dataset.setValue(Double.parseDouble(jTableInfoCSV.getValueAt(i, 4).toString()), "Consumo", jTableInfoCSV.getValueAt(i, 0).toString()); }//from www . ja va 2 s .c o m //Creando el grfico JFreeChart chart = ChartFactory.createBarChart3D("Consumo", "Fecha", "Consumo", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.cyan); chart.getTitle().setPaint(Color.black); chart.setBackgroundPaint(Color.white); chart.removeLegend(); //Cambiar color de barras CategoryPlot plot = (CategoryPlot) chart.getPlot(); BarRenderer barRenderer = (BarRenderer) plot.getRenderer(); barRenderer.setSeriesPaint(0, Color.decode("#5882FA")); // Mostrar Grafico ChartFrame frame = new ChartFrame("CONSUMO", chart); frame.pack(); frame.getChartPanel().setMouseZoomable(false); frame.setVisible(true); panel.add(frame); }
From source file:org.micromanager.CRISP.CRISPFrame.java
/** * Create a frame with a plot of the data given in XYSeries */// w w w .j a va 2s. c o m public static void plotData(String title, XYSeries data, String xTitle, String yTitle, int xLocation, int yLocation) { // JFreeChart code XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(data); JFreeChart chart = ChartFactory.createScatterPlot(title, // Title xTitle, // x-axis Label yTitle, // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation false, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.lightGray); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setSeriesPaint(0, Color.black); renderer.setSeriesFillPaint(0, Color.white); renderer.setSeriesLinesVisible(0, true); Shape circle = new Ellipse2D.Float(-2.0f, -2.0f, 4.0f, 4.0f); renderer.setSeriesShape(0, circle, false); renderer.setUseFillPaint(true); ChartFrame graphFrame = new ChartFrame(title, chart); graphFrame.getChartPanel().setMouseWheelEnabled(true); graphFrame.pack(); graphFrame.setLocation(xLocation, yLocation); graphFrame.setVisible(true); }
From source file:framepackage.MyPieChart.java
public MyPieChart() { DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("Online", new Integer(10)); pieDataset.setValue("Offline", new Integer(20)); pieDataset.setValue("Busy", new Integer(30)); pieDataset.setValue("Away", new Integer(40)); JFreeChart chart = ChartFactory.createPieChart("my pie", pieDataset, true, true, true); PiePlot P = (PiePlot) chart.getPlot(); //P.setForegroundAlpha(TOP_ALIGNMENT); ChartFrame f = new ChartFrame("chart", chart); f.setVisible(true); f.setSize(500, 700);//from w w w. ja va 2 s .c om }
From source file:DATA.Grafica.java
public void mostrarGrafica() { this.grafica = ChartFactory.createHistogram(titulo, "Nivel Gris", "Frecuencia", coleccion, PlotOrientation.VERTICAL, false, false, false); ChartFrame frame = new ChartFrame(titulo, grafica); frame.pack();/*from ww w. ja v a 2 s. c o m*/ frame.setVisible(true); }
From source file:metier.Freechart.java
public void stats() { List<Produit> produits = ProduitDAO.getInstance().readAll(); DefaultPieDataset pieDataset = new DefaultPieDataset(); for (Produit pr : produits) { pieDataset.setValue(pr.getNom(), new Integer(pr.getQuantiteInitial() - pr.getQuantiteDisponible())); }//from w ww.j a v a 2s . c o m JFreeChart chart = ChartFactory.createPieChart("Pie Chart", pieDataset, true, true, true); //.createPieChart(PieChart, pieDataset, true, true, true); PiePlot P = (PiePlot) chart.getPlot(); P.setForegroundAlpha(TOP_ALIGNMENT); ChartFrame frame = new ChartFrame("Pie Chart", chart); frame.setVisible(true); frame.setSize(450, 500); }
From source file:com.hello2morrow.sonargraph.jenkinsplugin.controller.util.ChartTestUtil.java
private void createChart(AbstractPlot plot, SonargraphMetrics metric, int maxDataPoints, boolean hideLegend) { JFreeChart chart = plot.createXYChart(metric, BUILD, maxDataPoints, true); ChartFrame frame1 = new ChartFrame(metric.getShortDescription(), chart); frame1.setVisible(true); frame1.setSize(500, 350);//from w w w .j a v a 2 s . c o m }
From source file:geneticonreinas.data.Grafica.java
public void mostrarGrafica() { // Crear la serie con los datos grafica = ChartFactory.createXYLineChart(this.tituloGrafica, this.axisXlabel, this.axisYlabel, coleccion, PlotOrientation.VERTICAL, true, false, false); ChartFrame panel = new ChartFrame(null, grafica); panel.pack();// w ww . j a v a2 s .c o m panel.setVisible(true); }
From source file:br.com.utfpr.pb.view.GraficoProdutosMaisVendidosView.java
public GraficoProdutosMaisVendidosView() { try {// w w w . j a va2 s . com // cria o grfico JFreeChart grafico = ChartFactory.createBarChart("Produtos mais Vendidos vs Comprados", "Produto", "Total venda", graficoDao.produtosMaisVendidos(), PlotOrientation.VERTICAL, true, true, false); //exibe o grfico ChartFrame frame = new ChartFrame("Grfico", grafico); frame.pack(); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (Exception e) { e.printStackTrace(); } }