Example usage for org.jfree.chart JFreeChart getXYPlot

List of usage examples for org.jfree.chart JFreeChart getXYPlot

Introduction

In this page you can find the example usage for org.jfree.chart JFreeChart getXYPlot.

Prototype

public XYPlot getXYPlot() 

Source Link

Document

Returns the plot cast as an XYPlot .

Usage

From source file:org.matsim.contrib.util.timeprofile.TimeProfileCharts.java

public static void changeSeriesColors(JFreeChart chart, Paint... paints) {
    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    for (int i = 0; i < paints.length; i++) {
        renderer.setSeriesPaint(i, paints[i]);
    }/*from  w  w  w  .ja v a 2s  .  co m*/
}

From source file:com.bpd.jfreechart.StackedAreaChartDemo.java

/**
 * Customizes the JFreeChart./*from   w  w  w  .ja v a2s . c  om*/
 * 
 * @param chart The chart to customize.
 */
private static void customizeChart(JFreeChart chart) {
    StackedXYAreaRenderer2 renderer = (StackedXYAreaRenderer2) chart.getXYPlot().getRenderer();
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.BLUE);

    XYPlot plot = chart.getXYPlot();
    plot.getDomainAxis().setLowerMargin(0.0);
    plot.getDomainAxis().setUpperMargin(0.0);
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.BLACK);
}

From source file:org.codehaus.mojo.chronos.chart.ChartUtil.java

public static XYPlot setUpperBound(JFreeChart chart, double max) {
    XYPlot plot = chart.getXYPlot();

    ValueAxis axis = (ValueAxis) plot.getDomainAxis();
    axis.setUpperBound(max);//from  w ww. j  a  v a2 s .  co m
    return plot;
}

From source file:org.codehaus.mojo.chronos.chart.ChartUtil.java

public static XYPlot setupXYPlot(JFreeChart chart, DateFormat dateFormat) {
    XYPlot plot = chart.getXYPlot();

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(dateFormat);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    return plot;//from  w w  w .ja  v a 2  s.  com
}

From source file:daylightchart.options.chart.BaseChartOptions.java

private static JFreeChart createDummyChart() {
    final JFreeChart chart = new JFreeChart(new XYPlot());
    chart.setTitle("");
    final XYPlot plot = chart.getXYPlot();
    plot.setDomainAxis(new DateAxis());
    plot.setRangeAxis(new DateAxis());
    return chart;
}

From source file:playground.thibautd.parknride.analysis.ParkAndRideTripsAnalyzer.java

private static void tuneHistogramAppearence(final JFreeChart chart) {
    XYBarRenderer renderer = (XYBarRenderer) chart.getXYPlot().getRenderer();

    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setShadowVisible(false);//from   ww  w  .j  a va 2s  . c o m
    renderer.setDrawBarOutline(true);
}

From source file:com.projity.pm.graphic.chart.ChartHelper.java

public static void removeAxisAndInsets(JFreeChart chart) {
    XYPlot plot = chart.getXYPlot();
    removeAxisAndInsets(plot);
}

From source file:org.jax.bham.util.JFreeChartUtil.java

/**
 * Convert from a Java2D point to a graph point
 * @param java2DPoint/*from  w  w w .  j  ava 2  s. c o  m*/
 *          the java 2D point to convert
 * @param chartPanel
 *          the chart panel to convert
 * @return
 *          the point
 */
public static Point2D java2DPointToGraphPoint(Point2D java2DPoint, ChartPanel chartPanel) {
    JFreeChart chart = chartPanel.getChart();
    ChartRenderingInfo info = chartPanel.getChartRenderingInfo();
    Rectangle2D dataArea = info.getPlotInfo().getDataArea();
    XYPlot xyPlot = chart.getXYPlot();

    double graphX = xyPlot.getDomainAxis().java2DToValue(java2DPoint.getX(), dataArea,
            xyPlot.getDomainAxisEdge());
    double graphY = xyPlot.getRangeAxis().java2DToValue(java2DPoint.getY(), dataArea,
            xyPlot.getRangeAxisEdge());

    return new Point2D.Double(graphX, graphY);
}

From source file:de.mpg.mpi_inf.bioinf.netanalyzer.dec.TwoCoefsDecorator.java

/**
 * Clears the dataset containing the data used to visualizes the fitted function.
 * <p>//from  ww w .j av  a 2s .c o m
 * If the chart does not contain a decorating dataset, calling this method has no effect.
 * </p>
 * 
 * @param aChart Chart to be cleared from the decorating dataset.
 * @param aSeriesName Name of data series to be used for locating the decorating dataset.
 */
protected static void clearDataset(JFreeChart aChart, String aSeriesName) {
    XYPlot plot = aChart.getXYPlot();
    final int i = getDatasetIndex(plot, aSeriesName);
    if (i != -1) {
        plot.setDataset(i, new XYSeriesCollection(new XYSeries(aSeriesName)));
    }
}

From source file:io.github.mzmine.util.jfreechart.JFreeChartUtils.java

private static void setDrawSeriesLineAsPath(JFreeChart chart, boolean usePath) {

    final XYPlot plot = chart.getXYPlot();

    for (int i = 0; i < plot.getRendererCount(); i++) {
        XYItemRenderer renderer = plot.getRenderer(i);
        if (renderer instanceof XYLineAndShapeRenderer) {
            XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) renderer;
            r.setDrawSeriesLineAsPath(usePath);
        }//from  w  ww .  ja v a2s  .co  m
    }
}