Example usage for org.jfree.data Range expandToInclude

List of usage examples for org.jfree.data Range expandToInclude

Introduction

In this page you can find the example usage for org.jfree.data Range expandToInclude.

Prototype

public static Range expandToInclude(Range range, double value) 

Source Link

Document

Returns a range that includes all the values in the specified range AND the specified value.

Usage

From source file:edu.dlnu.liuwenpeng.render.BarRenderer.java

/**    
* Returns the range of values the renderer requires to display all the    
* items from the specified dataset.  This takes into account the range    
* of values in the dataset, plus the flag that determines whether or not    
* the base value for the bars should be included in the range.    
*    /*from  w  w  w. j a  v  a  2s .c om*/
* @param dataset  the dataset (<code>null</code> permitted).    
*    
* @return The range (or <code>null</code> if the dataset is    
*         <code>null</code> or empty).    
*/
public Range findRangeBounds(CategoryDataset dataset) {
    Range result = DatasetUtilities.findRangeBounds(dataset);
    if (result != null) {
        if (this.includeBaseInRange) {
            result = Range.expandToInclude(result, this.base);
        }
    }
    return result;
}

From source file:KIDLYRenderer.java

/**
 * Returns the range of values the renderer requires to display all the
 * items from the specified dataset.  This takes into account the range
 * of values in the dataset, plus the flag that determines whether or not
 * the base value for the bars should be included in the range.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param includeInterval  include the interval if the dataset has one?
 *
 * @return The range (or <code>null</code> if the dataset is
 *         <code>null</code> or empty).
 *///from  w  w w. j  a  v  a  2  s . c om
public Range findRangeBounds(CategoryDataset dataset, boolean includeInterval) {
    if (dataset == null) {
        return null;
    }
    Range result = super.findRangeBounds(dataset, includeInterval);
    if (result != null) {
        if (this.includeBaseInRange) {
            result = Range.expandToInclude(result, this.base);
        }
    }
    return result;
}

From source file:lucee.runtime.tag.Chart.java

private void chartStep() throws PageException, IOException {
    // create the chart...
    final JFreeChart chart = ChartFactory.createXYStepChart(title, xaxistitle, yaxistitle,
            createXYSeriesCollection(), PlotOrientation.VERTICAL, false, true, false);
    final XYPlot p = chart.getXYPlot();
    Font _font = getFont();/* ww w.  j  a  v a2s  . c o  m*/
    // settings            

    setBackground(chart, p);
    setBorder(chart, p);
    set3d(p);
    setFont(chart, _font);
    setLabelFormat(chart);
    p.getDomainAxis().setRange(
            Range.expandToInclude(p.getDomainAxis().getRange(), p.getDomainAxis().getUpperBound() + 0.25));
    p.getDomainAxis().setRange(
            Range.expandToInclude(p.getDomainAxis().getRange(), p.getDomainAxis().getLowerBound() - 0.25));
    setLegend(chart, p, _font);
    setTooltip(chart);
    setScale(chart);
    setAxis(chart);
    setColor(chart);

    writeOut(chart);
}