Example usage for org.jfree.data.xy XYIntervalSeries getXHighValue

List of usage examples for org.jfree.data.xy XYIntervalSeries getXHighValue

Introduction

In this page you can find the example usage for org.jfree.data.xy XYIntervalSeries getXHighValue.

Prototype

public double getXHighValue(int index) 

Source Link

Document

Returns the upper bound of the x-interval for the specified item in the series.

Usage

From source file:org.jfree.data.xy.XYIntervalSeriesCollection.java

/**
 * Returns the end x-value (as a double primitive) for an item within a
 * series./*from w w w .  ja v  a  2  s .  co m*/
 *
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 *
 * @return The value.
 */
@Override
public double getEndXValue(int series, int item) {
    XYIntervalSeries s = (XYIntervalSeries) this.data.get(series);
    return s.getXHighValue(item);
}

From source file:org.jfree.data.xy.XYIntervalSeriesTest.java

/**
 * Some checks for the new accessor methods added in 1.0.5.
 *//*from   www.j a  va 2  s  .co m*/
@Test
public void testValues() {
    XYIntervalSeries s1 = new XYIntervalSeries("S1");
    s1.add(2.0, 1.0, 3.0, 5.0, 4.0, 6.0);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(1.0, s1.getXLowValue(0), EPSILON);
    assertEquals(3.0, s1.getXHighValue(0), EPSILON);
    assertEquals(5.0, s1.getYValue(0), EPSILON);
    assertEquals(4.0, s1.getYLowValue(0), EPSILON);
    assertEquals(6.0, s1.getYHighValue(0), EPSILON);
}

From source file:userinterface.graph.Histogram.java

/**
 * Add custom tool tip for the Histogram to show more info
 *//*from   w  w w . jav  a  2 s .c om*/
public void addToolTip() {

    ((ClusteredXYBarRenderer) plot.getRenderer()).setBaseToolTipGenerator(new XYToolTipGenerator() {

        @Override
        public String generateToolTip(XYDataset dataset, int seriesIndex, int item) {

            XYIntervalSeriesCollection collection = (XYIntervalSeriesCollection) dataset;
            XYIntervalSeries series = collection.getSeries(seriesIndex);

            double minX = series.getXLowValue(item);
            double maxX = series.getXHighValue(item);
            double height = series.getYValue(item);

            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(String.format("<html><p style='color:#0000ff;'>Prop: '%s'</p>",
                    dataset.getSeriesKey(seriesIndex)));
            stringBuilder.append("<table style=\"width:100%\">");
            stringBuilder.append(
                    "<tr><td> Min range: </td><td>" + (Math.round(minX * 10000.0) / 10000.0) + "</td></tr>");
            stringBuilder.append(
                    "<tr><td> Max range: </td><td>" + (Math.round(maxX * 10000.0) / 10000.0) + "</td></tr>");
            stringBuilder.append("<tr><td> Number of states: </td><td>" + height + "</td></tr></table>");
            stringBuilder.append("</html>");

            return stringBuilder.toString();
        }
    });

}