Java Code Examples for org.jfree.data.Range#combine()

The following examples show how to use org.jfree.data.Range#combine() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CategoryPlot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the range of data values that will be plotted against the range
 * axis.  If the dataset is <code>null</code>, this method returns
 * <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
@Override
public Range getDataRange(ValueAxis axis) {
    Range result = null;
    List<CategoryDataset> mappedDatasets = new ArrayList<CategoryDataset>();
    int rangeIndex = findRangeAxisIndex(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union
    // of the ranges.
    for (CategoryDataset d : mappedDatasets) {
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
        }
    }
    return result;
}
 
Example 2
Source File: CombinedXYPlot.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the bounds of the data values that will be plotted against
 * the specified axis.
 *
 * @param axis  the axis.
 *
 * @return The bounds.
 */
public Range getDataRange(ValueAxis axis) {
    Range l_result = null;
    Iterator l_itr = getSubplots().iterator();
    while (l_itr.hasNext()) {
        XYPlot l_subplot = (XYPlot) l_itr.next();

        l_result = Range.combine(l_result, l_subplot.getDataRange(axis));
    }
    return l_result;
}
 
Example 3
Source File: CategoryPlot.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the range of data values that will be plotted against the range
 * axis.  If the dataset is <code>null</code>, this method returns
 * <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    List mappedDatasets = new ArrayList();

    int rangeIndex = this.rangeAxes.indexOf(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union
    // of the ranges.
    Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
        CategoryDataset d = (CategoryDataset) iterator.next();
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
        }
    }
    return result;

}
 
Example 4
Source File: patch1-Chart-26-jMutRepair_patch1-Chart-26-jMutRepair_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Returns the range of data values that will be plotted against the range 
 * axis.  If the dataset is <code>null</code>, this method returns 
 * <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    List mappedDatasets = new ArrayList();
    
    int rangeIndex = this.rangeAxes.indexOf(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union 
    // of the ranges.
    Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
        CategoryDataset d = (CategoryDataset) iterator.next();
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
        }
    }
    return result;

}
 
Example 5
Source File: CombinedCategoryPlot.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the bounds of the data values that will be plotted against
 * the specified axis.
 *
 * @param axis  the axis.
 *
 * @return The bounds.
 */
public Range getDataRange(ValueAxis axis) {
    Range l_result = null;
    Iterator l_itr = getSubplots().iterator();
    while (l_itr.hasNext()) {
        CategoryPlot l_subplot = (CategoryPlot) l_itr.next();

        l_result = Range.combine(l_result, l_subplot.getDataRange(axis));
    }
    return l_result;
}
 
Example 6
Source File: jKali_001_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Returns the range of data values that will be plotted against the range 
 * axis.  If the dataset is <code>null</code>, this method returns 
 * <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    List mappedDatasets = new ArrayList();
    
    int rangeIndex = this.rangeAxes.indexOf(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union 
    // of the ranges.
    Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
        CategoryDataset d = (CategoryDataset) iterator.next();
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
        }
    }
    return result;

}
 
Example 7
Source File: Cardumen_00143_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Returns the range of data values that will be plotted against the range 
 * axis.  If the dataset is <code>null</code>, this method returns 
 * <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    List mappedDatasets = new ArrayList();
    
    int rangeIndex = this.rangeAxes.indexOf(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union 
    // of the ranges.
    Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
        CategoryDataset d = (CategoryDataset) iterator.next();
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
        }
    }
    return result;

}
 
Example 8
Source File: CombinedRangeCategoryPlot.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the range for the axis.  This is the combined range of all the
 * subplots.
 *
 * @param axis  the axis.
 *
 * @return The range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    if (this.subplots != null) {
        Iterator iterator = this.subplots.iterator();
        while (iterator.hasNext()) {
            CategoryPlot subplot = (CategoryPlot) iterator.next();
            result = Range.combine(result, subplot.getDataRange(axis));
        }
    }
    return result;

}
 
Example 9
Source File: 1_CategoryPlot.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the range of data values that will be plotted against the range 
 * axis.  If the dataset is <code>null</code>, this method returns 
 * <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    List mappedDatasets = new ArrayList();
    
    int rangeIndex = this.rangeAxes.indexOf(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union 
    // of the ranges.
    Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
        CategoryDataset d = (CategoryDataset) iterator.next();
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
        }
    }
    return result;

}
 
Example 10
Source File: jMutRepair_0030_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Returns the range of data values that will be plotted against the range 
 * axis.  If the dataset is <code>null</code>, this method returns 
 * <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    List mappedDatasets = new ArrayList();
    
    int rangeIndex = this.rangeAxes.indexOf(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union 
    // of the ranges.
    Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
        CategoryDataset d = (CategoryDataset) iterator.next();
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
        }
    }
    return result;

}
 
Example 11
Source File: JGenProg2017_005_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Returns the range of data values that will be plotted against the range 
 * axis.  If the dataset is <code>null</code>, this method returns 
 * <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    List mappedDatasets = new ArrayList();
    
    int rangeIndex = this.rangeAxes.indexOf(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union 
    // of the ranges.
    Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
        CategoryDataset d = (CategoryDataset) iterator.next();
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
        }
    }
    return result;

}
 
Example 12
Source File: Chart_14_CategoryPlot_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Returns the range of data values that will be plotted against the range 
 * axis.  If the dataset is <code>null</code>, this method returns 
 * <code>null</code>.
 *
 * @param axis  the axis.
 *
 * @return The data range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    List mappedDatasets = new ArrayList();
    
    int rangeIndex = this.rangeAxes.indexOf(axis);
    if (rangeIndex >= 0) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex));
    }
    else if (axis == getRangeAxis()) {
        mappedDatasets.addAll(datasetsMappedToRangeAxis(0));
    }

    // iterate through the datasets that map to the axis and get the union 
    // of the ranges.
    Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
        CategoryDataset d = (CategoryDataset) iterator.next();
        CategoryItemRenderer r = getRendererForDataset(d);
        if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
        }
    }
    return result;

}
 
Example 13
Source File: JGenProg2017_0047_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns the minimum and maximum values for the dataset's range 
 * (y-values), assuming that the series in one category are stacked.
 *
 * @param dataset  the dataset.
 * @param map  a structure that maps series to groups.
 *
 * @return The value range (<code>null</code> if the dataset contains no 
 *         values).
 */
public static Range findStackedRangeBounds(CategoryDataset dataset,
                                           KeyToGroupMap map) {

    Range result = null;
    if (dataset != null) {
        
        // create an array holding the group indices...
        int[] groupIndex = new int[dataset.getRowCount()];
        for (int i = 0; i < dataset.getRowCount(); i++) {
            groupIndex[i] = map.getGroupIndex(
                map.getGroup(dataset.getRowKey(i))
            );   
        }
        
        // minimum and maximum for each group...
        int groupCount = map.getGroupCount();
        double[] minimum = new double[groupCount];
        double[] maximum = new double[groupCount];
        
        int categoryCount = dataset.getColumnCount();
        for (int item = 0; item < categoryCount; item++) {
            double[] positive = new double[groupCount];
            double[] negative = new double[groupCount];
            int seriesCount = dataset.getRowCount();
            for (int series = 0; series < seriesCount; series++) {
                Number number = dataset.getValue(series, item);
                if (number != null) {
                    double value = number.doubleValue();
                    if (value > 0.0) {
                        positive[groupIndex[series]] 
                             = positive[groupIndex[series]] + value;
                    }
                    if (value < 0.0) {
                        negative[groupIndex[series]] 
                             = negative[groupIndex[series]] + value;
                             // '+', remember value is negative
                    }
                }
            }
            for (int g = 0; g < groupCount; g++) {
                minimum[g] = Math.min(minimum[g], negative[g]);
                maximum[g] = Math.max(maximum[g], positive[g]);
            }
        }
        for (int j = 0; j < groupCount; j++) {
            result = Range.combine(
                result, new Range(minimum[j], maximum[j])
            );
        }
    }
    return result;

}
 
Example 14
Source File: Chart_14_XYPlot_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns the range for the specified axis.
 *
 * @param axis  the axis.
 *
 * @return The range.
 */
public Range getDataRange(ValueAxis axis) {

    Range result = null;
    List mappedDatasets = new ArrayList();
    boolean isDomainAxis = true;

    // is it a domain axis?
    int domainIndex = getDomainAxisIndex(axis);
    if (domainIndex >= 0) {
        isDomainAxis = true;
        mappedDatasets.addAll(getDatasetsMappedToDomainAxis(
                new Integer(domainIndex)));
    }

    // or is it a range axis?
    int rangeIndex = getRangeAxisIndex(axis);
    if (rangeIndex >= 0) {
        isDomainAxis = false;
        mappedDatasets.addAll(getDatasetsMappedToRangeAxis(
                new Integer(rangeIndex)));
    }

    // iterate through the datasets that map to the axis and get the union
    // of the ranges.
    Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
        XYDataset d = (XYDataset) iterator.next();
        if (d != null) {
            XYItemRenderer r = getRendererForDataset(d);
            if (isDomainAxis) {
                if (r != null) {
                    result = Range.combine(result, r.findDomainBounds(d));
                }
                else {
                    result = Range.combine(result, 
                            DatasetUtilities.findDomainBounds(d));
                }
            }
            else {
                if (r != null) {
                    result = Range.combine(result, r.findRangeBounds(d));
                }
                else {
                    result = Range.combine(result, 
                            DatasetUtilities.findRangeBounds(d));
                }
            }
        }
    }
    return result;

}
 
Example 15
Source File: CombinedDomainXYPlot.java    From buffer_bci with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Returns a range representing the extent of the data values in this plot
 * (obtained from the subplots) that will be rendered against the specified
 * axis.  NOTE: This method is intended for internal JFreeChart use, and
 * is public only so that code in the axis classes can call it.  Since
 * only the domain axis is shared between subplots, the JFreeChart code
 * will only call this method for the domain values (although this is not
 * checked/enforced).
 *
 * @param axis  the axis.
 *
 * @return The range (possibly <code>null</code>).
 */
@Override
public Range getDataRange(ValueAxis axis) {
    Range result = null;
    if (this.subplots != null) {
        Iterator iterator = this.subplots.iterator();
        while (iterator.hasNext()) {
            XYPlot subplot = (XYPlot) iterator.next();
            result = Range.combine(result, subplot.getDataRange(axis));
        }
    }
    return result;
}
 
Example 16
Source File: CombinedRangeXYPlot.java    From openstock with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Returns a range representing the extent of the data values in this plot
 * (obtained from the subplots) that will be rendered against the specified
 * axis.  NOTE: This method is intended for internal JFreeChart use, and
 * is public only so that code in the axis classes can call it.  Since
 * only the range axis is shared between subplots, the JFreeChart code
 * will only call this method for the range values (although this is not
 * checked/enforced).
 *
 * @param axis  the axis.
 *
 * @return The range.
 */
@Override
public Range getDataRange(ValueAxis axis) {
    Range result = null;
    if (this.subplots != null) {
        Iterator iterator = this.subplots.iterator();
        while (iterator.hasNext()) {
            XYPlot subplot = (XYPlot) iterator.next();
            result = Range.combine(result, subplot.getDataRange(axis));
        }
    }
    return result;
}
 
Example 17
Source File: CombinedRangeCategoryPlot.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
* Returns a range representing the extent of the data values in this plot
* (obtained from the subplots) that will be rendered against the specified 
* axis.  NOTE: This method is intended for internal JFreeChart use, and 
* is public only so that code in the axis classes can call it.  Since 
* only the range axis is shared between subplots, the JFreeChart code 
* will only call this method for the range values (although this is not 
* checked/enforced).
 *
 * @param axis  the axis.
 *
 * @return The range.
 */
public Range getDataRange(ValueAxis axis) {
    Range result = null;
    if (this.subplots != null) {
        Iterator iterator = this.subplots.iterator();
        while (iterator.hasNext()) {
            CategoryPlot subplot = (CategoryPlot) iterator.next();
            result = Range.combine(result, subplot.getDataRange(axis));
        }
    }
    return result;
}
 
Example 18
Source File: CombinedRangeCategoryPlot.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
* Returns a range representing the extent of the data values in this plot
* (obtained from the subplots) that will be rendered against the specified
* axis.  NOTE: This method is intended for internal JFreeChart use, and
* is public only so that code in the axis classes can call it.  Since
* only the range axis is shared between subplots, the JFreeChart code
* will only call this method for the range values (although this is not
* checked/enforced).
 *
 * @param axis  the axis.
 *
 * @return The range.
 */
public Range getDataRange(ValueAxis axis) {
    Range result = null;
    if (this.subplots != null) {
        Iterator iterator = this.subplots.iterator();
        while (iterator.hasNext()) {
            CategoryPlot subplot = (CategoryPlot) iterator.next();
            result = Range.combine(result, subplot.getDataRange(axis));
        }
    }
    return result;
}
 
Example 19
Source File: CombinedDomainXYPlot.java    From ccu-historian with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Returns a range representing the extent of the data values in this plot
 * (obtained from the subplots) that will be rendered against the specified
 * axis.  NOTE: This method is intended for internal JFreeChart use, and
 * is public only so that code in the axis classes can call it.  Since
 * only the domain axis is shared between subplots, the JFreeChart code
 * will only call this method for the domain values (although this is not
 * checked/enforced).
 *
 * @param axis  the axis.
 *
 * @return The range (possibly <code>null</code>).
 */
@Override
public Range getDataRange(ValueAxis axis) {
    Range result = null;
    if (this.subplots != null) {
        Iterator iterator = this.subplots.iterator();
        while (iterator.hasNext()) {
            XYPlot subplot = (XYPlot) iterator.next();
            result = Range.combine(result, subplot.getDataRange(axis));
        }
    }
    return result;
}
 
Example 20
Source File: CombinedRangeCategoryPlot.java    From SIMVA-SoS with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a range representing the extent of the data values in this plot
 * (obtained from the subplots) that will be rendered against the specified
 * axis.  NOTE: This method is intended for internal JFreeChart use, and
 * is public only so that code in the axis classes can call it.  Since
 * only the range axis is shared between subplots, the JFreeChart code
 * will only call this method for the range values (although this is not
 * checked/enforced).
  *
  * @param axis  the axis.
  *
  * @return The range.
  */
@Override
 public Range getDataRange(ValueAxis axis) {
     Range result = null;
     if (this.subplots != null) {
         Iterator iterator = this.subplots.iterator();
         while (iterator.hasNext()) {
             CategoryPlot subplot = (CategoryPlot) iterator.next();
             result = Range.combine(result, subplot.getDataRange(axis));
         }
     }
     return result;
 }