public static void graficar(double []aptitudProm){
        double [] auxiliar ; int cont=0;
        for(int i=0; i<aptitudProm.length;i++){
            if(aptitudProm[i] == 0 && i!=0){
                i=aptitudProm.length;
            }
            cont++;           
        }
        auxiliar = new double [cont];
        System.arraycopy(aptitudProm, 0, auxiliar, 0, auxiliar.length);
        XYSeries series = new XYSeries("XYGraph");       
        for (int i=0; (i<cont);i++){
            series.add(i,auxiliar[i]);
            
        }        
        // Add the series to your data set
        XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(series);
        // Generate the graph
        JFreeChart chart = ChartFactory.createXYLineChart(
                "XY Chart", // Title
                "x-axis", // x-axis Label
                "y-axis", // y-axis Label
                dataset, // Dataset
                PlotOrientation.VERTICAL, // Plot Orientation
                true, // Show Legend
                true, // Use tooltips
                false // Configure chart to generate URLs?
                );         
       // jPanel1 = new ChartPanel (chart);
        XYPlot plot = (XYPlot) chart.getPlot();
        plot.setBackgroundPaint(Color.LIGHT_GRAY);
        plot.setDomainGridlinePaint(Color.white);
        plot.setRangeGridlinePaint(Color.white);
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer)plot.getRenderer();
        renderer.setSeriesPaint(0, Color.BLUE);
        BufferedImage graficoLinea = null;
        graficoLinea = chart.createBufferedImage(590, 220);
        jLabelGrafica.setIcon(new ImageIcon(graficoLinea));
        jPanel1.updateUI();
    }