Example usage for org.jfree.chart.plot XYPlot setDomainGridlinePaint

List of usage examples for org.jfree.chart.plot XYPlot setDomainGridlinePaint

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot setDomainGridlinePaint.

Prototype

public void setDomainGridlinePaint(Paint paint) 

Source Link

Document

Sets the paint for the grid lines plotted against the domain axis, and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:code.google.gclogviewer.GCLogViewer.java

private JFreeChart createLDSTrendChart(GCLogData data) {
    XYDataset ldsTrendDataset = createLDSTrendDataset(data);
    JFreeChart chart = ChartFactory.createXYLineChart("Live Data Size Trend", "Time(S)", "Size(K)",
            ldsTrendDataset, PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(java.awt.Color.white);
    chart.setBorderVisible(true);//  www .  j av  a 2  s .co m
    chart.setBorderPaint(java.awt.Color.BLACK);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(java.awt.Color.lightGray);
    plot.setDomainGridlinePaint(java.awt.Color.white);
    plot.setRangeGridlinePaint(java.awt.Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.getRangeAxis().setFixedDimension(15.0);
    return chart;
}

From source file:code.google.gclogviewer.GCLogViewer.java

private JFreeChart createPTOSTrendChart(GCLogData data) {
    XYDataset ldsTrendDataset = createPTOSTrendDataset(data);
    JFreeChart chart = ChartFactory.createXYLineChart("Promotion To Old Size Trend", "Time(S)", "Size(K)",
            ldsTrendDataset, PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(java.awt.Color.white);
    chart.setBorderVisible(true);//from   ww w . ja  v a2 s  . co  m
    chart.setBorderPaint(java.awt.Color.BLACK);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(java.awt.Color.lightGray);
    plot.setDomainGridlinePaint(java.awt.Color.white);
    plot.setRangeGridlinePaint(java.awt.Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.getRangeAxis().setFixedDimension(15.0);
    return chart;
}

From source file:code.google.gclogviewer.GCLogViewer.java

/**
 * create Memory Trend Chart/* w w w .  j ava  2  s .  c om*/
 */
private JFreeChart createMemoryTrendChart(GCLogData data) {
    XYDataset memoryTrendDataset = createMemoryTrendDataset(data, null);
    JFreeChart chart = ChartFactory.createXYLineChart("Memory Trend", "Time(S)", "Memory Change(K)",
            memoryTrendDataset, PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(java.awt.Color.white);
    chart.setBorderVisible(true);
    chart.setBorderPaint(java.awt.Color.BLACK);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(java.awt.Color.lightGray);
    plot.setDomainGridlinePaint(java.awt.Color.white);
    plot.setRangeGridlinePaint(java.awt.Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.getRangeAxis().setFixedDimension(15.0);
    return chart;
}

From source file:edu.ucla.stat.SOCR.analyses.gui.Chart.java

protected JFreeChart createQQChart(String title, String xLabel, String yLabel, XYDataset dataset,
        String other) {//w w  w  . j  a  va2s .c  o  m

    // 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.02);
    rangeAxis.setLowerMargin(0.02);

    // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    domainAxis.setUpperMargin(0.02);
    domainAxis.setLowerMargin(0.02);

    // domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // OPTIONAL CUSTOMISATION COMPLETED.
    //setQQSummary(dataset);    // very confusing   
    return chart;

}

From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutputScatter.java

@Override
public void initChart(final IScope scope, final String chartname) {
    super.initChart(scope, chartname);

    final XYPlot pp = (XYPlot) chart.getPlot();
    pp.setDomainGridlinePaint(axesColor);
    pp.setRangeGridlinePaint(axesColor);
    pp.setDomainCrosshairPaint(axesColor);
    pp.setRangeCrosshairPaint(axesColor);
    pp.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    pp.setDomainCrosshairVisible(false);
    pp.setRangeCrosshairVisible(false);//  ww  w.  j a va2  s  . c o m

    pp.getDomainAxis().setAxisLinePaint(axesColor);
    pp.getDomainAxis().setTickLabelFont(getTickFont());
    pp.getDomainAxis().setLabelFont(getLabelFont());
    if (textColor != null) {
        pp.getDomainAxis().setLabelPaint(textColor);
        pp.getDomainAxis().setTickLabelPaint(textColor);
    }

    NumberAxis axis = (NumberAxis) pp.getRangeAxis();
    axis = formatYAxis(scope, axis);
    pp.setRangeAxis(axis);
    if (ytickunit > 0) {
        ((NumberAxis) pp.getRangeAxis()).setTickUnit(new NumberTickUnit(ytickunit));
        pp.setRangeGridlinesVisible(true);
    } else
        pp.setRangeGridlinesVisible(GamaPreferences.Displays.CHART_GRIDLINES.getValue());

    // resetAutorange(scope);

    if (getType() == ChartOutput.SERIES_CHART) {
        if (xlabel == null)
            xlabel = "time";
    }
    if (getType() == ChartOutput.XY_CHART) {
    }
    if (getType() == ChartOutput.SCATTER_CHART) {
    }
    if (!this.getXTickValueVisible(scope)) {
        pp.getDomainAxis().setTickMarksVisible(false);
        pp.getDomainAxis().setTickLabelsVisible(false);

    }

}

From source file:adams.flow.sink.JFreeChartPlot.java

/**
 * Displays the token (the panel and dialog have already been created at
 * this stage)./*from w w  w.j  a va 2 s . co  m*/
 *
 * @param token   the token to display
 */
@Override
protected void display(Token token) {
    SpreadSheet sheet;
    Dataset dataset;
    Shape shape;
    XYPlot plot;

    sheet = (SpreadSheet) token.getPayload();
    dataset = m_Dataset.generate(sheet);
    m_JFreeChart = m_Chart.generate(dataset);
    m_JFreeChart.getPlot().setBackgroundPaint(Color.WHITE);
    if (m_JFreeChart.getPlot() instanceof XYPlot) {
        plot = (XYPlot) m_JFreeChart.getPlot();
        plot.setDomainGridlinesVisible(true);
        plot.setDomainGridlinePaint(Color.GRAY);
        plot.setRangeGridlinesVisible(true);
        plot.setRangeGridlinePaint(Color.GRAY);
        plot.getRenderer().setSeriesPaint(0, m_PlotColor);
        if (plot.getSeriesCount() > 1)
            plot.getRenderer().setSeriesPaint(1, m_DiagonalColor);
        shape = m_Shape.generate();
        if (shape != null)
            plot.getRenderer().setSeriesShape(0, shape);
    }
    m_PlotPanel = new ChartPanel(m_JFreeChart);
    m_Panel.removeAll();
    m_Panel.add(m_PlotPanel, BorderLayout.CENTER);
}

From source file:org.gephi.statistics.plugin.DegreeDistribution.java

/**
 *
 * @return The undirected version of this report.
 *//*from   w w w.j  a  v  a 2s. c  om*/
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:juicebox.windowui.QCDialog.java

public QCDialog(MainWindow mainWindow, HiC hic, String title) {
    super(mainWindow);

    Dataset dataset = hic.getDataset();// w w  w.j  av a 2 s  .  c  om

    String text = dataset.getStatistics();
    String textDescription = null;
    String textStatistics = null;
    String graphs = dataset.getGraphs();
    JTextPane description = null;
    JTabbedPane tabbedPane = new JTabbedPane();
    HTMLEditorKit kit = new HTMLEditorKit();

    StyleSheet styleSheet = kit.getStyleSheet();
    styleSheet.addRule("table { border-collapse: collapse;}");
    styleSheet.addRule("body {font-family: Sans-Serif; font-size: 12;}");
    styleSheet.addRule("td { padding: 2px; }");
    styleSheet.addRule(
            "th {border-bottom: 1px solid #000; text-align: left; background-color: #D8D8D8; font-weight: normal;}");

    if (text != null) {
        int split = text.indexOf("</table>") + 8;
        textDescription = text.substring(0, split);
        textStatistics = text.substring(split);
        description = new JTextPane();
        description.setEditable(false);
        description.setContentType("text/html");
        description.setEditorKit(kit);
        description.setText(textDescription);
        tabbedPane.addTab("About Library", description);

        JTextPane textPane = new JTextPane();
        textPane.setEditable(false);
        textPane.setContentType("text/html");

        textPane.setEditorKit(kit);
        textPane.setText(textStatistics);
        JScrollPane pane = new JScrollPane(textPane);
        tabbedPane.addTab("Statistics", pane);
    }
    boolean success = true;
    if (graphs != null) {

        long[] A = new long[2000];
        long sumA = 0;
        long[] mapq1 = new long[201];
        long[] mapq2 = new long[201];
        long[] mapq3 = new long[201];
        long[] intraCount = new long[100];
        final XYSeries intra = new XYSeries("Intra Count");
        final XYSeries leftRead = new XYSeries("Left");
        final XYSeries rightRead = new XYSeries("Right");
        final XYSeries innerRead = new XYSeries("Inner");
        final XYSeries outerRead = new XYSeries("Outer");
        final XYSeries allMapq = new XYSeries("All MapQ");
        final XYSeries intraMapq = new XYSeries("Intra MapQ");
        final XYSeries interMapq = new XYSeries("Inter MapQ");

        Scanner scanner = new Scanner(graphs);
        try {
            while (!scanner.next().equals("["))
                ;

            for (int idx = 0; idx < 2000; idx++) {
                A[idx] = scanner.nextLong();
                sumA += A[idx];
            }

            while (!scanner.next().equals("["))
                ;
            for (int idx = 0; idx < 201; idx++) {
                mapq1[idx] = scanner.nextInt();
                mapq2[idx] = scanner.nextInt();
                mapq3[idx] = scanner.nextInt();

            }

            for (int idx = 199; idx >= 0; idx--) {
                mapq1[idx] = mapq1[idx] + mapq1[idx + 1];
                mapq2[idx] = mapq2[idx] + mapq2[idx + 1];
                mapq3[idx] = mapq3[idx] + mapq3[idx + 1];
                allMapq.add(idx, mapq1[idx]);
                intraMapq.add(idx, mapq2[idx]);
                interMapq.add(idx, mapq3[idx]);
            }
            while (!scanner.next().equals("["))
                ;
            for (int idx = 0; idx < 100; idx++) {
                int tmp = scanner.nextInt();
                if (tmp != 0)
                    innerRead.add(logXAxis[idx], tmp);
                intraCount[idx] = tmp;
                tmp = scanner.nextInt();
                if (tmp != 0)
                    outerRead.add(logXAxis[idx], tmp);
                intraCount[idx] += tmp;
                tmp = scanner.nextInt();
                if (tmp != 0)
                    rightRead.add(logXAxis[idx], tmp);
                intraCount[idx] += tmp;
                tmp = scanner.nextInt();
                if (tmp != 0)
                    leftRead.add(logXAxis[idx], tmp);
                intraCount[idx] += tmp;
                if (idx > 0)
                    intraCount[idx] += intraCount[idx - 1];
                if (intraCount[idx] != 0)
                    intra.add(logXAxis[idx], intraCount[idx]);
            }
        } catch (NoSuchElementException exception) {
            JOptionPane.showMessageDialog(getParent(), "Graphing file improperly formatted", "Error",
                    JOptionPane.ERROR_MESSAGE);
            success = false;
        }

        if (success) {
            final XYSeriesCollection readTypeCollection = new XYSeriesCollection();
            readTypeCollection.addSeries(innerRead);
            readTypeCollection.addSeries(outerRead);
            readTypeCollection.addSeries(leftRead);
            readTypeCollection.addSeries(rightRead);

            final JFreeChart readTypeChart = ChartFactory.createXYLineChart("Types of reads vs distance", // chart title
                    "Distance (log)", // domain axis label
                    "Binned Reads (log)", // range axis label
                    readTypeCollection, // data
                    PlotOrientation.VERTICAL, true, // include legend
                    true, false);

            final XYPlot readTypePlot = readTypeChart.getXYPlot();

            readTypePlot.setDomainAxis(new LogarithmicAxis("Distance (log)"));
            readTypePlot.setRangeAxis(new LogarithmicAxis("Binned Reads (log)"));
            readTypePlot.setBackgroundPaint(Color.white);
            readTypePlot.setRangeGridlinePaint(Color.lightGray);
            readTypePlot.setDomainGridlinePaint(Color.lightGray);
            readTypeChart.setBackgroundPaint(Color.white);
            readTypePlot.setOutlinePaint(Color.black);
            final ChartPanel chartPanel = new ChartPanel(readTypeChart);

            final XYSeriesCollection reCollection = new XYSeriesCollection();
            final XYSeries reDistance = new XYSeries("Distance");

            for (int i = 0; i < A.length; i++) {
                if (A[i] != 0)
                    reDistance.add(i, A[i] / (float) sumA);
            }
            reCollection.addSeries(reDistance);

            final JFreeChart reChart = ChartFactory.createXYLineChart(
                    "Distance from closest restriction enzyme site", // chart title
                    "Distance (bp)", // domain axis label
                    "Fraction of Reads (log)", // range axis label
                    reCollection, // data
                    PlotOrientation.VERTICAL, true, // include legend
                    true, false);

            final XYPlot rePlot = reChart.getXYPlot();
            rePlot.setDomainAxis(new NumberAxis("Distance (bp)"));
            rePlot.setRangeAxis(new LogarithmicAxis("Fraction of Reads (log)"));
            rePlot.setBackgroundPaint(Color.white);
            rePlot.setRangeGridlinePaint(Color.lightGray);
            rePlot.setDomainGridlinePaint(Color.lightGray);
            reChart.setBackgroundPaint(Color.white);
            rePlot.setOutlinePaint(Color.black);
            final ChartPanel chartPanel2 = new ChartPanel(reChart);

            final XYSeriesCollection intraCollection = new XYSeriesCollection();

            intraCollection.addSeries(intra);

            final JFreeChart intraChart = ChartFactory.createXYLineChart("Intra reads vs distance", // chart title
                    "Distance (log)", // domain axis label
                    "Cumulative Sum of Binned Reads (log)", // range axis label
                    intraCollection, // data
                    PlotOrientation.VERTICAL, true, // include legend
                    true, false);

            final XYPlot intraPlot = intraChart.getXYPlot();
            intraPlot.setDomainAxis(new LogarithmicAxis("Distance (log)"));
            intraPlot.setRangeAxis(new NumberAxis("Cumulative Sum of Binned Reads (log)"));
            intraPlot.setBackgroundPaint(Color.white);
            intraPlot.setRangeGridlinePaint(Color.lightGray);
            intraPlot.setDomainGridlinePaint(Color.lightGray);
            intraChart.setBackgroundPaint(Color.white);
            intraPlot.setOutlinePaint(Color.black);
            final ChartPanel chartPanel3 = new ChartPanel(intraChart);

            final XYSeriesCollection mapqCollection = new XYSeriesCollection();
            mapqCollection.addSeries(allMapq);
            mapqCollection.addSeries(intraMapq);
            mapqCollection.addSeries(interMapq);

            final JFreeChart mapqChart = ChartFactory.createXYLineChart("MapQ Threshold Count", // chart title
                    "MapQ threshold", // domain axis label
                    "Count", // range axis label
                    mapqCollection, // data
                    PlotOrientation.VERTICAL, true, // include legend
                    true, // include tooltips
                    false);

            final XYPlot mapqPlot = mapqChart.getXYPlot();
            mapqPlot.setBackgroundPaint(Color.white);
            mapqPlot.setRangeGridlinePaint(Color.lightGray);
            mapqPlot.setDomainGridlinePaint(Color.lightGray);
            mapqChart.setBackgroundPaint(Color.white);
            mapqPlot.setOutlinePaint(Color.black);
            final ChartPanel chartPanel4 = new ChartPanel(mapqChart);

            tabbedPane.addTab("Pair Type", chartPanel);
            tabbedPane.addTab("Restriction", chartPanel2);
            tabbedPane.addTab("Intra vs Distance", chartPanel3);
            tabbedPane.addTab("MapQ", chartPanel4);
        }
    }

    final ExpectedValueFunction df = hic.getDataset().getExpectedValues(hic.getZoom(),
            hic.getNormalizationType());
    if (df != null) {
        double[] expected = df.getExpectedValues();
        final XYSeriesCollection collection = new XYSeriesCollection();
        final XYSeries expectedValues = new XYSeries("Expected");
        for (int i = 0; i < expected.length; i++) {
            if (expected[i] > 0)
                expectedValues.add(i + 1, expected[i]);
        }
        collection.addSeries(expectedValues);
        String title1 = "Expected at " + hic.getZoom() + " norm " + hic.getNormalizationType();
        final JFreeChart readTypeChart = ChartFactory.createXYLineChart(title1, // chart title
                "Distance between reads (log)", // domain axis label
                "Genome-wide expected (log)", // range axis label
                collection, // data
                PlotOrientation.VERTICAL, false, // include legend
                true, false);
        final XYPlot readTypePlot = readTypeChart.getXYPlot();

        readTypePlot.setDomainAxis(new LogarithmicAxis("Distance between reads (log)"));
        readTypePlot.setRangeAxis(new LogarithmicAxis("Genome-wide expected (log)"));
        readTypePlot.setBackgroundPaint(Color.white);
        readTypePlot.setRangeGridlinePaint(Color.lightGray);
        readTypePlot.setDomainGridlinePaint(Color.lightGray);
        readTypeChart.setBackgroundPaint(Color.white);
        readTypePlot.setOutlinePaint(Color.black);
        final ChartPanel chartPanel5 = new ChartPanel(readTypeChart);

        tabbedPane.addTab("Expected", chartPanel5);
    }

    if (text == null && graphs == null) {
        JOptionPane.showMessageDialog(this, "Sorry, no metrics are available for this dataset", "Error",
                JOptionPane.ERROR_MESSAGE);
        setVisible(false);
        dispose();

    } else {
        getContentPane().add(tabbedPane);
        pack();
        setModal(false);
        setLocation(100, 100);
        setTitle(title);
        setVisible(true);
    }
}

From source file:desmoj.extensions.visualization2d.engine.modelGrafic.StatisticGrafic.java

/**
 * Build content for animationType StatisticGrafic.ANIMATION_Histogram
 * @return//from   ww w  . j  av  a2s. com
 * @throws ModelException
 */
private JPanel buildHistogramPanel() throws ModelException {
    XIntervalSeriesCollection dataset = new XIntervalSeriesCollection();
    dataset.addSeries(this.statistic.getHistogram());
    this.chart = ChartFactory.createXYBarChart(null, "Observation", false, "Count", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    this.chart.setBackgroundPaint(Grafic.COLOR_BACKGROUND);
    XYPlot plot = this.chart.getXYPlot();
    plot.setBackgroundPaint(StatisticGrafic.DIAGRAM_BACKGROUND);
    plot.setDomainGridlinePaint(StatisticGrafic.DIAGRAM_GRID);
    plot.setRangeGridlinePaint(StatisticGrafic.DIAGRAM_GRID);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    ValueAxis rangeAxis = (ValueAxis) plot.getRangeAxis();
    rangeAxis.setLabelFont(Grafic.FONT_DEFAULT);
    ValueAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLabelFont(Grafic.FONT_DEFAULT);
    domainAxis.setAutoRange(true);

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setShadowVisible(false);
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setDrawBarOutline(true);
    renderer.setSeriesPaint(0, StatisticGrafic.DIAGRAM_FORGROUND);
    renderer.setSeriesOutlinePaint(0, StatisticGrafic.DIAGRAM_BORDER);
    renderer.setSeriesOutlineStroke(0, new BasicStroke(1.0f));

    this.buildHistogramAxisFormat(plot, "Observations");
    JPanel out = new ChartPanel(chart);
    out.setPreferredSize(new Dimension(350, 200));
    return out;
}

From source file:jchrest.gui.VisualSearchPane.java

private ChartPanel createPanel() {
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(_trainingTimes);/* w  ww. ja  v a 2 s.  c o m*/

    JFreeChart chart = ChartFactory.createXYLineChart("Plot of network size vs. number of training patterns",
            "Number of training patterns", "Network size", dataset,
            org.jfree.chart.plot.PlotOrientation.VERTICAL, true, true, false);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
        renderer.setDrawSeriesLineAsPath(true);
    }

    return new ChartPanel(chart);
}