List of usage examples for org.jfree.chart ChartFactory createBarChart3D
public static JFreeChart createBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
From source file:co.edu.eam.dinesoft.egresados.vista.gui.VentanaReportes.java
private void jCBProgramaRep2ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCBProgramaRep2ItemStateChanged // TODO add your handling code here: ChartPanel panel;/*from w w w . j a va2 s . com*/ try { Programa programa = (Programa) jCBProgramaRep2.getSelectedItem(); List<OfertaLaboral> listaOfertaLab = controlador.ofertaLabPrograma(programa); int contador = 0; AreasInteres areaAnterior = null; DefaultCategoryDataset ds = new DefaultCategoryDataset(); for (int i = 0; i < listaOfertaLab.size(); i++) { panelOfertasAbiertas.removeAll(); // Validacion de oferta if (listaOfertaLab.get(i).isCerrarOferta() == false) { areaAnterior = listaOfertaLab.get(i).getArea(); for (int j = 0; j < listaOfertaLab.size(); j++) { if (listaOfertaLab.get(j).getArea() == areaAnterior) { contador++; } } ds.addValue(contador, listaOfertaLab.get(i).getArea().getNombre(), listaOfertaLab.get(i).getArea().getNombre()); contador = 0; } } JFreeChart jf = ChartFactory.createBarChart3D("Reporte de ofertas abiertas", "Nombre de las ofertas", "Numero de vacantes", ds, PlotOrientation.VERTICAL, true, true, true); panel = new ChartPanel(jf); panel.setBounds(20, 20, 720, 320); panelOfertasAbiertas.add(panel); } catch (Exception e) { e.printStackTrace(); } }
From source file:lucee.runtime.tag.Chart.java
private void chartBar() throws PageException, IOException { // create the chart... final JFreeChart chart = show3d ? ChartFactory.createBarChart3D(title, xaxistitle, yaxistitle, createDatasetCategory(), PlotOrientation.VERTICAL, false, true, false) : ChartFactory.createBarChart(title, xaxistitle, yaxistitle, createDatasetCategory(), PlotOrientation.VERTICAL, false, true, false); Plot p = chart.getPlot();/* www .j a va2s . co m*/ Font _font = getFont(); // settings setBackground(chart, p); setBorder(chart, p); set3d(p); setFont(chart, _font); setLabelFormat(chart); setLegend(chart, p, _font); setTooltip(chart); setScale(chart); setAxis(chart); setColor(chart); writeOut(chart); }
From source file:UserInterface.ViewPatientJPanel.java
private void btnViewBarsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewBarsActionPerformed String legend = null;/*from w ww .j a v a 2 s. co m*/ DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (VitalSign vs : patient.vitalSignHistory.getVitalSignHistory()) { if (vs.getState().equalsIgnoreCase("ABNORMAL")) legend = vs.getTimestamp().concat(" (" + vs.getState() + ")"); else legend = vs.getTimestamp(); dataset.addValue(vs.getRespiratoryRate(), legend, "Respiratory Rate"); dataset.addValue(vs.getHeartRate(), legend, "Heart Rate"); dataset.addValue(vs.getSystolicBloodPressure(), legend, "Blood Pressure"); dataset.addValue(vs.getWeight(), legend, "Weight"); } JFreeChart chart = ChartFactory.createBarChart3D("Vital Signs", "Vital Signs", "Values", dataset, PlotOrientation.VERTICAL, true, true, true); CategoryPlot P = chart.getCategoryPlot(); P.setRangeGridlinePaint(Color.BLACK); ChartFrame frame = new ChartFrame("Bar Charts", chart); frame.setVisible(true); frame.setSize(650, 550); }
From source file:View.DialogoEstadisticas.java
private void creaGraficaIndicadores(int selectedIndex) { EdoRes e;/* w w w. j a va2 s .c om*/ DefaultCategoryDataset dataset; CategoryPlot p; switch (selectedIndex) { case 0: if (rdIntervalo.isSelected()) { rdIntervalo.doClick(); } DefaultPieDataset data = new DefaultPieDataset(); data.setValue("Efectivo: " + uts.formatPorcentaje(i.getPorLiq()) + " (" + uts.formatDinero(i.getEfectivo()) + ")", i.getPorLiq()); data.setValue("Clientes: " + uts.formatPorcentaje(i.getPorDebClientes()) + " (" + uts.formatDinero(i.getSaldoClientes()) + ")", i.getPorDebClientes()); data.setValue("Deudores Div: " + uts.formatPorcentaje(i.getPorDebDiv()) + " (" + uts.formatDinero(i.getSaldoDeuDiv()) + ")", i.getPorDebDiv()); data.setValue("Inversion: " + uts.formatPorcentaje(i.getPorInv()) + " (" + uts.formatDinero(i.getInversion()) + ")", i.getPorInv()); // Creando el Grafico chart = ChartFactory.createPieChart("Distribucin de Activo", data, true, true, false); chart.setBackgroundPaint(Color.lightGray); break; case 1: //Efectivo // Fuente de Datos dataset = new DefaultCategoryDataset(); for (Indicador ind : indicadores) { if (ind.getNombre().equals("Efectivo")) { if (combrobarIntervalo(ind.getPeriodo())) { dataset.setValue(ind.getValor(), "Efectivo", formatPeriodo(ind.getPeriodo())); } } } // Creando el Grafico chart = ChartFactory.createBarChart3D("Flujo de Efectivo", "Efectivo", "Periodos", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.lightGray); chart.getTitle().setPaint(Color.black); p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.blue); //titulos de eje y en vertical p = chart.getCategoryPlot(); CategoryAxis domainAxis = ((CategoryPlot) p).getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); break; case 2: //Margen // Fuente de Datos dataset = new DefaultCategoryDataset(); h.buscaPeriodos(); String[] periodos = h.getPeriodos(); for (String per : periodos) { if (combrobarIntervalo(per)) { System.out.println("------------------SI"); e = new EdoRes(per); dataset.setValue(e.getMargen(), formatPeriodo(per) + ": %" + uts.format2(e.getMargen()), formatPeriodo(per)); } else { System.out.println("-" + per + "-----NO"); } } // Creando el Grafico chart = ChartFactory.createBarChart3D("Margen de ganancia", "margen (%)", "periodos", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.lightGray); chart.getTitle().setPaint(Color.black); p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.blue); //titulos de eje y en vertical p = chart.getCategoryPlot(); CategoryAxis domainAxis2 = ((CategoryPlot) p).getDomainAxis(); domainAxis2.setCategoryLabelPositions(CategoryLabelPositions.UP_90); break; } chartPanel = new ChartPanel(chart); chartPanel.setVisible(true); chartPanel.setSize(723, 456); panelG.add(chartPanel); panelG.revalidate(); panelG.repaint(); }
From source file:lucee.runtime.tag.Chart.java
private void chartHorizontalBar() throws PageException, IOException { // create the chart... final JFreeChart chart = show3d ? ChartFactory.createBarChart3D(title, xaxistitle, yaxistitle, createDatasetCategory(), PlotOrientation.HORIZONTAL, false, true, false) : ChartFactory.createBarChart(title, xaxistitle, yaxistitle, createDatasetCategory(), PlotOrientation.HORIZONTAL, false, true, false); final CategoryPlot p = chart.getCategoryPlot(); p.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); Font _font = getFont();//from w w w . ja v a 2 s .c om // settings setBackground(chart, p); setBorder(chart, p); set3d(p); setFont(chart, _font); setLabelFormat(chart); setLegend(chart, p, _font); setTooltip(chart); setScale(chart); setAxis(chart); setColor(chart); writeOut(chart); }
From source file:co.edu.eam.dinesoft.egresados.vista.gui.VentanaReportes.java
/** * Grafica de barras indicando la cantidad de vacantes disponibles por * oferta laboral//from ww w .j ava 2s . c o m */ public void ofertasAbriertas() { ChartPanel panel; try { List<OfertaLaboral> listaOfertaLab = controlador.listarOfertas(); int contador = 0; AreasInteres areaAnterior = null; DefaultCategoryDataset ds = new DefaultCategoryDataset(); for (int i = 0; i < listaOfertaLab.size(); i++) { // Validacion de oferta if (listaOfertaLab.get(i).isCerrarOferta() == false) { areaAnterior = listaOfertaLab.get(i).getArea(); for (int j = 0; j < listaOfertaLab.size(); j++) { if (listaOfertaLab.get(j).getArea() == areaAnterior) { contador++; } } ds.addValue(contador, listaOfertaLab.get(i).getArea().getNombre(), listaOfertaLab.get(i).getArea().getNombre()); contador = 0; } } JFreeChart jf = ChartFactory.createBarChart3D("Reporte de ofertas abiertas", "Nombre de las ofertas", "Numero de vacantes", ds, PlotOrientation.VERTICAL, true, true, true); panel = new ChartPanel(jf); panel.setBounds(20, 20, 720, 320); panelOfertasAbiertas.add(panel); } catch (Exception e) { e.printStackTrace(); } }
From source file:direccion.Reportes.java
public Reportes() { String titulo = "Reportes"; jFrame = new JFrame(titulo); jFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); jFrame.setSize(800, 600);/*w w w . java2 s .c o m*/ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (screenSize.width / 2) - (jFrame.getSize().width / 2); int y = (screenSize.height / 2) - (jFrame.getSize().height / 2); jFrame.setLocation(x, y); JLabel etiqueta = new JLabel("Reportes"); etiqueta.setBounds(300, 25, 200, 50); etiqueta.setFont(new Font("Verdana", Font.BOLD, 30)); etiqueta.setForeground(Color.BLACK); JMenuBar jMenuBar = new JMenuBar(); JMenu acceso = new JMenu("Acceso a"); JMenu ayuda = new JMenu("Ayuda"); JMenuItem rec_hum = new JMenuItem("Recursos Humanos"); JMenuItem conta = new JMenuItem("Contabilidad"); JMenuItem ventas = new JMenuItem("Ventas"); JMenuItem compras = new JMenuItem("Compras"); JMenuItem inventario = new JMenuItem("Inventario"); JMenuItem acerca_de = new JMenuItem("Acerca de"); acerca_de.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Ayuda", "Ayuda", 3); } }); acceso.add(rec_hum); acceso.add(conta); acceso.add(ventas); acceso.add(compras); acceso.add(inventario); ayuda.add(acerca_de); jMenuBar.add(acceso); jMenuBar.add(ayuda); JCalendar cal1 = new JCalendar(); cal1.setBounds(250, 150, 400, 300); JCalendarCombo cal2 = new JCalendarCombo(); cal2.setBounds(250, 150, 400, 300); String reportes[] = { "Mantenimiento", "Compras", "Ventas", "Inventario", "Contabilidad", "Recursos Humanos" }; JComboBox combobox = new JComboBox(reportes); combobox.setBounds(300, 100, 150, 30); JLabel calendario = new JLabel("Fecha de Operacin:"); calendario.setBounds(60, 150, 150, 30); JButton aceptar = new JButton("Aceptar"); aceptar.setBounds(50, 200, 150, 30); aceptar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (combobox.getSelectedIndex() == 0) { datos_mantenimiento.setValue("Recursos Humanos", d_mant_rh); datos_mantenimiento.setValue("Contabilidad", d_mant_cont); datos_mantenimiento.setValue("Ventas", d_mant_vent); datos_mantenimiento.setValue("Compras", d_mant_comp); datos_mantenimiento.setValue("Inventario", d_mant_inv); datos_mantenimiento.setValue("Mantenimiento", d_mant_mant); Grafica = ChartFactory.createPieChart3D("Mantenimiento", datos_mantenimiento, true, true, true); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Mantenimiento.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(450, 450); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Mantenimiento"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Mantenimiento.xls"); Cell celda; String[] titulos = { "Recursos Humanos", "Contabilidad", "Ventas", "Compras", "Inventario", "Mantenimiento" }; Double[] datos = { d_mant_rh, d_mant_cont, d_mant_vent, d_mant_comp, d_mant_inv, d_mant_mant }; int i; for (i = 0; i < titulos.length; i++) { celda = fila.createCell(i); celda.setCellValue(titulos[i]); } fila = sheet.createRow(1); for (i = 0; i < datos.length; i++) { celda = fila.createCell(i); celda.setCellValue(datos[i]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } if (combobox.getSelectedIndex() == 1) { datos_compras.setValue("Nomina", d_comp_nom); datos_compras.setValue("Compras", d_comp_comp); datos_compras.setValue("Gastos Fijos", d_comp_gf); datos_compras.setValue("Gastos Variables", d_comp_gv); datos_compras.setValue("Gastos Otros", d_comp_go); Grafica = ChartFactory.createPieChart3D("Compras", datos_compras, true, true, true); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Compras.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); menu.setVisible(false); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(850, 850); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Compras"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Compras.xls"); Cell celda; String[] titulos = { "Nomina", "Compras", "Gastos Fijos", "Gastos Variables", "Gastos Otros" }; Double[] datos = { d_comp_nom, d_comp_comp, d_comp_gf, d_comp_gv, d_comp_go }; int i; for (i = 0; i < titulos.length; i++) { celda = fila.createCell(i); celda.setCellValue(titulos[i]); } fila = sheet.createRow(1); for (i = 0; i < datos.length; i++) { celda = fila.createCell(i); celda.setCellValue(datos[i]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } if (combobox.getSelectedIndex() == 2) { datos_ventas.addValue(d_vent_s1_lu, "Semana 1", "Lunes"); datos_ventas.addValue(d_vent_s1_ma, "Semana 1", "Martes"); datos_ventas.addValue(d_vent_s1_mi, "Semana 1", "Mircoles"); datos_ventas.addValue(d_vent_s1_ju, "Semana 1", "Jueves"); datos_ventas.addValue(d_vent_s1_vi, "Semana 1", "Viernes"); datos_ventas.addValue(d_vent_s1_sa, "Semana 1", "Sbado"); datos_ventas.addValue(d_vent_s1_do, "Semana 1", "Domingo"); datos_ventas.addValue(d_vent_s2_lu, "Semana 2", "Lunes"); datos_ventas.addValue(d_vent_s2_ma, "Semana 2", "Martes"); datos_ventas.addValue(d_vent_s2_mi, "Semana 2", "Mircoles"); datos_ventas.addValue(d_vent_s2_ju, "Semana 2", "Jueves"); datos_ventas.addValue(d_vent_s2_vi, "Semana 2", "Viernes"); datos_ventas.addValue(d_vent_s2_sa, "Semana 2", "Sbado"); datos_ventas.addValue(d_vent_s2_do, "Semana 2", "Domingo"); Grafica = ChartFactory.createLineChart3D("Ventas", "Das", "Ingresos", datos_ventas, PlotOrientation.VERTICAL, true, true, false); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Ventas.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(450, 450); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Ventas"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Ventas.xls"); Cell celda; String[] titulos1 = { "S1 lunes", "S1 martes", "S1 miercoles", "S1 jueves", "S1 viernes", "S1 sabado", "S1 domingo" }; String[] titulos2 = { "S2 lunes", "S2 martes", "S2 miercoles", "S2 jueves", "S2 viernes", "S2 sabado", "S2 domingo" }; Double[] datos1 = { d_vent_s1_lu, d_vent_s1_ma, d_vent_s1_mi, d_vent_s1_ju, d_vent_s1_vi, d_vent_s1_sa, d_vent_s1_do }; Double[] datos2 = { d_vent_s2_lu, d_vent_s2_ma, d_vent_s2_mi, d_vent_s2_ju, d_vent_s2_vi, d_vent_s2_sa, d_vent_s2_do }; int i, j; for (i = 0; i < titulos1.length; i++) { celda = fila.createCell(i); celda.setCellValue(titulos1[i]); } fila = sheet.createRow(1); for (i = 0; i < datos1.length; i++) { celda = fila.createCell(i); celda.setCellValue(datos1[i]); } fila = sheet.createRow(3); for (j = 0; j < titulos2.length; j++) { celda = fila.createCell(j); celda.setCellValue(titulos2[j]); } fila = sheet.createRow(4); for (j = 0; j < datos2.length; j++) { celda = fila.createCell(j); celda.setCellValue(datos2[j]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } if (combobox.getSelectedIndex() == 3) { datos_inventario.setValue("Producto 1", d_inv_p1); datos_inventario.setValue("Producto 2", d_inv_p2); datos_inventario.setValue("Producto 3", d_inv_p3); datos_inventario.setValue("Producto 4", d_inv_p4); datos_inventario.setValue("Producto 5", d_inv_p5); Grafica = ChartFactory.createPieChart3D("Inventario", datos_inventario, true, true, true); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Inventario.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(450, 450); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Inventario"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Inventario.xls"); Cell celda; String[] titulos = { "Producto 1", "Producto 2", "Prroducto 3", "Producto 4", "Producto 5" }; Double[] datos = { d_inv_p1, d_inv_p2, d_inv_p3, d_inv_p4, d_inv_p5 }; int i; for (i = 0; i < titulos.length; i++) { celda = fila.createCell(i); celda.setCellValue(titulos[i]); } fila = sheet.createRow(1); for (i = 0; i < datos.length; i++) { celda = fila.createCell(i); celda.setCellValue(datos[i]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } if (combobox.getSelectedIndex() == 4) { datos_contabilidad.addValue(d_cont_e_lu, "Entradas", "Lunes"); datos_contabilidad.addValue(d_cont_e_ma, "Entradas", "Martes"); datos_contabilidad.addValue(d_cont_e_mi, "Entradas", "Mircoles"); datos_contabilidad.addValue(d_cont_e_ju, "Entradas", "Jueves"); datos_contabilidad.addValue(d_cont_e_vi, "Entradas", "Viernes"); datos_contabilidad.addValue(d_cont_e_sa, "Entradas", "Sbado"); datos_contabilidad.addValue(d_cont_e_do, "Entradas", "Domingo"); datos_contabilidad.addValue(d_cont_s_lu, "Salidas", "Lunes"); datos_contabilidad.addValue(d_cont_s_ma, "Salidas", "Martes"); datos_contabilidad.addValue(d_cont_s_mi, "Salidas", "Mircoles"); datos_contabilidad.addValue(d_cont_s_ju, "Salidas", "Jueves"); datos_contabilidad.addValue(d_cont_s_vi, "Salidas", "Viernes"); datos_contabilidad.addValue(d_cont_s_sa, "Salidas", "Sbado"); datos_contabilidad.addValue(d_cont_s_do, "Salidas", "Domingo"); datos_contabilidad.addValue(d_cont_u_lu, "Utilidades", "Lunes"); datos_contabilidad.addValue(d_cont_u_ma, "Utilidades", "Martes"); datos_contabilidad.addValue(d_cont_u_mi, "Utilidades", "Mircoles"); datos_contabilidad.addValue(d_cont_u_ju, "Utilidades", "Jueves"); datos_contabilidad.addValue(d_cont_u_vi, "Utilidades", "Viernes"); datos_contabilidad.addValue(d_cont_u_sa, "Utilidades", "Sbado"); datos_contabilidad.addValue(d_cont_u_do, "Utilidades", "Domingo"); Grafica = ChartFactory.createLineChart3D("Contabilidad", "Das", "Ingresos", datos_contabilidad, PlotOrientation.VERTICAL, true, true, false); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Contabilidad.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(450, 450); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Contabilidad"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Contabilidad.xls"); Cell celda; String[] t_ent = { "E lunes", "E martes", "E miercoles", "E jueves", "E viernes", "E sabado", "E domingo" }; String[] t_sal = { "S lunes", "S martes", "S miercoles", "S jueves", "S viernes", "S sabado", "S domingo" }; String[] t_uti = { "U lunes", "U martes", "U miercoles", "U jueves", "U viernes", "U sabado", "U domingo" }; Double[] d_ent = { d_cont_e_lu, d_cont_e_ma, d_cont_e_mi, d_cont_e_ju, d_cont_e_vi, d_cont_e_sa, d_cont_e_do }; Double[] d_sal = { d_cont_s_lu, d_cont_s_ma, d_cont_s_mi, d_cont_s_ju, d_cont_s_vi, d_cont_s_sa, d_cont_s_do }; Double[] d_uti = { d_cont_u_lu, d_cont_u_ma, d_cont_u_mi, d_cont_u_ju, d_cont_u_vi, d_cont_u_sa, d_cont_u_do }; int i, j, k; for (i = 0; i < t_ent.length; i++) { celda = fila.createCell(i); celda.setCellValue(t_ent[i]); } fila = sheet.createRow(1); for (i = 0; i < d_ent.length; i++) { celda = fila.createCell(i); celda.setCellValue(d_ent[i]); } fila = sheet.createRow(3); for (j = 0; j < t_sal.length; j++) { celda = fila.createCell(j); celda.setCellValue(t_sal[j]); } fila = sheet.createRow(4); for (j = 0; j < d_sal.length; j++) { celda = fila.createCell(j); celda.setCellValue(d_sal[j]); } fila = sheet.createRow(6); for (k = 0; k < t_uti.length; k++) { celda = fila.createCell(k); celda.setCellValue(t_uti[k]); } fila = sheet.createRow(7); for (k = 0; k < d_uti.length; k++) { celda = fila.createCell(k); celda.setCellValue(d_uti[k]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } if (combobox.getSelectedIndex() == 5) { datos_rec_hum.addValue(d_rh_a_lu, "Asistencias", "Lunes"); datos_rec_hum.addValue(d_rh_a_ma, "Asistencias", "Martes"); datos_rec_hum.addValue(d_rh_a_mi, "Asistencias", "Mircoles"); datos_rec_hum.addValue(d_rh_a_ju, "Asistencias", "Jueves"); datos_rec_hum.addValue(d_rh_a_vi, "Asistencias", "Viernes"); datos_rec_hum.addValue(d_rh_a_sa, "Asistencias", "Sbado"); datos_rec_hum.addValue(d_rh_a_do, "Asistencias", "Domingo"); datos_rec_hum.addValue(d_rh_r_lu, "Retardos", "Lunes"); datos_rec_hum.addValue(d_rh_r_ma, "Retardos", "Martes"); datos_rec_hum.addValue(d_rh_r_mi, "Retardos", "Mircoles"); datos_rec_hum.addValue(d_rh_r_ju, "Retardos", "Jueves"); datos_rec_hum.addValue(d_rh_r_vi, "Retardos", "Viernes"); datos_rec_hum.addValue(d_rh_r_sa, "Retardos", "Sbado"); datos_rec_hum.addValue(d_rh_r_do, "Retardos", "Domingo"); datos_rec_hum.addValue(d_rh_f_lu, "Faltas", "Lunes"); datos_rec_hum.addValue(d_rh_f_ma, "Faltas", "Martes"); datos_rec_hum.addValue(d_rh_f_mi, "Faltas", "Mircoles"); datos_rec_hum.addValue(d_rh_f_ju, "Faltas", "Jueves"); datos_rec_hum.addValue(d_rh_f_vi, "Faltas", "Viernes"); datos_rec_hum.addValue(d_rh_f_sa, "Faltas", "Sbado"); datos_rec_hum.addValue(d_rh_f_do, "Faltas", "Domingo"); Grafica = ChartFactory.createBarChart3D("Recursos Humanos", "Das", "Nmero de Empleados", datos_rec_hum, PlotOrientation.VERTICAL, true, true, false); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Recursos Humanos.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(450, 450); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Recursos Humanos"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Recursos Humanos.xls"); Cell celda; String[] t_asi = { "A lunes", "A martes", "A miercoles", "A jueves", "A viernes", "A sabado", "A domingo" }; String[] t_ret = { "R lunes", "R martes", "R miercoles", "R jueves", "R viernes", "R sabado", "R domingo" }; String[] t_fal = { "F lunes", "F martes", "F miercoles", "F jueves", "F viernes", "F sabado", "F domingo" }; int[] d_asi = { d_rh_a_lu, d_rh_a_ma, d_rh_a_mi, d_rh_a_ju, d_rh_a_vi, d_rh_a_sa, d_rh_a_do }; int[] d_ret = { d_rh_r_lu, d_rh_r_ma, d_rh_r_mi, d_rh_r_ju, d_rh_r_vi, d_rh_r_sa, d_rh_r_do }; int[] d_fal = { d_rh_f_lu, d_rh_r_ma, d_rh_r_mi, d_rh_r_ju, d_rh_r_vi, d_rh_r_sa, d_rh_r_do }; int i, j, k; for (i = 0; i < t_asi.length; i++) { celda = fila.createCell(i); celda.setCellValue(t_asi[i]); } fila = sheet.createRow(1); for (i = 0; i < d_asi.length; i++) { celda = fila.createCell(i); celda.setCellValue(d_asi[i]); } fila = sheet.createRow(3); for (j = 0; j < t_ret.length; j++) { celda = fila.createCell(j); celda.setCellValue(t_ret[j]); } fila = sheet.createRow(4); for (j = 0; j < d_ret.length; j++) { celda = fila.createCell(j); celda.setCellValue(d_ret[j]); } fila = sheet.createRow(6); for (k = 0; k < t_fal.length; k++) { celda = fila.createCell(k); celda.setCellValue(t_fal[k]); } fila = sheet.createRow(7); for (k = 0; k < d_fal.length; k++) { celda = fila.createCell(k); celda.setCellValue(d_fal[k]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } } }); jPanel = new JPanel(); jPanel.setLayout(null); jPanel.add(cal1); jPanel.add(cal2); jPanel.add(etiqueta); jPanel.add(combobox); jPanel.add(calendario); jPanel.add(aceptar); jFrame.setJMenuBar(jMenuBar); jFrame.add(jPanel); jFrame.setVisible(true); }
From source file:org.pentaho.chart.plugin.jfreechart.JFreeChartFactoryEngine.java
public JFreeChart makeBarChart(ChartModel chartModel, MultiSeriesDataModel dataModel, IChartLinkGenerator linkGenerator) { DefaultCategoryDataset categoryDataset = createCategoryDataset(dataModel); org.pentaho.chart.model.TwoAxisPlot twoAxisPlot = (org.pentaho.chart.model.TwoAxisPlot) chartModel .getPlot();//from w ww .ja v a 2 s. c om String title = ""; if ((chartModel.getTitle() != null) && (chartModel.getTitle().getText() != null) && (chartModel.getTitle().getText().trim().length() > 0)) { title = chartModel.getTitle().getText(); } AxesLabels axesLabels = getAxesLabels(chartModel); PlotOrientation plotOrientation = (twoAxisPlot.getOrientation() == Orientation.HORIZONTAL) ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL; boolean showLegend = (chartModel.getLegend() != null) && (chartModel.getLegend().getVisible()); JFreeChart chart = null; if (BarPlotFlavor.THREED == ((BarPlot) twoAxisPlot).getFlavor()) { chart = ChartFactory.createBarChart3D(title, axesLabels.domainAxisLabel, axesLabels.rangeAxisLabel, categoryDataset, plotOrientation, showLegend, true, false); } else if (BarPlotFlavor.STACKED == ((BarPlot) twoAxisPlot).getFlavor()) { chart = ChartFactory.createStackedBarChart(title, axesLabels.domainAxisLabel, axesLabels.rangeAxisLabel, categoryDataset, plotOrientation, showLegend, true, false); } else { chart = ChartFactory.createBarChart(title, axesLabels.domainAxisLabel, axesLabels.rangeAxisLabel, categoryDataset, plotOrientation, showLegend, true, false); } initCategoryPlot(chart, chartModel, linkGenerator); initChart(chart, chartModel); return chart; }
From source file:jhplot.HChart.java
/** * Update the chart//from www . ja va 2 s . c o m * * @param N1 * location in X * @param N2 * location in Y */ public void update(int N1, int N2) { if (cdatPie[N1][N2] != null || cdatPie3D[N1][N2] != null || cdatBar[N1][N2] != null || cdatBar3D[N1][N2] != null || cdatLine[N1][N2] != null || cdatArea[N1][N2] != null || cdatPolar[N1][N2] != null) { if (cdatPie[N1][N2] != null) { chart[N1][N2] = ChartFactory.createPieChart(title[N1][N2], (PieDataset) cdatPie[N1][N2], true, true, true); } else if (cdatPie3D[N1][N2] != null) { chart[N1][N2] = ChartFactory.createPieChart3D(title[N1][N2], (PieDataset) cdatPie3D[N1][N2], true, true, true); PiePlot3D pieplot3d = (PiePlot3D) chart[N1][N2].getPlot(); // pieplot3d.setStartAngle(290D); // pieplot3d.setDirection(Rotation.CLOCKWISE); // pieplot3d.setForegroundAlpha(0.5F); pieplot3d.setBackgroundPaint(DEFAULT_BG_COLOR); } else if (cdatBar[N1][N2] != null) { chart[N1][N2] = ChartFactory.createBarChart(title[N1][N2], titleX[N1][N2], titleY[N1][N2], (CategoryDataset) cdatBar[N1][N2], PlotOrientation.VERTICAL, true, true, true); CategoryPlot lineplot = (CategoryPlot) chart[N1][N2].getPlot(); CategoryAxis yy = lineplot.getDomainAxis(); yy.setTickLabelPaint(tickColor); yy.setTickLabelFont(tickFont); yy.setLabelPaint(labelColor); yy.setLabelFont(labelFont); yy.setAxisLineStroke(new BasicStroke(axisPenwidth)); yy.setAxisLinePaint(Color.black); ValueAxis xx = lineplot.getRangeAxis(); xx.setTickLabelPaint(tickColor); xx.setTickLabelFont(tickFont); xx.setLabelPaint(labelColor); xx.setLabelFont(labelFont); xx.setAxisLineStroke(new BasicStroke(axisPenwidth)); xx.setAxisLinePaint(Color.black); } else if (cdatBar3D[N1][N2] != null) { chart[N1][N2] = ChartFactory.createBarChart3D(title[N1][N2], titleX[N1][N2], titleY[N1][N2], (CategoryDataset) cdatBar3D[N1][N2], PlotOrientation.VERTICAL, true, true, true); } else if (cdatLine[N1][N2] != null) { chart[N1][N2] = ChartFactory.createLineChart(title[N1][N2], titleX[N1][N2], titleY[N1][N2], (CategoryDataset) cdatLine[N1][N2], PlotOrientation.VERTICAL, true, true, true); CategoryPlot lineplot = (CategoryPlot) chart[N1][N2].getPlot(); lineplot.setOutlineStroke(new BasicStroke(axisPenwidth)); CategoryAxis yy = lineplot.getDomainAxis(); yy.setTickLabelPaint(tickColor); yy.setTickLabelFont(tickFont); yy.setLabelPaint(labelColor); yy.setLabelFont(labelFont); yy.setAxisLineStroke(new BasicStroke(axisPenwidth)); yy.setAxisLinePaint(Color.black); ValueAxis xx = lineplot.getRangeAxis(); xx.setTickLabelPaint(tickColor); xx.setTickLabelFont(tickFont); xx.setLabelPaint(labelColor); xx.setLabelFont(labelFont); xx.setAxisLineStroke(new BasicStroke(axisPenwidth)); xx.setAxisLinePaint(Color.black); LineAndShapeRenderer renderer = (LineAndShapeRenderer) lineplot.getRenderer(); renderer.setBaseStroke(new BasicStroke(linestroke)); for (int m = 0; m < cdatLine[N1][N2].getColumnCount() + 1; m++) renderer.setSeriesStroke(m, new BasicStroke(linestroke)); } else if (cdatPolar[N1][N2] != null) { chart[N1][N2] = ChartFactory.createPolarChart(title[N1][N2], (XYSeriesCollection) cdatPolar[N1][N2], true, true, true); PolarPlot lineplot = (PolarPlot) chart[N1][N2].getPlot(); ValueAxis yy = lineplot.getAxis(); yy.setTickLabelPaint(tickColor); yy.setTickLabelFont(tickFont); yy.setLabelPaint(labelColor); yy.setLabelFont(labelFont); yy.setAxisLineStroke(new BasicStroke(axisPenwidth)); yy.setAxisLinePaint(Color.black); } else if (cdatArea[N1][N2] != null) { chart[N1][N2] = ChartFactory.createAreaChart(title[N1][N2], titleX[N1][N2], titleY[N1][N2], (CategoryDataset) cdatArea[N1][N2], PlotOrientation.VERTICAL, true, true, true); CategoryPlot lineplot = (CategoryPlot) chart[N1][N2].getPlot(); CategoryAxis yy = lineplot.getDomainAxis(); yy.setTickLabelPaint(tickColor); yy.setTickLabelFont(tickFont); yy.setLabelPaint(labelColor); yy.setLabelFont(labelFont); yy.setAxisLineStroke(new BasicStroke(axisPenwidth)); yy.setAxisLinePaint(Color.black); ValueAxis xx = lineplot.getRangeAxis(); xx.setTickLabelPaint(tickColor); xx.setTickLabelFont(tickFont); xx.setLabelPaint(labelColor); xx.setLabelFont(labelFont); xx.setAxisLineStroke(new BasicStroke(axisPenwidth)); xx.setAxisLinePaint(Color.black); } chart[N1][N2].setAntiAlias(antiAlias); chart[N1][N2].setBorderPaint(DEFAULT_BG_COLOR); chart[N1][N2].setBackgroundPaint(DEFAULT_BG_COLOR); chart[N1][N2].setBorderVisible(false); cp[N1][N2].setChart(chart[N1][N2]); return; } for (int i = 0; i < indexdat[N1][N2]; i++) { if (type[N1][N2].get(i) == "array") xyplot[N1][N2].setRenderer(i, (StandardXYItemRenderer) (rdat[N1][N2].get(i))); else if (type[N1][N2].get(i) == "f") xyplot[N1][N2].setRenderer(i, (XYLineAndShapeRenderer) (rdat[N1][N2].get(i))); else if (type[N1][N2].get(i) == "h") xyplot[N1][N2].setRenderer(i, (XYBarRenderer) (rdat[N1][N2].get(i))); else if (type[N1][N2].get(i) == "p") xyplot[N1][N2].setRenderer(i, (XYLineAndShapeRenderer) (rdat[N1][N2].get(i))); else if (type[N1][N2].get(i) == "pe") xyplot[N1][N2].setRenderer(i, (XYErrorRenderer) (rdat[N1][N2].get(i))); // System.out.println(i); } chart[N1][N2] = new JFreeChart(title[N1][N2], JFreeChart.DEFAULT_TITLE_FONT, xyplot[N1][N2], true); chart[N1][N2].setAntiAlias(antiAlias); chart[N1][N2].setBorderPaint(DEFAULT_BG_COLOR); chart[N1][N2].setBackgroundPaint(DEFAULT_BG_COLOR); chart[N1][N2].setBorderVisible(false); cp[N1][N2].setChart(chart[N1][N2]); }
From source file:PDF.Reportes.java
public ArrayList<JFreeChart> grafica(String usuario, String contra) { // IngresoAbd bd = new IngresoAbd(usuario, contra); ArrayList<JFreeChart> graficas = new ArrayList(); List<Beans.Reportes> reportes = ReportesDAO.statusFichas(usuario, contra); // reportes = bd.statusFichas(); Beans.Reportes report = ReportesDAO.preFichas(usuario, contra); // report = bd.preFichas(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); DefaultPieDataset dataset3 = new DefaultPieDataset(); if (reportes == null || report == null) { return graficas; } else {/*from w ww . j a va 2s .c o m*/ for (Beans.Reportes reporte : reportes) { String carrera = ""; if (reporte.getNombre().contentEquals("INGENIER?A MECATRNICA")) { carrera = "IMCT"; } if (reporte.getNombre().contentEquals("INGENIER?A ELECTROMEC?NICA")) { carrera = "IEME"; } if (reporte.getNombre().contentEquals("INGENIER?A EN SISTEMAS COMPUTACIONALES")) { carrera = "ISC"; } if (reporte.getNombre().contentEquals("INGENIER?A ELECTRNICA")) { carrera = "IELC"; } if (reporte.getNombre().contentEquals("INGENIER?A EN LOG?STICA")) { carrera = "ILOG"; } if (reporte.getNombre().contentEquals("INGENIER?A INDUSTRIAL")) { carrera = "IIND"; } if (reporte.getNombre().contentEquals("INGENIER?A EN GESTION EMPRESARIAL")) { carrera = "IGEM"; } if (reporte.getNombre() .contentEquals("INGENIER?A EN TECNOLOG?AS DE LA INFORMACIN Y COMUNICACIONES")) { carrera = "TICS"; } if (reporte.getNombre().contentEquals("INGENIER?A QUIMICA")) { carrera = "IQUI"; } dataset.setValue(Integer.parseInt(reporte.getPreficha()), reporte.getPreficha(), carrera); } // Visitas del sitio web 2 JFreeChart chart = ChartFactory.createBarChart3D("Prefichas por carrera", "", "Nmero de prefichas", dataset, PlotOrientation.HORIZONTAL, true, true, false); for (Beans.Reportes reporte : reportes) { String carrera = ""; if (reporte.getNombre().contentEquals("INGENIER?A MECATRNICA")) { carrera = "IMCT"; } if (reporte.getNombre().contentEquals("INGENIER?A ELECTROMEC?NICA")) { carrera = "IEME"; } if (reporte.getNombre().contentEquals("INGENIER?A EN SISTEMAS COMPUTACIONALES")) { carrera = "ISC"; } if (reporte.getNombre().contentEquals("INGENIER?A ELECTRNICA")) { carrera = "IELC"; } if (reporte.getNombre().contentEquals("INGENIER?A EN LOG?STICA")) { carrera = "ILOG"; } if (reporte.getNombre().contentEquals("INGENIER?A INDUSTRIAL")) { carrera = "IIND"; } if (reporte.getNombre().contentEquals("INGENIER?A EN GESTION EMPRESARIAL")) { carrera = "IGEM"; } if (reporte.getNombre() .contentEquals("INGENIER?A EN TECNOLOG?AS DE LA INFORMACIN Y COMUNICACIONES")) { carrera = "TICS"; } if (reporte.getNombre().contentEquals("INGENIER?A QUIMICA")) { carrera = "IQUI"; } dataset2.setValue(Integer.parseInt(reporte.getPrefpagadas()), reporte.getPrefpagadas(), carrera); } JFreeChart chart2 = ChartFactory.createBarChart3D("Prefichas pagadas por carrera", "", "Nmero de prefichas", dataset2, PlotOrientation.HORIZONTAL, true, true, false); int prefichas = 0; if (Integer.parseInt(report.getPreficha()) >= 0) { prefichas = Integer.parseInt(report.getPreficha()); } dataset3.setValue("Prefichas pagadas: " + report.getPrefpagadas(), Integer.parseInt(report.getPrefpagadas())); dataset3.setValue("Prefichas por pagar: " + report.getPreproc(), Integer.parseInt(report.getPreproc())); dataset3.setValue("Prefichas disponibles: " + prefichas, prefichas); JFreeChart chart3 = ChartFactory.createPieChart3D("Meta Deseada: " + report.getNombre(), dataset3); graficas.add(chart3); graficas.add(chart); graficas.add(chart2); } return graficas; }