当前位置: 首页>>代码示例>>Java>>正文


Java XYDataset.getSeriesCount方法代码示例

本文整理汇总了Java中org.jfree.data.xy.XYDataset.getSeriesCount方法的典型用法代码示例。如果您正苦于以下问题:Java XYDataset.getSeriesCount方法的具体用法?Java XYDataset.getSeriesCount怎么用?Java XYDataset.getSeriesCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.data.xy.XYDataset的用法示例。


在下文中一共展示了XYDataset.getSeriesCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMovingAverage

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Creates a new {@link XYDataset} containing the moving averages of each 
 * series in the <code>source</code> dataset.
 *
 * @param source  the source dataset.
 * @param suffix  the string to append to source series names to create 
 *                target series names.
 * @param period  the averaging period.
 * @param skip  the length of the initial skip period.
 *
 * @return The dataset.
 */
public static XYDataset createMovingAverage(XYDataset source, String suffix,
                                            double period, double skip) {

    // check arguments
    if (source == null) {
        throw new IllegalArgumentException("Null source (XYDataset).");
    }
    
    XYSeriesCollection result = new XYSeriesCollection();

    for (int i = 0; i < source.getSeriesCount(); i++) {
        XYSeries s = createMovingAverage(
            source, i, source.getSeriesKey(i) + suffix, period, skip
        );
        result.addSeries(s);
    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:MovingAverage.java

示例2: isEmptyOrNull

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Returns <code>true</code> if the dataset is empty (or <code>null</code>), and
 * <code>false</code> otherwise.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @return A boolean.
 */
public static boolean isEmptyOrNull(XYDataset dataset) {

    boolean result = true;

    if (dataset != null) {
        for (int s = 0; s < dataset.getSeriesCount(); s++) {
            if (dataset.getItemCount(s) > 0) {
                result = false;
                continue;
            }
        }
    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:DatasetUtilities.java

示例3: createMovingAverage

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Creates a new {@link XYDataset} containing the moving averages of each series in the
 * <code>source</code> dataset.
 *
 * @param source  the source dataset.
 * @param suffix  the string to append to source series names to create target series names.
 * @param period  the averaging period.
 * @param skip  the length of the initial skip period.
 *
 * @return The dataset.
 */
public static XYDataset createMovingAverage(XYDataset source, String suffix,
                                            double period, double skip) {

    // check arguments
    if (source == null) {
        throw new IllegalArgumentException(
            "MovingAverage.createMovingAverage(...) : null source (XYDataset)."
        );
    }
    
    final XYSeriesCollection result = new XYSeriesCollection();

    for (int i = 0; i < source.getSeriesCount(); i++) {
        final XYSeries s = createMovingAverage(source, i, source.getSeriesName(i) + suffix,
                                         period, skip);
        result.addSeries(s);
    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:MovingAverage.java

示例4: isEmptyOrNull

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Returns <code>true</code> if the dataset is empty (or <code>null</code>),
 * and <code>false</code> otherwise.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @return A boolean.
 */
public static boolean isEmptyOrNull(XYDataset dataset) {

    boolean result = true;

    if (dataset != null) {
        for (int s = 0; s < dataset.getSeriesCount(); s++) {
            if (dataset.getItemCount(s) > 0) {
                result = false;
                continue;
            }
        }
    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:DatasetUtilities.java

示例5: calculateMaxCount

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * It returns the number of items in the most populous series
 * in the dataset.
 *
 * @param dataset The dataset whose series will be iterated over.
 * @return The number of items in the most populous series
 * in the dataset.
 */
private int calculateMaxCount(XYDataset dataset) {
    int max = 0;
    for (int i = 0; i < dataset.getSeriesCount(); ++i) {
        int count = dataset.getItemCount(i);
        if (count > max) {
            max = count;
        }
    }
    return max;
}
 
开发者ID:vimerzhao,项目名称:gchisto,代码行数:19,代码来源:ConsolidatingXYDatasetWithGroups.java

示例6: getSeriesCount

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Returns the number of series in the primary dataset for this plot.  If the dataset is
 * <code>null</code>, the method returns 0.
 *
 * @return The series count.
 */
public int getSeriesCount() {
    int result = 0;
    XYDataset dataset = getDataset();
    if (dataset != null) {
        result = dataset.getSeriesCount();
    }
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:15,代码来源:XYPlot.java

示例7: iterateDomainExtent

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Iterates over the items in an {@link XYDataset} to find
 * the range of x-values. 
 *  
 * @param dataset  the dataset (<code>null</code> not permitted).
 * 
 * @return The range (possibly <code>null</code>).
 */
public static Range iterateDomainExtent(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");   
    }
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    int seriesCount = dataset.getSeriesCount();
    for (int series = 0; series < seriesCount; series++) {
        int itemCount = dataset.getItemCount(series);
        for (int item = 0; item < itemCount; item++) {
            double lvalue;
            double uvalue;
            if (dataset instanceof IntervalXYDataset) {
                IntervalXYDataset intervalXYData = (IntervalXYDataset) dataset;
                lvalue = intervalXYData.getStartXValue(series, item);
                uvalue = intervalXYData.getEndXValue(series, item);
            }
            else {
                lvalue = dataset.getXValue(series, item);
                uvalue = lvalue;
            }
            minimum = Math.min(minimum, lvalue);
            maximum = Math.max(maximum, uvalue);
        }
    }
    if (minimum > maximum) {
        return null;
    }
    else {
        return new Range(minimum, maximum);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:41,代码来源:DatasetUtilities.java

示例8: iterateXYRangeExtent

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Iterates over the data item of the xy dataset to find
 * the range extent.
 * 
 * @param dataset  the dataset (<code>null</code> not permitted).
 * 
 * @return The range (possibly <code>null</code>).
 */
public static Range iterateXYRangeExtent(XYDataset dataset) {
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    int seriesCount = dataset.getSeriesCount();
    for (int series = 0; series < seriesCount; series++) {
        int itemCount = dataset.getItemCount(series);
        for (int item = 0; item < itemCount; item++) {
            double lvalue;
            double uvalue;
            if (dataset instanceof IntervalXYDataset) {
                IntervalXYDataset intervalXYData = (IntervalXYDataset) dataset;
                lvalue = intervalXYData.getStartYValue(series, item);
                uvalue = intervalXYData.getEndYValue(series, item);
            }
            else if (dataset instanceof OHLCDataset) {
                OHLCDataset highLowData = (OHLCDataset) dataset;
                lvalue = highLowData.getLowValue(series, item);
                uvalue = highLowData.getHighValue(series, item);
            }
            else {
                lvalue = dataset.getYValue(series, item);
                uvalue = lvalue;
            }
            if (!Double.isNaN(lvalue)) {
                minimum = Math.min(minimum, lvalue);
            }
            if (!Double.isNaN(uvalue)) {     
                maximum = Math.max(maximum, uvalue);
            }
        }
    }
    if (minimum == Double.POSITIVE_INFINITY) {
        return null;
    }
    else {
        return new Range(minimum, maximum);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:47,代码来源:DatasetUtilities.java

示例9: getLegendItems

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Returns the legend items for the plot.  Each legend item is generated by
 * the plot's renderer, since the renderer is responsible for the visual
 * representation of the data.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {
    if (this.fixedLegendItems != null) {
        return this.fixedLegendItems;
    }
    LegendItemCollection result = new LegendItemCollection();
    int count = this.datasets.size();
    for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {
        XYDataset dataset = getDataset(datasetIndex);
        if (dataset != null) {
            XYItemRenderer renderer = getRenderer(datasetIndex);
            if (renderer == null) {
                renderer = getRenderer(0);
            }
            if (renderer != null) {
                int seriesCount = dataset.getSeriesCount();
                for (int i = 0; i < seriesCount; i++) {
                    if (renderer.isSeriesVisible(i)
                            && renderer.isSeriesVisibleInLegend(i)) {
                        LegendItem item = renderer.getLegendItem(
                                datasetIndex, i);
                        if (item != null) {
                            result.add(item);
                        }
                    }
                }
            }
        }
    }
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:38,代码来源:XYPlot.java

示例10: iterateXYRangeBounds

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Iterates over the data item of the xy dataset to find
 * the range bounds.
 * 
 * @param dataset  the dataset (<code>null</code> not permitted).
 * 
 * @return The range (possibly <code>null</code>).
 */
public static Range iterateXYRangeBounds(XYDataset dataset) {
    double minimum = Double.POSITIVE_INFINITY;
    double maximum = Double.NEGATIVE_INFINITY;
    int seriesCount = dataset.getSeriesCount();
    for (int series = 0; series < seriesCount; series++) {
        int itemCount = dataset.getItemCount(series);
        for (int item = 0; item < itemCount; item++) {
            double lvalue;
            double uvalue;
            if (dataset instanceof IntervalXYDataset) {
                IntervalXYDataset intervalXYData 
                    = (IntervalXYDataset) dataset;
                lvalue = intervalXYData.getStartYValue(series, item);
                uvalue = intervalXYData.getEndYValue(series, item);
            }
            else if (dataset instanceof OHLCDataset) {
                OHLCDataset highLowData = (OHLCDataset) dataset;
                lvalue = highLowData.getLowValue(series, item);
                uvalue = highLowData.getHighValue(series, item);
            }
            else {
                lvalue = dataset.getYValue(series, item);
                uvalue = lvalue;
            }
            if (!Double.isNaN(lvalue)) {
                minimum = Math.min(minimum, lvalue);
            }
            if (!Double.isNaN(uvalue)) {     
                maximum = Math.max(maximum, uvalue);
            }
        }
    }
    if (minimum == Double.POSITIVE_INFINITY) {
        return null;
    }
    else {
        return new Range(minimum, maximum);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:48,代码来源:DatasetUtilities.java

示例11: findMaximumRangeValue

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Returns the maximum range value for the specified dataset.  This is 
 * easy if the dataset implements the {@link RangeInfo} interface (a good 
 * idea if there is an efficient way to determine the maximum value).  
 * Otherwise, it involves iterating over the entire data-set.  Returns 
 * <code>null</code> if all the data values are <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumRangeValue(XYDataset dataset) {

    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }

    // work out the minimum value...
    if (dataset instanceof RangeInfo) {
        RangeInfo info = (RangeInfo) dataset;
        return new Double(info.getRangeUpperBound(true));
    }

    // hasn't implemented RangeInfo, so we'll have to iterate...
    else  {

        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {
                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData 
                        = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndYValue(series, item);
                }
                else if (dataset instanceof OHLCDataset) {
                    OHLCDataset highLowData = (OHLCDataset) dataset;
                    value = highLowData.getHighValue(series, item);
                }
                else {
                    value = dataset.getYValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            return null;
        }
        else {
            return new Double(maximum);
        }

    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:60,代码来源:DatasetUtilities.java

示例12: createChart

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
private JFreeChart createChart(XYDataset dataset) {
	// create the chart...
	JFreeChart chart = ChartFactory.createXYLineChart(null,      // chart title
			null,                      // x axis label
			null,                      // y axis label
			dataset,                  // data
			PlotOrientation.VERTICAL, true,                     // include legend
			true,                     // tooltips
			false                     // urls
			);

	chart.setBackgroundPaint(Color.white);

	// get a reference to the plot for further customisation...
	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setBackgroundPaint(Color.WHITE);
	plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
	plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
	plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

	ValueAxis valueAxis = plot.getRangeAxis();
	valueAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
	valueAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

	ValueAxis domainAxis = plot.getDomainAxis();
	domainAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
	domainAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

	DeviationRenderer renderer = new DeviationRenderer(true, false);
	Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
	if (dataset.getSeriesCount() == 1) {
		renderer.setSeriesStroke(0, stroke);
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);
	} else if (dataset.getSeriesCount() == 2) {
		renderer.setSeriesStroke(0, stroke);
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);

		renderer.setSeriesStroke(1, stroke);
		renderer.setSeriesPaint(1, Color.BLUE);
		renderer.setSeriesFillPaint(1, Color.BLUE);
	} else {
		for (int i = 0; i < dataset.getSeriesCount(); i++) {
			renderer.setSeriesStroke(i, stroke);
			Color color = colorProvider.getPointColor((double) i / (double) (dataset.getSeriesCount() - 1));
			renderer.setSeriesPaint(i, color);
			renderer.setSeriesFillPaint(i, color);
		}
	}
	renderer.setAlpha(0.12f);
	plot.setRenderer(renderer);

	// legend settings
	LegendTitle legend = chart.getLegend();
	if (legend != null) {
		legend.setPosition(RectangleEdge.TOP);
		legend.setFrame(BlockBorder.NONE);
		legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
		legend.setItemFont(PlotterAdapter.LABEL_FONT);
	}
	return chart;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:64,代码来源:ROCChartPlotter.java

示例13: findMinimumDomainValue

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Finds the minimum domain (or X) value for the specified dataset.  This is easy if 
 * the dataset implements the {@link DomainInfo} interface (a good idea if there is an 
 * efficient way to determine the minimum value).  Otherwise, it involves iterating over 
 * the entire data-set.
 * <p>
 * Returns <code>null</code> if all the data values in the dataset are <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The minimum value (possibly <code>null</code>).
 */
public static Number findMinimumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return info.getMinimumDomainValue();
    }
    else {
        double minimum = Double.POSITIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData = (IntervalXYDataset) dataset;
                    value = intervalXYData.getStartXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    minimum = Math.min(minimum, value);
                }

            }
        }
        if (minimum == Double.POSITIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(minimum);
        }
    }

    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:54,代码来源:DatasetUtilities.java

示例14: findMaximumDomainValue

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Returns the maximum domain value for the specified dataset.  This is easy if the 
 * dataset implements the {@link DomainInfo} interface (a good idea if there is an 
 * efficient way to determine the maximum value).  Otherwise, it involves iterating over 
 * the entire data-set.  Returns <code>null</code> if all the data values in the dataset 
 * are <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The maximum value (possibly <code>null</code>).
 */
public static Number findMaximumDomainValue(XYDataset dataset) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    Number result = null;
    // if the dataset implements DomainInfo, life is easy
    if (dataset instanceof DomainInfo) {
        DomainInfo info = (DomainInfo) dataset;
        return info.getMaximumDomainValue();
    }

    // hasn't implemented DomainInfo, so iterate...
    else {
        double maximum = Double.NEGATIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData = (IntervalXYDataset) dataset;
                    value = intervalXYData.getEndXValue(series, item);
                }
                else {
                    value = dataset.getXValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    maximum = Math.max(maximum, value);
                }
            }
        }
        if (maximum == Double.NEGATIVE_INFINITY) {
            result = null;
        }
        else {
            result = new Double(maximum);
        }

    }
    
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:55,代码来源:DatasetUtilities.java

示例15: findMinimumRangeValue

import org.jfree.data.xy.XYDataset; //导入方法依赖的package包/类
/**
 * Returns the minimum range value for the specified dataset.  This is easy if the 
 * dataset implements the {@link RangeInfo} interface (a good idea if there is an 
 * efficient way to determine the minimum value).  Otherwise, it involves iterating 
 * over the entire data-set.  Returns <code>null</code> if all the data values in the 
 * dataset are <code>null</code>.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 *
 * @return The minimum value (possibly <code>null</code>).
 */
public static Number findMinimumRangeValue(XYDataset dataset) {

    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }

    // work out the minimum value...
    if (dataset instanceof RangeInfo) {
        RangeInfo info = (RangeInfo) dataset;
        return info.getMinimumRangeValue();
    }

    // hasn't implemented RangeInfo, so we'll have to iterate...
    else {
        double minimum = Double.POSITIVE_INFINITY;
        int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            int itemCount = dataset.getItemCount(series);
            for (int item = 0; item < itemCount; item++) {

                double value;
                if (dataset instanceof IntervalXYDataset) {
                    IntervalXYDataset intervalXYData = (IntervalXYDataset) dataset;
                    value = intervalXYData.getStartYValue(series, item);
                }
                else if (dataset instanceof OHLCDataset) {
                    OHLCDataset highLowData = (OHLCDataset) dataset;
                    value = highLowData.getLowValue(series, item);
                }
                else {
                    value = dataset.getYValue(series, item);
                }
                if (!Double.isNaN(value)) {
                    minimum = Math.min(minimum, value);
                }

            }
        }
        if (minimum == Double.POSITIVE_INFINITY) {
            return null;
        }
        else {
            return new Double(minimum);
        }

    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:60,代码来源:DatasetUtilities.java


注:本文中的org.jfree.data.xy.XYDataset.getSeriesCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。