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

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

Introduction

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

Prototype

public double getYValue() 

Source Link

Document

Returns the y-value.

Usage

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

/**
 * Some checks for the constructor.// w w w . j  ava2s  .c  o  m
 */
@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

/**
 * Add a point to the specified graph series.
 * @param seriesKey Key of series to update.
 * @param dataItem XYDataItem object to insert into this series.
 *///from   www  .  j  ava 2 s.com
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());

    }
}

From source file:userinterface.graph.Histogram.java

/**
 * Exports our Histogram to a GNU plot readable file
 * /*from w  ww.  j av a 2  s .c  o 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();
}