Example usage for org.jfree.chart.renderer.xy XYDifferenceRenderer setRoundXCoordinates

List of usage examples for org.jfree.chart.renderer.xy XYDifferenceRenderer setRoundXCoordinates

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy XYDifferenceRenderer setRoundXCoordinates.

Prototype

public void setRoundXCoordinates(boolean round) 

Source Link

Document

Sets the flag that controls whether or not the x-coordinates (in Java2D space) are rounded to integer values, and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:org.jfree.chart.demo.DifferenceChartDemo1.java

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Difference Chart Demo 1", "Time", "Value",
            xydataset, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    XYDifferenceRenderer xydifferencerenderer = new XYDifferenceRenderer(Color.green, Color.red, false);
    xydifferencerenderer.setRoundXCoordinates(true);
    xyplot.setDomainCrosshairLockedOnData(true);
    xyplot.setRangeCrosshairLockedOnData(true);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    xyplot.setRenderer(xydifferencerenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    DateAxis dateaxis = new DateAxis("Time");
    dateaxis.setLowerMargin(0.0D);//from   w  w  w . j a  va 2  s . com
    dateaxis.setUpperMargin(0.0D);
    xyplot.setDomainAxis(dateaxis);
    xyplot.setForegroundAlpha(0.5F);
    return jfreechart;
}

From source file:es.bsc.autonomic.powermodeller.graphics.TotalPowerAndPredictionDifference.java

private static JFreeChart createChart() {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(NAME, "Power (Watts)", "Power (Watts)", data,
            true, true, false);/* w ww .  ja v  a  2s . c  om*/
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    XYDifferenceRenderer xydifferencerenderer = new XYDifferenceRenderer(Color.green, Color.yellow, false);
    xydifferencerenderer.setRoundXCoordinates(true);
    xyplot.setDomainCrosshairLockedOnData(true);
    xyplot.setRangeCrosshairLockedOnData(true);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    xyplot.setRenderer(xydifferencerenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    DateAxis dateaxis = new DateAxis("Samples");
    dateaxis.setTickLabelsVisible(false);
    dateaxis.setLowerMargin(0.0D);
    dateaxis.setUpperMargin(0.0D);
    xyplot.setDomainAxis(dateaxis);
    xyplot.setForegroundAlpha(0.5F);
    return jfreechart;
}