List of usage examples for org.jfree.chart ChartPanel setSize
public void setSize(int width, int height)
From source file:edu.coeia.charts.PieChartPanel.java
public static JPanel newInstance(final Map<String, Double> map, String title, int factor) throws IOException { final PieDataset dataset = createSampleDataset(map, factor); final JFreeChart chart = createChart(dataset, title); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setSize(400, 400); return chartPanel; }
From source file:edu.coeia.charts.LineChartPanel.java
public static JPanel getLineChartPanel(String userName, String otherName, ArrayList<Message> data, ArrayList<Message> data2) throws ParseException { CategoryDataset categoryDataset = createCategoryDataset(userName, otherName, data, data2); JFreeChart chart = createChart(categoryDataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setSize(400, 400); return chartPanel; }
From source file:tourma.utils.web.WebStatistics.java
/** * /*from w ww. j a v a 2 s .c o m*/ */ public static String getHTML() { StringBuffer stats = new StringBuffer(""); JPNStatistics jpn = new JPNStatistics(); jpn.setSize(640, 480); JTabbedPane jtp = jpn.getTabbedPane(); for (int i = 0; i < jtp.getTabCount(); i++) { Component comp = jtp.getComponent(i); if (comp instanceof ChartPanel) { ChartPanel panel = (ChartPanel) comp; panel.setSize(640, 480); BufferedImage buf = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB); Graphics g = buf.createGraphics(); panel.print(g); g.dispose(); //BufferedImage buf = toBufferedImage(img, 640, 480); String img_str = WebPicture.getPictureAsHTML(buf, 640, 480, true); stats.append(img_str); } if (comp instanceof JPanel) { // Find JList, Select All then Find ChartPanel JPanel pane = (JPanel) comp; ChartPanel panel = null; JList list = null; for (int j = 0; j < pane.getComponentCount(); j++) { Component c = pane.getComponent(j); if (c instanceof JScrollPane) { for (int k = 0; k < ((JScrollPane) c).getViewport().getComponentCount(); k++) { Component c2 = ((JScrollPane) c).getViewport().getComponent(k); if (c2 instanceof JList) { list = (JList) c2; } } } } if (list != null) { int start = 0; int end = list.getModel().getSize() - 1; if (end >= 0) { list.setSelectionInterval(start, end); } jpn.updatePositions(); } for (int j = 0; j < pane.getComponentCount(); j++) { Component c = pane.getComponent(j); if (c instanceof ChartPanel) { panel = (ChartPanel) c; } } if (panel != null) { panel.setSize(640, 480); BufferedImage buf = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB); Graphics g = buf.createGraphics(); panel.print(g); g.dispose(); //BufferedImage buf = toBufferedImage(img, 640, 480); String img_str = WebPicture.getPictureAsHTML(buf, 640, 480, true); stats.append(img_str); } } } return stats.toString(); }
From source file:views.GraphicView.java
/** * Creates new form GraphicView/*from w w w. ja v a2 s .c om*/ */ public GraphicView(ChartPanel myChartPanel) { initComponents(); myChartPanel.setSize(jPanel1.getWidth(), jPanel1.getHeight()); jPanel1.add(myChartPanel); jPanel1.revalidate(); jPanel1.repaint(); }
From source file:Graphics.Piechart.java
public void createGraphic(String titulo, int largura, int altura) { PieDataset data = this.createDataset(); grafico = ChartFactory.createPieChart(titulo, data, true, true, lingua.getSystemLocale()); this.altura = altura; this.largura = largura; ChartPanel ch = new ChartPanel(grafico); ch.setSize(largura, altura); ch.setBounds(0, 0, largura, altura); this.add(ch); this.setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE); }
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 v a 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: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 . ja v a 2 s. c o 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:Visao.Relatorio.Grafico_QuantidadeReclamacoesUF.java
private void grafico(JFreeChart chart) { CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); panel.setVisible(true);/* w w w . ja v a2s . c om*/ panel.setSize(screenSize.width - 10, screenSize.height - 140); this.add(panel); }
From source file:ANNFileDetect.GraphingClass.java
public void drawchartFromInt(Integer[] values) throws IOException { DefaultCategoryDataset ds = new DefaultCategoryDataset(); for (int i = 0; i < values.length; i++) { //double a = (double) i; ds.addValue(i, String.valueOf(i), String.valueOf(values[i])); //ds.addValue((double)i, "Times", values[i]); }/*from w ww . ja va 2s .c o m*/ JFreeChart chart = ChartFactory.createBarChart("chart", "quantity", "value", ds, PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setSize(1200, 700); JPanel jf = new JPanel(); jf.setSize(1300, 800); chartPanel.setVisible(true); chartPanel.setZoomAroundAnchor(true); chartPanel.setDomainZoomable(true); jf.add(chartPanel); JLabel jl = new JLabel("hello!"); jf.add(jl); jf.setVisible(true); jf.repaint(); //jf.setAlwaysOnTop(true); }
From source file:telas.TelaGrafico.java
public void criaGrafico(ArrayList<Processo> listapronto) { JFreeChart chart = null;/*from w ww .j a va 2s .co m*/ XYSplineRenderer renderer = new XYSplineRenderer(); XYSeriesCollection dataset = new XYSeriesCollection(); ValueAxis x = new NumberAxis(); ValueAxis y = new NumberAxis(); XYSeries serie = new XYSeries("Processos"); XYPlot plot; for (int fila = 0; fila < listapronto.size(); fila++) { serie.add(listapronto.get(fila).getTsurto(), listapronto.get(fila).getTespera()); } dataset.addSeries(serie); x.setLabel("Processos"); y.setLabel("Tempo de espera"); plot = new XYPlot(dataset, x, y, renderer); chart = new JFreeChart(plot); chart.setTitle("Processos"); ChartPanel myChartPanel = new ChartPanel(chart, true); myChartPanel.setSize(jPanel1.getWidth(), jPanel1.getHeight()); myChartPanel.setVisible(true); jPanel1.removeAll(); jPanel1.add(myChartPanel); jPanel1.revalidate(); jPanel1.repaint(); }