List of usage examples for org.jfree.chart.renderer.xy XYLineAndShapeRenderer setSeriesShapesVisible
public void setSeriesShapesVisible(int series, Boolean flag)
From source file:org.hsh.bfr.db.gui.dbtable.editoren.MyChartDialog.java
/** * Creates a chart.//from w ww. j a v a2 s .c om * * @param dataset the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset, String xAxis, String yAxis) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("", // chart title xAxis, // x axis label yAxis, // y axis label dataset, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); //plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(0, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:org.gephi.statistics.plugin.DegreeDistribution.java
/** * * @return The undirected version of this report. *//*w ww.j av a 2s . com*/ private String getUndirectedReport() { double max = 0; XYSeries series2 = new XYSeries("Series 2"); for (int i = 1; i < combinedDistribution[1].length; i++) { if (combinedDistribution[1][i] > 0) { series2.add((Math.log(combinedDistribution[0][i]) / Math.log(Math.E)), (Math.log(combinedDistribution[1][i]) / Math.log(Math.E))); max = (float) Math.max((Math.log(combinedDistribution[0][i]) / Math.log(Math.E)), max); } } double a = combinedAlpha; double b = combinedBeta; XYSeries series1 = new XYSeries(combinedAlpha + " "); series1.add(0, a); series1.add(max, a + b * max); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series1); dataset.addSeries(series2); JFreeChart chart = ChartFactory.createXYLineChart("Degree Distribution", "Degree", "Occurrence", dataset, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(0, false); renderer.setSeriesLinesVisible(1, false); renderer.setSeriesShapesVisible(1, true); renderer.setSeriesShape(1, new java.awt.geom.Ellipse2D.Double(0, 0, 1, 1)); plot.setBackgroundPaint(java.awt.Color.WHITE); plot.setDomainGridlinePaint(java.awt.Color.GRAY); plot.setRangeGridlinePaint(java.awt.Color.GRAY); plot.setRenderer(renderer); String imageFile = ""; try { final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); TempDir tempDir = TempDirUtils.createTempDir(); final String fileName = "distribution.png"; final File file1 = tempDir.createFile(fileName); imageFile = "<IMG SRC=\"file:" + file1.getAbsolutePath() + "\" " + "WIDTH=\"600\" HEIGHT=\"400\" BORDER=\"0\" USEMAP=\"#chart\"></IMG>"; ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info); } catch (IOException e) { System.out.println(e.toString()); } String report = "<HTML> <BODY> <h1>Degree Distribution Metric Report </h1> " + "<hr>" + "<br>" + "<h2> Parameters: </h2>" + "Network Interpretation: " + (isDirected ? "directed" : "undirected") + "<br>" + "<br> <h2> Results: </h2>" + "Degree Power Law: -" + combinedAlpha + "\n <BR>" + imageFile + "</BODY> </HTML>"; return report; }
From source file:correlation.and.regression.analysis.MainWindow.java
private void showCorrelationField() { XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries correlation = new XYSeries("Correlation Field"); for (int i = 0; i < arr[0].countOfNumbers; i++) { //XYSeries tmp = new XYSeries(""+i); correlation.add(arr[0].getNumber(i), arr[1].getNumber(i)); //tmp.add(arr[0].getNumber(i), arr[1].getNumber(i)); //dataset.addSeries(tmp); }// w ww.j av a 2s. c o m dataset.addSeries(correlation); XYSeries regr = StaticFunctions.drawRegressionLine(arr[0], arr[1]); dataset.addSeries(regr); XYSeries ConfidenceIntervalMax = StaticFunctions.drawConfidenceIntervalMax(arr[0], arr[1]); dataset.addSeries(ConfidenceIntervalMax); XYSeries ConfidenceIntervalMin = StaticFunctions.drawConfidenceIntervalMin(arr[0], arr[1]); dataset.addSeries(ConfidenceIntervalMin); XYSeries Confidence2IntervalMax = StaticFunctions.drawConfidence2IntervalMax(arr[0], arr[1]); dataset.addSeries(Confidence2IntervalMax); XYSeries Confidence2IntervalMin = StaticFunctions.drawConfidence2IntervalMin(arr[0], arr[1]); dataset.addSeries(Confidence2IntervalMin); XYSeries TolerantIntervalMax = StaticFunctions.drawTolerantIntervalMax(arr[0], arr[1]); dataset.addSeries(TolerantIntervalMax); XYSeries TolerantIntervalMin = StaticFunctions.drawTolerantIntervalMin(arr[0], arr[1]); dataset.addSeries(TolerantIntervalMin); JFreeChart chart = ChartFactory.createXYLineChart("Relation", "X", "Y", dataset, PlotOrientation.VERTICAL, true, true, false); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(1, false); renderer.setSeriesShapesVisible(2, false); renderer.setSeriesShapesVisible(3, false); renderer.setSeriesShapesVisible(4, false); renderer.setSeriesShapesVisible(5, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChP = new ChartPanel(chart); ChP.setSize(jSPanelChart.getWidth(), jSPanelChart.getHeight()); jSPanelChart.removeAll(); jSPanelChart.revalidate(); jSPanelChart.add(ChP); jSPanelChart.repaint(); }
From source file:com.mugarov.neview.view.GraphPanel.java
public void setValues(ArrayList<DotBag> dotBags, ArrayList<Median> lines, String name) { CoordinateSeries ser;/*from w w w. jav a 2 s. c o m*/ for (DotBag db : dotBags) { ser = new CoordinateSeries(db.getName()); for (Dot d : db) { ser.add(d.getCoordinates(), d.getName(), d.getScaffoldName()); // System.out.println("New dot:"+d.getLogX()+", "+d.getLogY()); } this.dotSeries.add(ser); } for (Median med : lines) { ser = new CoordinateSeries(med.getName()); ser.add(med.getStart(), med.getName(), null); ser.add(med.getEnd(), med.getName(), null); // System.out.println("New line from " + med.getStart().getX()+","+ med.getStart().getY()+" to "+med.getEnd().getX()+","+ med.getEnd().getY()); this.lineSeries.add(ser); } this.seriesCollection = new CoordinateSeriesCollection(); for (CoordinateSeries dotSeries : this.dotSeries) { this.seriesCollection.addSeries(dotSeries); } for (CoordinateSeries line : this.lineSeries) { this.seriesCollection.addSeries(line); } this.chart = ChartFactory.createXYLineChart(name, GraphPanel.XAxis, GraphPanel.YAxis, this.seriesCollection, PlotOrientation.VERTICAL, true, true, false); this.chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); ExpAxis x1Axis = new ExpAxis(GraphPanel.XAxis); ExpAxis y1Axis = new ExpAxis(GraphPanel.YAxis); NumberAxis x2Axis = new NumberAxis("Proportion to max of " + GraphPanel.XAxis); NumberAxis y2Axis = new NumberAxis("Proportion to max of " + GraphPanel.YAxis); plot.setDomainAxis(0, x1Axis); plot.setDomainAxis(1, x2Axis); plot.setRangeAxis(0, y1Axis); plot.setRangeAxis(1, y2Axis); // plot.setDomainAxis(1, yAxis); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); for (int i = 0; i < this.dotSeries.size(); i++) { renderer.setSeriesLinesVisible(i, false); renderer.setSeriesPaint(i, this.colorGen.get(i)); } for (int i = this.dotSeries.size(); i < this.lineSeries.size() + this.dotSeries.size(); i++) { renderer.setSeriesShapesVisible(i, false); // renderer.setSeriesPaint(i, Color.black); renderer.setSeriesPaint(i, this.colorGen.get(i - this.dotSeries.size())); } renderer.setBaseToolTipGenerator(new ItemGenerator()); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.MAGENTA); plot.setRangeGridlinePaint(Color.MAGENTA); boolean add = (this.chartPanel == null); this.chartPanel = new ChartPanel(chart); if (add) { this.content.add(this.chartPanel, BorderLayout.CENTER); this.scroll.setViewportView(this.chartPanel); } this.setBackground(Color.green); this.chartPanel.setBackground(Color.MAGENTA); this.updateUI(); }
From source file:guineu.modules.filter.Alignment.RANSAC.AlignmentRansacPlot.java
public AlignmentRansacPlot() { super(null, true); dataset = new XYSeriesCollection(); chart = ChartFactory.createXYLineChart("", null, null, dataset, PlotOrientation.VERTICAL, true, true, false);/*from w w w. j a va 2 s. c o m*/ chart.setBackgroundPaint(Color.white); setChart(chart); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); // legend constructed by ChartFactory legend = chart.getLegend(); legend.setItemFont(legendFont); // legend.setFrame(BlockBorder.NONE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); // set default renderer properties XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseLinesVisible(false); renderer.setBaseShapesVisible(true); renderer.setSeriesShape(0, dataPointsShape); renderer.setSeriesShape(1, dataPointsShape); renderer.setSeriesLinesVisible(2, true); renderer.setSeriesShapesVisible(2, false); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GRAY); renderer.setSeriesPaint(2, Color.BLUE); renderer.setBaseItemLabelPaint(labelsColor); plot.setRenderer(renderer); }
From source file:net.sf.mzmine.modules.peaklistmethods.alignment.ransac.AlignmentRansacPlot.java
public AlignmentRansacPlot() { super(null, true); dataset = new XYSeriesCollection(); chart = ChartFactory.createXYLineChart("", null, null, dataset, PlotOrientation.VERTICAL, true, true, false);/*from ww w.j av a 2 s. co m*/ chart.setBackgroundPaint(Color.white); setChart(chart); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); // legend constructed by ChartFactory legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); // set default renderer properties XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseLinesVisible(false); renderer.setBaseShapesVisible(true); renderer.setSeriesShape(0, dataPointsShape); renderer.setSeriesShape(1, dataPointsShape); renderer.setSeriesLinesVisible(2, true); renderer.setSeriesShapesVisible(2, false); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GRAY); renderer.setSeriesPaint(2, Color.BLUE); renderer.setBaseItemLabelPaint(labelsColor); plot.setRenderer(renderer); }
From source file:org.tolven.web.ChartAction.java
/** * Create Growth Chart/*from w ww.j av a 2 s . co m*/ * * @author Suja * added on 02/01/2011 * @param type - 1: Height & 2: Weight * @return */ public JFreeChart createChart(int type) { long patientId = Long.parseLong(getRequestParameter("element").toString().split(":")[1].split("-")[1]); MenuData patMD = getMenuLocal().findMenuDataItem(patientId); int age = 0; int gender = 1; Date dob = null; if (patMD != null) { DateFormat df = new SimpleDateFormat("yyyy"); dob = patMD.getDate01(); Date cur = new Date(); age = Integer.parseInt(df.format(cur)) - Integer.parseInt(df.format(dob)); if (patMD.getString04().equals("Male")) gender = 1; else gender = 2; } // create dataset XYDataset dataset = createDataset(type, gender, age, dob); String title = ""; if (type == 1 && age < 3) title = "Height birth to 36 Months Old " + (gender == 1 ? "Male" : "Female"); else if (type == 1 && age >= 3) title = "Height 2-20 Year Old " + (gender == 1 ? "Male" : "Female"); else if (type == 2 && age < 3) title = "Weight birth to 36 Months Old " + (gender == 1 ? "Male" : "Female"); else if (type == 2 && age >= 3) title = "Weight 2-20 Year Old " + (gender == 1 ? "Male" : "Female"); JFreeChart chart = ChartFactory.createTimeSeriesChart(title, // title "X-Value", // x-axis label "Y-Value", // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.lightGray); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); for (int i = 1; i < 10; i++) { renderer.setSeriesLinesVisible(i, true); renderer.setSeriesShapesVisible(i, false); } renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(0, true); plot.setRenderer(renderer); plot.setDomainAxis(new NumberAxis("Age (Months)")); plot.setRangeAxis(new NumberAxis((type == 1 ? "Height (Centimeters)" : "Weight (Kilograms)"))); return chart; }
From source file:guineu.modules.filter.Alignment.RANSACGCGC.AlignmentGCGCRansacPlot.java
public AlignmentGCGCRansacPlot() { super(null, true); dataset = new XYSeriesCollection(); chart = ChartFactory.createXYLineChart("", null, null, dataset, PlotOrientation.VERTICAL, true, true, false);//from www .j ava 2s. c o m chart.setBackgroundPaint(Color.white); setChart(chart); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); // legend constructed by ChartFactory legend = chart.getLegend(); legend.setItemFont(legendFont); // legend.setFrame(BlockBorder.NONE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); // set default renderer properties XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseLinesVisible(false); renderer.setBaseShapesVisible(true); renderer.setSeriesShape(0, dataPointsShape); renderer.setSeriesShape(1, dataPointsShape); renderer.setSeriesLinesVisible(2, true); renderer.setSeriesShapesVisible(2, false); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GRAY); renderer.setSeriesPaint(2, Color.BLUE); renderer.setBaseItemLabelPaint(labelsColor); plot.setRenderer(renderer); }
From source file:edu.ucla.stat.SOCR.chart.ChartGenerator.java
protected JFreeChart createQQChart(String title, String xLabel, String yLabel, XYDataset dataset, String other) {/*from ww w.j a v a2s . c om*/ // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title xLabel, // x axis label yLabel, // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); // renderer.setShapesVisible(true); renderer.setBaseShapesFilled(true); // renderer.setLinesVisible(false); renderer.setSeriesLinesVisible(1, true); renderer.setSeriesShapesVisible(1, false); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(0, true); //renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setUpperMargin(0); rangeAxis.setLowerMargin(0); // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setUpperMargin(0); domainAxis.setLowerMargin(0); // domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. //setQQSummary(dataset); // very confusing return chart; }
From source file:regresiones.RegresionMultiple.java
private void pintar(Double[] Yestimada, JTabbedPane resultados, Double[][] auxiliar) { // mostramos resultados para la pestaa resultados*********************************************************************** JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(Color.white); JLabel titulo = new JLabel("Resultados");//creamos el titulo panel.add(titulo, BorderLayout.PAGE_START);//lo agregamos al inicio jtable = new JTable();//creamos la tabla a mostrar jtable.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 0, 0), 2, true)); jtable.setFont(new java.awt.Font("Arial", 1, 14)); jtable.setColumnSelectionAllowed(true); jtable.setCursor(new java.awt.Cursor(java.awt.Cursor.N_RESIZE_CURSOR)); jtable.setInheritsPopupMenu(true);/*from www.j a va 2 s . c o m*/ jtable.setMinimumSize(new java.awt.Dimension(80, 80)); String[] titulos = { "X1", "X2", "Y", "Y estimada", "X1^2", "X2^2", "X1*Y", "X2*Y", "Y-Y estimada" };//los titulos de la tabla arregloFinal = new String[N][9]; DecimalFormat formato = new DecimalFormat("0.00"); for (int i = 0; i < N; i++) {//armamos el arreglo arregloFinal[i][0] = datos[i][0] + ""; arregloFinal[i][1] = datos[i][1] + ""; arregloFinal[i][2] = datos[i][2] + ""; arregloFinal[i][3] = formato.format(Yestimada[i]); arregloFinal[i][4] = formato.format(auxiliar[i][0]); arregloFinal[i][5] = formato.format(auxiliar[i][1]); arregloFinal[i][6] = formato.format(auxiliar[i][2]); arregloFinal[i][7] = formato.format(auxiliar[i][3]); arregloFinal[i][8] = formato.format(auxiliar[i][4]); } DefaultTableModel TableModel = new DefaultTableModel(arregloFinal, titulos); jtable.setModel(TableModel); JScrollPane jScrollPane1 = new JScrollPane(); jScrollPane1.setViewportView(jtable); jtable.getColumnModel().getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); panel.add(jScrollPane1, BorderLayout.CENTER); JPanel panel2 = new JPanel(new GridLayout(0, 6));//creo un panel con rejilla de 4 columnas JLabel etiquetaN = new JLabel("N"); JTextField cajaN = new JTextField(); cajaN.setText(N + ""); cajaN.setEditable(false); JLabel etiquetaK = new JLabel("K"); JTextField cajaK = new JTextField(); cajaK.setText("2"); cajaK.setEditable(false); JLabel etiquetab0 = new JLabel("b0"); JTextField cajab0 = new JTextField(); cajab0.setText(formato.format(b0) + ""); cajab0.setEditable(false); JLabel etiquetab1 = new JLabel("b1"); JTextField cajab1 = new JTextField(); cajab1.setText(formato.format(b1) + ""); cajab1.setEditable(false); JLabel etiquetab2 = new JLabel("b2"); JTextField cajab2 = new JTextField(); cajab2.setText(formato.format(b2) + ""); cajab2.setEditable(false); JLabel etiquetaSe = new JLabel("Se"); JTextField cajaSe = new JTextField(); cajaSe.setText(Se + ""); cajaSe.setEditable(false); cajaSe.setAutoscrolls(true); JButton botonI = new JButton("Exportar a PDF"); botonI.addActionListener(this); panel2.add(etiquetaN); panel2.add(cajaN); panel2.add(etiquetaK); panel2.add(cajaK); panel2.add(etiquetab2); panel2.add(etiquetab0); panel2.add(cajab0); panel2.add(etiquetab1); panel2.add(cajab1); panel2.add(etiquetab2); panel2.add(cajab2); panel2.add(etiquetaSe); panel2.add(cajaSe); panel2.add(botonI); panel.add(panel2, BorderLayout.SOUTH);//agrego el panel2 con rejilla en el panel principal al sur resultados.addTab("resultado", panel); //************************************************************************************** //intervalos de confianza JPanel intervalos = new JPanel(new BorderLayout()); JPanel variables = new JPanel(new GridLayout(0, 2)); JLabel variableX1 = new JLabel("X1"); cajaVariableX1 = new JTextField(); JLabel variableX2 = new JLabel("X2"); cajaVariableX2 = new JTextField(); boton = new JButton("calcular"); boton.addActionListener(this); JLabel variableEfectividad = new JLabel("Efectividad"); String[] efectividades = { "80", "85", "90", "95", "99" }; combo = new JComboBox(efectividades); variables.add(variableX1); variables.add(cajaVariableX1); variables.add(variableX2); variables.add(cajaVariableX2); variables.add(variableEfectividad); variables.add(combo); variables.add(boton); intervalos.add(variables, BorderLayout.NORTH); jtable2 = new JTable();//creamos la tabla a mostrar jtable2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 0, 0), 2, true)); jtable2.setFont(new java.awt.Font("Arial", 1, 14)); jtable2.setColumnSelectionAllowed(true); jtable2.setCursor(new java.awt.Cursor(java.awt.Cursor.N_RESIZE_CURSOR)); jtable2.setInheritsPopupMenu(true); jtable2.setMinimumSize(new java.awt.Dimension(80, 80)); String[] titulos2 = { "Y estimada", "Li", "Ls" };//los titulos de la tabla String[][] pruebaIntervalos = { { "", "", "" } }; DefaultTableModel TableModel2 = new DefaultTableModel(pruebaIntervalos, titulos2); jtable2.setModel(TableModel2); JScrollPane jScrollPane2 = new JScrollPane(); jScrollPane2.setViewportView(jtable2); jtable2.getColumnModel().getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); intervalos.add(jScrollPane2, BorderLayout.CENTER); resultados.addTab("intervalos", intervalos); //*************************************************************************** JPanel graficas = new JPanel(new GridLayout(0, 1)); XYDataset dataset = createSampleDataset(Yestimada, 1); JFreeChart chart = ChartFactory.createXYLineChart("Grafica 1 - X1", "X", "Y", dataset, 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); plot.setRenderer(renderer); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 300)); graficas.add(chartPanel);//agregamos la primer grafica //********** creamos la segunda grafica XYDataset dataset2 = createSampleDataset(Yestimada, 2); JFreeChart chart2 = ChartFactory.createXYLineChart("Grafica 2 -X2", "X", "Y", dataset2, PlotOrientation.VERTICAL, true, false, false); XYPlot plot2 = (XYPlot) chart2.getPlot(); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(); renderer2.setSeriesLinesVisible(0, true); renderer2.setSeriesShapesVisible(0, true); renderer2.setSeriesLinesVisible(1, true); renderer2.setSeriesShapesVisible(1, true); plot2.setRenderer(renderer2); final ChartPanel chartPanel2 = new ChartPanel(chart2); chartPanel2.setPreferredSize(new java.awt.Dimension(500, 300)); graficas.add(chartPanel2); resultados.addTab("graficas", graficas); }