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

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

Introduction

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

Prototype

public double getXHighValue() 

Source Link

Document

Returns the upper bound of the x-interval.

Usage

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

/**
 * Some checks for the constructor./*from   w  w  w .j a  va  2s. com*/
 */
@Test
public void testConstructor1() {
    XYIntervalDataItem item1 = new XYIntervalDataItem(1.0, 0.5, 1.5, 2.0, 1.9, 2.1);
    assertEquals(new Double(1.0), item1.getX());
    assertEquals(0.5, item1.getXLowValue(), EPSILON);
    assertEquals(1.5, item1.getXHighValue(), EPSILON);
    assertEquals(2.0, item1.getYValue(), EPSILON);
    assertEquals(1.9, item1.getYLowValue(), EPSILON);
    assertEquals(2.1, item1.getYHighValue(), EPSILON);
}

From source file:userinterface.graph.Histogram.java

/**
 * Exports our Histogram to a GNU plot readable file
 * /*from   w  w  w .  j  a  v  a 2 s .co  m*/
 * @param file The file to which the data has to be written
 * @throws IOException
 */
public void exportToGnuplot(File file) throws IOException {

    PrintWriter out = new PrintWriter(new FileWriter(file));

    //add some info for the users
    out.println("#=========================================");
    out.println("# Generated by PRISM Chart Package");
    out.println("#=========================================");
    out.println("# usage: gnuplot <filename>");
    out.println("# Written by Muhammad Omer Saeed <muhammad.omar555@gmail.com>");

    out.println();

    //set some properties
    out.println("set xtics rotate out");
    out.println("set auto x");
    out.println("set yrange " + "[0:" + getChart().getXYPlot().getRangeAxis().getRange().getUpperBound() * 1.2
            + "]");
    out.println("set style data histogram");
    out.println("set style fill solid border");
    out.println("set style histogram clustered");
    out.println("set boxwidth 3");

    synchronized (getSeriesLock()) {

        for (int i = 0; i < getChart().getXYPlot().getSeriesCount(); i++) {

            if (i == 0)
                out.print("plot '-' using 2:xticlabels(1)");
            else
                out.print(", '-' using 2:xticlabels(1)");
        }

        out.println();
        out.println();

        //write the histogram data
        for (int i = 0; i < getAllSeriesKeys().size(); i++) {

            XYIntervalSeries series = keyToSeries.get(getAllSeriesKeys().get(i));

            out.println("max   " + series.getKey());

            for (int j = 0; j < series.getItemCount(); j++) {

                XYIntervalDataItem item = (XYIntervalDataItem) series.getDataItem(j);

                double x = item.getXHighValue();
                x = x * 100;
                x = Math.round(x);
                x = x / 100;

                out.println(x + "   " + item.getYValue());

            }

            out.println("end series");
            out.println();
        }

    }

    //finishing up
    out.println();
    out.println("pause -1");

    out.flush();
    out.close();
}

From source file:userinterface.graph.Histogram.java

/**
 * Add a point to the specified graph series.
 * @param seriesKey Key of series to update.
 * @param dataItem XYDataItem object to insert into this series.
 *//*w  w w .  j a  v  a  2 s.  co m*/
public void addPointToSeries(SeriesKey seriesKey, XYIntervalDataItem dataItem) {

    synchronized (seriesCollection) {

        XYIntervalSeries series = keyToSeries.get(seriesKey);
        series.add(dataItem.getX(), dataItem.getXLowValue(), dataItem.getXHighValue(), dataItem.getYValue(),
                dataItem.getYLowValue(), dataItem.getYHighValue());

    }
}