List of usage examples for org.jfree.chart ChartFactory createScatterPlot
public static JFreeChart createScatterPlot(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
From source file:ubic.gemma.web.controller.expression.experiment.ExpressionExperimentQCController.java
/** * @param os response output stream// w ww . ja v a2 s. c o m * @param mvr MeanVarianceRelation object to plot * @return true if mvr data points were plotted */ private boolean writeMeanVariance(OutputStream os, MeanVarianceRelation mvr, Double size) throws Exception { // if number of datapoints > THRESHOLD then alpha = TRANSLUCENT, else alpha = OPAQUE final int THRESHOLD = 1000; final int TRANSLUCENT = 50; final int OPAQUE = 255; // Set maximum plot range to Y_MAX + YRANGE * OFFSET to leave some extra white space final double OFFSET_FACTOR = 0.05f; // set the final image size to be the minimum of MAX_IMAGE_SIZE_PX or size final int MAX_IMAGE_SIZE_PX = 5; if (mvr == null) { return false; } // get data points XYSeriesCollection collection = this.getMeanVariance(mvr); if (collection.getSeries().size() == 0) { return false; } ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart chart = ChartFactory.createScatterPlot("", "mean (log2)", "variance (log2)", collection, PlotOrientation.VERTICAL, false, false, false); // adjust colors and shapes XYRegressionRenderer renderer = new XYRegressionRenderer(); renderer.setBasePaint(Color.white); XYSeries series = collection.getSeries(0); int alpha = series.getItemCount() > THRESHOLD ? TRANSLUCENT : OPAQUE; renderer.setSeriesPaint(0, new Color(0, 0, 0, alpha)); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesStroke(1, new BasicStroke(1)); renderer.setSeriesShape(0, new Ellipse2D.Double(4, 4, 4, 4)); renderer.setSeriesShapesFilled(0, false); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesLinesVisible(1, true); renderer.setSeriesShapesVisible(1, false); XYPlot plot = chart.getXYPlot(); plot.setRenderer(renderer); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); // adjust the chart domain and ranges double yRange = series.getMaxY() - series.getMinY(); double xRange = series.getMaxX() - series.getMinX(); if (xRange < 0) { log.warn("Min X was greater than Max X: Max=" + series.getMaxY() + " Min= " + series.getMinY()); return false; } double ybuffer = (yRange) * OFFSET_FACTOR; double xbuffer = (xRange) * OFFSET_FACTOR; double newYMin = series.getMinY() - ybuffer; double newYMax = series.getMaxY() + ybuffer; double newXMin = series.getMinX() - xbuffer; double newXMax = series.getMaxX() + xbuffer; ValueAxis yAxis = new NumberAxis("Variance"); yAxis.setRange(newYMin, newYMax); ValueAxis xAxis = new NumberAxis("Mean"); xAxis.setRange(newXMin, newXMax); chart.getXYPlot().setRangeAxis(yAxis); chart.getXYPlot().setDomainAxis(xAxis); int finalSize = (int) Math.min( MAX_IMAGE_SIZE_PX * ExpressionExperimentQCController.DEFAULT_QC_IMAGE_SIZE_PX, size * ExpressionExperimentQCController.DEFAULT_QC_IMAGE_SIZE_PX); ChartUtilities.writeChartAsPNG(os, chart, finalSize, finalSize); return true; }
From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java
protected JFreeChart createScatterChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createScatterPlot( (String) evaluateExpression(getChart().getTitleExpression()), (String) evaluateExpression(((JRScatterPlot) getPlot()).getXAxisLabelExpression()), (String) evaluateExpression(((JRScatterPlot) getPlot()).getYAxisLabelExpression()), (XYDataset) getDataset(), getPlot().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) jfreeChart.getPlot()) .getRenderer();/*from w w w. j a v a2 s . c om*/ JRScatterPlot scatterPlot = (JRScatterPlot) getPlot(); boolean isShowLines = scatterPlot.getShowLines() == null ? true : scatterPlot.getShowLines().booleanValue(); boolean isShowShapes = scatterPlot.getShowShapes() == null ? true : scatterPlot.getShowShapes().booleanValue(); plotRenderer.setBaseLinesVisible(isShowLines); plotRenderer.setBaseShapesVisible(isShowShapes); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(), scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(), scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(), scatterPlot.getXAxisVerticalTickLabels(), scatterPlot.getOwnXAxisLineColor(), false, (Comparable) evaluateExpression(scatterPlot.getDomainAxisMinValueExpression()), (Comparable) evaluateExpression(scatterPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(), scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(), scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(), scatterPlot.getYAxisVerticalTickLabels(), scatterPlot.getOwnYAxisLineColor(), true, (Comparable) evaluateExpression(scatterPlot.getRangeAxisMinValueExpression()), (Comparable) evaluateExpression(scatterPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:gui_pack.MainGui.java
private void runTestsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runTestsButtonActionPerformed int rangeMin, rangeMax, spacing; int passing = 0; {// Beginning of input validation String errorTitle, errorMessage; //make sure at least one sort algorithm is selected if (!(insertionCheckBox.isSelected() || mergeCheckBox.isSelected() || quickCheckBox.isSelected() || selectionCheckBox.isSelected())) { errorTitle = "Selection Error"; errorMessage = "At least one sort algorithm (Insertion Sort, " + "Merge Sort, Quick Sort, or Selection Sort) must be selected."; JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.WARNING_MESSAGE); return; }/* w ww. j av a 2s . com*/ //make sure at least one order is selected if (!(ascendingCheckBox.isSelected() || descendingCheckBox.isSelected() || randomCheckBox.isSelected())) { errorTitle = "Selection Error"; errorMessage = "At least one order (Ascending Order, Descending Order, or Random Order) " + "must be selected."; JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.WARNING_MESSAGE); return; } //make sure all the proper fields contain data try { rangeMin = Integer.parseInt(rangeMinField.getText()); rangeMax = Integer.parseInt(rangeMaxField.getText()); spacing = Integer.parseInt(spacingField.getText()); //for the multithreaded version of this program "iterations" cannot be a variable //this was left in to catch if the iteration field is left blank or has no value if (iterationField.isEnabled()) { Integer.parseInt(iterationField.getText()); } } catch (NumberFormatException arbitraryName) { errorTitle = "Input Error"; if (iterationField.isEnabled()) { errorMessage = "The size, intervals, and iterations fields must contain " + "integer values and only integer values."; } else { errorMessage = "The size and intervals fields must contain " + "integer values and only integer values."; } JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.WARNING_MESSAGE); return; } //make sure field data is appropriate if (rangeMin > rangeMax) { errorTitle = "Range Error"; errorMessage = "Minimum Size must be less than or equal to Maximum Size."; JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.WARNING_MESSAGE); return; } if (spacing < 1 || rangeMin < 1 || rangeMax < 1 || (iterationField.isEnabled() && Integer.parseInt(iterationField.getText()) < 1)) { errorTitle = "Value Error"; if (iterationField.isEnabled()) { errorMessage = "Intervals, sizes, and iterations must be in the positive domain. " + "Spacing, Range(min), Range(max), and Iterations must be greater than or" + " equal to one."; } else { errorMessage = "Intervals and sizes must be in the positive domain. " + "Spacing, Range(min) and Range(max) be greater than or" + " equal to one."; } JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.WARNING_MESSAGE); return; } if (!iterationField.isEnabled()) { passing = 0; } } // End of input validation //here's where we set up a loading bar in case the tests take a while JProgressBar loadBar = new JProgressBar(); JFrame loadFrame = new JFrame(); JLabel displayLabel1 = new JLabel(); loadBar.setIndeterminate(true); loadBar.setVisible(true); displayLabel1.setText("Running large tests, or many tests, using inefficient algorithms \n" + "may take a while. Please be patient."); loadFrame.setLayout(new FlowLayout()); loadFrame.add(loadBar); loadFrame.add(displayLabel1); loadFrame.setSize(600, 100); loadFrame.setTitle("Loading"); loadFrame.setVisible(true); //now we will leave this open until the tests are completed //now we can conduct the actual tests SwingWorker worker = new SwingWorker<XYSeriesCollection, Void>() { XYSeriesCollection results = new XYSeriesCollection(); @Override protected XYSeriesCollection doInBackground() { XYSeries insertSeries = new XYSeries("Insertion Sort"); XYSeries mergeSeries = new XYSeries("Merge Sort"); XYSeries quickSeries = new XYSeries("Quick Sort"); XYSeries selectSeries = new XYSeries("Selection Sort"); final boolean ascending = ascendingCheckBox.isSelected(); final boolean descending = descendingCheckBox.isSelected(); final boolean insertion = insertionCheckBox.isSelected(); final boolean merge = mergeCheckBox.isSelected(); final boolean quick = quickCheckBox.isSelected(); final boolean selection = selectionCheckBox.isSelected(); final int iterations = Integer.parseInt(iterationField.getText()); ListGenerator generator = new ListGenerator(); int[] list; for (int count = rangeMin; count <= rangeMax; count = count + spacing) { if (ascending) { list = generator.ascending(count); if (insertion) { insertSeries.add(count, insertionSort.sort(list)); } if (merge) { mergeSeries.add(count, mergeSort.sort(list)); } if (quick) { quickSeries.add(count, quickSort.sort(list)); } if (selection) { selectSeries.add(count, selectionSort.sort(list)); } } if (descending) { list = generator.descending(count); if (insertion) { insertSeries.add(count, insertionSort.sort(list)); } if (merge) { mergeSeries.add(count, mergeSort.sort(list)); } if (quick) { quickSeries.add(count, quickSort.sort(list)); } if (selection) { selectSeries.add(count, selectionSort.sort(list)); } } for (int iteration = 0; iteration < iterations; iteration++) { list = generator.random(count); if (insertion) { insertSeries.add(count, insertionSort.sort(list)); } if (merge) { mergeSeries.add(count, mergeSort.sort(list)); } if (quick) { quickSeries.add(count, quickSort.sort(list)); } if (selection) { selectSeries.add(count, selectionSort.sort(list)); } } } //now we aggregate the results if (insertion) { results.addSeries(insertSeries); } if (merge) { results.addSeries(mergeSeries); } if (quick) { results.addSeries(quickSeries); } if (selection) { results.addSeries(selectSeries); } return results; } @Override protected void done() { //finally, we display the results JFreeChart chart = ChartFactory.createScatterPlot("SortExplorer", // chart title "List Size", // x axis label "Number of Comparisons", // y axis label results, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); ChartFrame frame = new ChartFrame("First", chart); frame.pack(); frame.setVisible(true); loadFrame.setVisible(false); } }; //having set up the multithreading 'worker' we can finally conduct the //test worker.execute(); }
From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java
protected JFreeChart createScatterChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createScatterPlot( (String) evaluateExpression(getChart().getTitleExpression()), (String) evaluateExpression(((JRScatterPlot) getPlot()).getXAxisLabelExpression()), (String) evaluateExpression(((JRScatterPlot) getPlot()).getYAxisLabelExpression()), (XYDataset) getDataset(), getPlot().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) jfreeChart.getPlot()) .getRenderer();/*ww w.j a va2 s . c o m*/ JRScatterPlot scatterPlot = (JRScatterPlot) getPlot(); boolean isShowLines = scatterPlot.getShowLines() == null ? true : scatterPlot.getShowLines().booleanValue(); boolean isShowShapes = scatterPlot.getShowShapes() == null ? true : scatterPlot.getShowShapes().booleanValue(); plotRenderer.setBaseLinesVisible(isShowLines); plotRenderer.setBaseShapesVisible(isShowShapes); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(), scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(), scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(), scatterPlot.getXAxisVerticalTickLabels(), scatterPlot.getOwnXAxisLineColor(), getDomainAxisSettings(), (Comparable) evaluateExpression(scatterPlot.getDomainAxisMinValueExpression()), (Comparable) evaluateExpression(scatterPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(), scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(), scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(), scatterPlot.getYAxisVerticalTickLabels(), scatterPlot.getOwnYAxisLineColor(), getRangeAxisSettings(), (Comparable) evaluateExpression(scatterPlot.getRangeAxisMinValueExpression()), (Comparable) evaluateExpression(scatterPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java
protected JFreeChart createScatterChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createScatterPlot( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRScatterPlot) getPlot()).getXAxisLabelExpression()), evaluateTextExpression(((JRScatterPlot) getPlot()).getYAxisLabelExpression()), (XYDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false);//from w w w . j a v a 2 s . co m configureChart(jfreeChart, getPlot()); XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) jfreeChart.getPlot()) .getRenderer(); JRScatterPlot scatterPlot = (JRScatterPlot) getPlot(); boolean isShowLines = scatterPlot.getShowLines() == null ? true : scatterPlot.getShowLines(); boolean isShowShapes = scatterPlot.getShowShapes() == null ? true : scatterPlot.getShowShapes(); plotRenderer.setBaseLinesVisible(isShowLines); plotRenderer.setBaseShapesVisible(isShowShapes); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(), scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(), scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(), scatterPlot.getXAxisVerticalTickLabels(), scatterPlot.getOwnXAxisLineColor(), false, (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMinValueExpression()), (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(), scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(), scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(), scatterPlot.getYAxisVerticalTickLabels(), scatterPlot.getOwnYAxisLineColor(), true, (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMinValueExpression()), (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java
protected JFreeChart createScatterChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createScatterPlot( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRScatterPlot) getPlot()).getXAxisLabelExpression()), evaluateTextExpression(((JRScatterPlot) getPlot()).getYAxisLabelExpression()), (XYDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false);// w w w .j a v a 2s .c o m configureChart(jfreeChart, getPlot()); XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) jfreeChart.getPlot()) .getRenderer(); JRScatterPlot scatterPlot = (JRScatterPlot) getPlot(); boolean isShowLines = scatterPlot.getShowLines() == null ? true : scatterPlot.getShowLines(); boolean isShowShapes = scatterPlot.getShowShapes() == null ? true : scatterPlot.getShowShapes(); plotRenderer.setBaseLinesVisible(isShowLines); plotRenderer.setBaseShapesVisible(isShowShapes); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(), scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(), scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(), scatterPlot.getXAxisVerticalTickLabels(), scatterPlot.getOwnXAxisLineColor(), getDomainAxisSettings(), (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMinValueExpression()), (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(), scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(), scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(), scatterPlot.getYAxisVerticalTickLabels(), scatterPlot.getOwnYAxisLineColor(), getRangeAxisSettings(), (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMinValueExpression()), (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java
protected JFreeChart createScatterChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createScatterPlot( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRScatterPlot) getPlot()).getXAxisLabelExpression()), evaluateTextExpression(((JRScatterPlot) getPlot()).getYAxisLabelExpression()), (XYDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false);/*from w ww . j a va2s . c o m*/ configureChart(jfreeChart); XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) jfreeChart.getPlot()) .getRenderer(); JRScatterPlot scatterPlot = (JRScatterPlot) getPlot(); boolean isShowLines = scatterPlot.getShowLines() == null ? true : scatterPlot.getShowLines(); boolean isShowShapes = scatterPlot.getShowShapes() == null ? true : scatterPlot.getShowShapes(); plotRenderer.setBaseLinesVisible(isShowLines); plotRenderer.setBaseShapesVisible(isShowShapes); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(), scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(), scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(), scatterPlot.getXAxisVerticalTickLabels(), scatterPlot.getXAxisLineColor(), false, (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMinValueExpression()), (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(), scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(), scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(), scatterPlot.getYAxisVerticalTickLabels(), scatterPlot.getYAxisLineColor(), true, (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMinValueExpression()), (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:edu.ucla.stat.SOCR.chart.ChartGenerator_JTable.java
private JFreeChart createYIntervalChart(String title, String xLabel, String yLabel, IntervalXYDataset dataset) { JFreeChart chart = ChartFactory.createScatterPlot(title, // chart title xLabel, // domain axis label yLabel, // range axis label dataset, // data orientation, true, // include legend true, false);//from www . j a va 2 s . co m XYPlot plot = chart.getXYPlot(); plot.setRenderer(new YIntervalRenderer()); return chart; }
From source file:stainingestimation.StainingEstimation.java
/** * Creates a Precision/Recall Plot in the staining estimation dialog. Gold-standard and estimated nuclei have to exist. *//*from www . j a v a2s .com*/ void calculateFScore() { // draw the points in the plot XYSeriesCollection dataset = new XYSeriesCollection(); if (manager != null) { List<TMAspot> tss = manager.getSelectedTMAspots(); double[] stats; for (TMAspot ts : tss) { stats = ts.calculateMatchStatistics(); XYSeries series = new XYSeries( "P_" + Misc.FilePathStringtoFilenameWOExtension(ts.getName()).replaceAll("spots_", "") .replaceAll("_top_left", "").replaceAll("prostate_cancer_mib_validation_", "")); series.add(stats[2 + 7], stats[1 + 7]); dataset.addSeries(series); } } JFreeChart chart; // If there is already a chart, re-use it. if (((java.awt.BorderLayout) (jPanel3.getLayout())) .getLayoutComponent(java.awt.BorderLayout.NORTH) != null) { chart = ((ChartPanel) ((java.awt.BorderLayout) (jPanel3.getLayout())) .getLayoutComponent(java.awt.BorderLayout.NORTH)).getChart(); chart.getXYPlot().setDataset(1, dataset); chart.getXYPlot().setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); XYLineAndShapeRenderer las = new XYLineAndShapeRenderer(false, true); XYToolTipGenerator ttg = new StandardXYToolTipGenerator(); las.setBaseToolTipGenerator(ttg); las.setUseFillPaint(true); las.setUseOutlinePaint(true); chart.getXYPlot().setRenderer(1, las); // Otherwise create a new chart. } else { chart = ChartFactory.createScatterPlot("Precision Recall Plot", "Recall", "Precision", dataset, PlotOrientation.VERTICAL, true, false, false); chart.getXYPlot().getDomainAxis().setRange(0, 1); chart.getXYPlot().getRangeAxis().setRange(0, 1); chart.setBackgroundPaint(null); chart.getPlot().setBackgroundPaint(null); //chart.getPlot().setBackgroundPaint(Color.WHITE); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(jXTable1.getPreferredSize().width, 300)); jPanel3.add(chartPanel, java.awt.BorderLayout.NORTH); validate(); pack(); } }