Example usage for org.jfree.data.xy XYSeriesCollection getDomainOrder

List of usage examples for org.jfree.data.xy XYSeriesCollection getDomainOrder

Introduction

In this page you can find the example usage for org.jfree.data.xy XYSeriesCollection getDomainOrder.

Prototype

@Override
public DomainOrder getDomainOrder() 

Source Link

Document

Returns the order of the domain (X) values, if this is known.

Usage

From source file:org.lmn.fc.frameworks.starbase.plugins.observatory.ui.tabs.charts.ChartHelper.java

/***********************************************************************************************
 * Dump the (partial) contents of each Series in an XYdatset.
 *
 * @param dump/*from   ww  w.  ja  v  a 2 s .  c  om*/
 * @param calendar
 * @param dataset
 * @param dumprowcount
 * @param title
 */

public static void dumpXYDataset(final boolean dump, final Calendar calendar, final XYDataset dataset,
        final int dumprowcount, final String title) {
    final String SOURCE = "ChartHelper.dumpXYDataset() ";

    if (dump) {
        LOGGER.log(title);

        if ((dataset != null) && (dataset instanceof XYSeriesCollection)) {
            final XYSeriesCollection seriesCollection;

            seriesCollection = (XYSeriesCollection) dataset;

            LOGGER.log("XYSeriesCollection");
            LOGGER.log("    [series.count=" + seriesCollection.getSeriesCount() + "]");
            LOGGER.log("    [domain.lowerbound.interval.true="
                    + (long) seriesCollection.getDomainLowerBound(true) + "]");
            LOGGER.log("    [domain.lowerbound.interval.false="
                    + (long) seriesCollection.getDomainLowerBound(false) + "]");
            LOGGER.log("    [domain.upperbound.interval.true="
                    + (long) seriesCollection.getDomainUpperBound(true) + "]");
            LOGGER.log("    [domain.upperbound.interval.false="
                    + (long) seriesCollection.getDomainUpperBound(false) + "]");
            LOGGER.log("    [domain.order=" + seriesCollection.getDomainOrder() + "]");

            for (int intSeriesIndex = 0; intSeriesIndex < seriesCollection.getSeriesCount(); intSeriesIndex++) {
                final XYSeries xySeries;

                LOGGER.log("");
                LOGGER.log("    [xyseries.index=" + intSeriesIndex + "]");

                xySeries = seriesCollection.getSeries(intSeriesIndex);
                LOGGER.log("    [xyseries.itemcount=" + xySeries.getItemCount() + "]");
                LOGGER.log("    [xyseries.key=" + xySeries.getKey() + "]");
                LOGGER.log("    [xyseries.xmin=" + xySeries.getMinX() + "]");
                LOGGER.log("    [xyseries.xmax=" + xySeries.getMaxX() + "]");
                LOGGER.log("    [xyseries.ymin=" + xySeries.getMinY() + "]");
                LOGGER.log("    [xyseries.ymax=" + xySeries.getMaxY() + "]");
                LOGGER.log("    [xyseries.description=" + xySeries.getDescription() + "]");
                LOGGER.log("    [xyseries.autosort=" + xySeries.getAutoSort() + "]");
                LOGGER.log("    [xyseries.allowduplicatex=" + xySeries.getAllowDuplicateXValues() + "]");

                // Dump the first chunk
                for (int intItemIndex = 0; intItemIndex < (Math.min(dumprowcount,
                        xySeries.getItemCount())); intItemIndex++) {
                    final XYDataItem item;

                    item = xySeries.getDataItem(intItemIndex);

                    LOGGER.log("        [item.index=" + intItemIndex + "] [item.x=" + item.getXValue()
                            + "] [item.y=" + item.getYValue() + "]");
                }

                LOGGER.log("    ...");

                // Dump the last chunk
                for (int intItemIndex = 0; intItemIndex < (Math.min(dumprowcount,
                        xySeries.getItemCount())); intItemIndex++) {
                    final XYDataItem item;
                    final int intIndex;

                    intIndex = Math.max(0, xySeries.getItemCount() - dumprowcount) + intItemIndex;
                    item = xySeries.getDataItem(intIndex);

                    LOGGER.log("        [item.index=" + intIndex + "] [item.x=" + item.getXValue()
                            + "] [item.y=" + item.getYValue() + "]");
                }
            }
        } else if ((dataset != null) && (dataset instanceof TimeSeriesCollection)) {
            final TimeSeriesCollection seriesCollection;

            seriesCollection = (TimeSeriesCollection) dataset;

            LOGGER.log("TimeSeriesCollection");
            LOGGER.log("    [series.count=" + seriesCollection.getSeriesCount() + "]");
            LOGGER.log("    [domain.lowerbound.interval.true="
                    + (long) seriesCollection.getDomainLowerBound(true) + "]");
            LOGGER.log("    [domain.lowerbound.interval.false="
                    + (long) seriesCollection.getDomainLowerBound(false) + "]");
            LOGGER.log("    [domain.upperbound.interval.true="
                    + (long) seriesCollection.getDomainUpperBound(true) + "]");
            LOGGER.log("    [domain.upperbound.interval.false="
                    + (long) seriesCollection.getDomainUpperBound(false) + "]");
            LOGGER.log("    [domain.order=" + seriesCollection.getDomainOrder() + "]");

            for (int intSeriesIndex = 0; intSeriesIndex < seriesCollection.getSeriesCount(); intSeriesIndex++) {
                final TimeSeries timeSeries;

                LOGGER.log("");
                LOGGER.log("    [timeseries.index=" + intSeriesIndex + "]");

                timeSeries = seriesCollection.getSeries(intSeriesIndex);
                LOGGER.log("    [timeseries.itemcount=" + timeSeries.getItemCount() + "]");
                LOGGER.log("    [timeseries.key=" + timeSeries.getKey() + "]");
                LOGGER.log("    [timeseries.ymin=" + timeSeries.getMinY() + "]");
                LOGGER.log("    [timeseries.ymax=" + timeSeries.getMaxY() + "]");
                LOGGER.log("    [timeseries.domain=" + timeSeries.getDomainDescription() + "]");
                LOGGER.log("    [timeseries.range=" + timeSeries.getRangeDescription() + "]");
                LOGGER.log(
                        "    [timeseries.timeperiodclass=" + timeSeries.getTimePeriodClass().getName() + "]");

                for (int intItemIndex = 0; intItemIndex < (Math.min(dumprowcount,
                        timeSeries.getItemCount())); intItemIndex++) {
                    final TimeSeriesDataItem item;

                    item = timeSeries.getDataItem(intItemIndex);

                    LOGGER.log("        [item.index=" + intItemIndex + "] [item.period.serialindex="
                            + item.getPeriod().getSerialIndex() + "] [item.period.firstmillis="
                            + item.getPeriod().getFirstMillisecond(calendar) + "] [item.value="
                            + item.getValue() + "]");
                }

                LOGGER.log("    ...");

                for (int intItemIndex = 0; intItemIndex < (Math.min(dumprowcount,
                        timeSeries.getItemCount())); intItemIndex++) {
                    final TimeSeriesDataItem item;
                    final int intIndex;

                    intIndex = Math.max(0, timeSeries.getItemCount() - dumprowcount) + intItemIndex;
                    item = timeSeries.getDataItem(intIndex);

                    LOGGER.log("        [item.index=" + intIndex + "] [item.period.serialindex="
                            + item.getPeriod().getSerialIndex() + "] [item.period.firstmillis="
                            + item.getPeriod().getFirstMillisecond(calendar) + "] [item.value="
                            + item.getValue() + "]");
                }
            }
        } else {
            LOGGER.error(SOURCE + "Unsupported XYDataset type");
        }
    }
}