Example usage for org.jfree.data Range getLowerBound

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

Introduction

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

Prototype

public double getLowerBound() 

Source Link

Document

Returns the lower bound for the range.

Usage

From source file:org.jfree.data.xy.junit.XYSeriesCollectionTest.java

/**
 * A test to cover bug 3445507.  The issue does not affact
 * XYSeriesCollection.//w ww.jav  a2 s.  co  m
 */
public void testBug3445507() {
    XYSeries s1 = new XYSeries("S1");
    s1.add(1.0, null);
    s1.add(2.0, null);

    XYSeries s2 = new XYSeries("S2");
    s1.add(1.0, 5.0);
    s1.add(2.0, 6.0);

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(s1);
    dataset.addSeries(s2);

    Range r = dataset.getRangeBounds(false);
    assertEquals(5.0, r.getLowerBound(), EPSILON);
    assertEquals(6.0, r.getUpperBound(), EPSILON);
}

From source file:anl.verdi.plot.jfree.XYBlockRenderer.java

/**
 * Returns the range of values the renderer requires to display all the
 * items from the specified dataset.//from  www .ja  va2s.  c o  m
 *
 * @param dataset the dataset (<code>null</code> permitted).
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 */
public Range findRangeBounds(XYDataset dataset) {
    if (dataset != null) {
        Range r = DatasetUtilities.findRangeBounds(dataset, false);
        return new Range(r.getLowerBound() + yOffset, r.getUpperBound() + blockHeight + yOffset);
    } else {
        return null;
    }
}

From source file:anl.verdi.plot.jfree.XYBlockRenderer.java

/**
 * Returns the lower and upper bounds (range) of the x-values in the
 * specified dataset./*from  w  w w  .  ja v a  2s .  c  o m*/
 *
 * @param dataset the dataset (<code>null</code> permitted).
 * @return The range (<code>null</code> if the dataset is <code>null</code>
 *         or empty).
 */
public Range findDomainBounds(XYDataset dataset) {
    if (dataset != null) {
        Range r = DatasetUtilities.findDomainBounds(dataset, false);
        return new Range(r.getLowerBound() + xOffset, r.getUpperBound() + blockWidth + xOffset);
    } else {
        return null;
    }
}

From source file:info.financialecology.finance.utilities.datastruct.VersatileChart.java

public JFreeChart drawTimeSeriesCollections(ArrayList<VersatileTimeSeriesCollection> atscArray) {
    JFreeChart chart;//from w  ww .  ja  v a 2  s  . com
    ArrayList<String> visibleKeys = new ArrayList<String>();

    if (params.ticks) {
        XYSeriesCollection dataSet = new XYSeriesCollection();

        for (VersatileTimeSeriesCollection atsc : atscArray) {
            List<VersatileTimeSeries> atsList = atsc.getSeries();

            for (VersatileTimeSeries ats : atsList) {
                XYSeries xySeries = new XYSeries(ats.getKey());
                dataSet.addSeries(xySeries);

                for (int i = 0; i < ats.getItemCount(); i++)
                    xySeries.add(i, ats.getValue(i));
            }
        }

        chart = ChartFactory.createXYLineChart(params.title, params.xLabel, params.yLabel, dataSet,
                PlotOrientation.VERTICAL, params.legend, params.toolTips, false);

        if (params.autoRange) {
            Range currentRange = dataSet.getRangeBounds(true);
            Range newRange = new Range((1 - params.autoRangePadding) * currentRange.getLowerBound(),
                    (1 + params.autoRangePadding) * currentRange.getUpperBound());
            chart.getXYPlot().getRangeAxis().setRange(newRange);
        }
    } else {
        TimeSeriesCollection dataSet = new TimeSeriesCollection();

        for (VersatileTimeSeriesCollection atsc : atscArray) {
            List<VersatileTimeSeries> atsList = atsc.getSeries();

            for (VersatileTimeSeries ats : atsList) {
                dataSet.addSeries(ats);
                visibleKeys.add((String) ats.getKey());
            }
        }

        chart = ChartFactory.createTimeSeriesChart(params.title, params.xLabel, params.yLabel, dataSet,
                params.legend, params.toolTips, false);

        if (params.autoRange) {
            Range currentRange = dataSet.getRangeBounds(visibleKeys, dataSet.getDomainBounds(true), true);
            Range newRange = new Range((1 - params.autoRangePadding) * currentRange.getLowerBound(),
                    (1 + params.autoRangePadding) * currentRange.getUpperBound());
            chart.getXYPlot().getRangeAxis().setRange(newRange);
        }
    }

    return chart;
}

From source file:ec.ui.view.RevisionSaSeriesView.java

private void setRange(TimeSeriesCollection chartSeries, TimeSeriesCollection startSeries) {
    double min, max;
    Range chart = chartSeries.getRangeBounds(true);
    Range start = startSeries.getRangeBounds(true);
    min = chart.getLowerBound();
    max = chart.getUpperBound();//from ww  w. j  a  v a 2 s . c o  m

    if (min > start.getLowerBound()) {
        min = start.getLowerBound();
    }

    if (max < start.getUpperBound()) {
        max = start.getUpperBound();
    }

    min -= (Math.abs(min) * .03);
    max += (Math.abs(max) * .03);

    range = new Range(min, max);
}

From source file:org.jfree.data.time.TimePeriodValuesCollectionTest.java

/**
 * Some checks for the getDomainBounds() method.
 *//*from ww w. j  av  a  2  s  . c o m*/
@Test
public void testGetDomainBoundsWithoutInterval() {
    // check empty dataset
    TimePeriodValuesCollection dataset = new TimePeriodValuesCollection();
    dataset.setDomainIsPointsInTime(false);
    Range r = dataset.getDomainBounds(false);
    assertNull(r);

    // check dataset with one time period
    TimePeriodValues s1 = new TimePeriodValues("S1");
    s1.add(new SimpleTimePeriod(1000L, 2000L), 1.0);
    dataset.addSeries(s1);
    r = dataset.getDomainBounds(false);
    assertEquals(1500.0, r.getLowerBound(), EPSILON);
    assertEquals(1500.0, r.getUpperBound(), EPSILON);

    // check dataset with two time periods
    s1.add(new SimpleTimePeriod(1500L, 3000L), 2.0);
    r = dataset.getDomainBounds(false);
    assertEquals(1500.0, r.getLowerBound(), EPSILON);
    assertEquals(2250.0, r.getUpperBound(), EPSILON);
}

From source file:org.tsho.dmc2.ui.bifurcation.BifurcationControlForm2.java

public void setFirstParameterRange(Range range) {
    lFirstParRange.setValue(range.getLowerBound());
    uFirstParRange.setValue(range.getUpperBound());
}

From source file:org.jfree.data.time.TimePeriodValuesCollection.java

/**
 * Returns the minimum x-value in the dataset.
 *
 * @param includeInterval  a flag that determines whether or not the
 *                         x-interval is taken into account.
 *
 * @return The minimum value.//from  ww  w  .  j av  a2 s .com
 */
@Override
public double getDomainLowerBound(boolean includeInterval) {
    double result = Double.NaN;
    Range r = getDomainBounds(includeInterval);
    if (r != null) {
        result = r.getLowerBound();
    }
    return result;
}

From source file:org.tsho.dmc2.ui.bifurcation.BifurcationControlForm2.java

public void setsecondParameterRange(Range range) {
    lSecondParRange.setValue(range.getLowerBound());
    uSecondParRange.setValue(range.getUpperBound());
}

From source file:org.tsho.dmc2.ui.bifurcation.BifurcationControlForm2.java

public void setVerticalRange(Range range) {
    lowerVRangeField.setValue(range.getLowerBound());
    upperVRangeField.setValue(range.getUpperBound());
}