#216 Ignore hidden series in axis range determination

Peter Kolb

The patch inludes the following:
-A flag ignoreHiddenSeriesInRange in XYPot to determine whether hidden series should be excluded when the value range for an XYDataset is calculated.
change to XYPlot.rendererChanged(RendererChangeEvent event): changes in series visibility trigger a RendererChangeEvent, but in order to initiate a recalculation of the value ranges, an AxisChangeEvent needs to be triggered as well. This is achieved by calling Axis.configure() on the range and domain axis that belong to the respective dataset.
-Change to AbstractXYItemRenderer.findDomainBounds(XYDataset set) and AbstractXYItemRenderer.findRangeBounds(XYDataset set). Instead of returning DatasetUtilities.find[Range|Domain]Bounds(XYDataset dataset, includeIntervals false)
they will return
DatasetUtilities.find[Range|Domain]Bounds(XYDataset dataset, includeIntervals false,XYItemRenderer renderer,boolean ignoreHiddenSeries). The flag ignoreHiddenSeries is retrieved via AbstractXYItemRenderer.getPlot().getIgnoreHiddenSeriesInRange()
-Addition to DatasetUtilities. New methods
public static Range find[Domain|Range]Bounds(XYDataset dataset, boolean includeInterval,XYItemRenderer renderer,boolean inoreHiddenSeries)
public static Range iterateXYRangeBounds(XYDataset dataset,XYItemRenderer renderer,boolean ignoreHiddenSeries)
public static Range iterateDomainBounds(XYDataset dataset, boolean includeInterval,XYItemRenderer renderer,boolean ignoreHiddenSeries)
that will ignore series marked as invisible in the renderer if desired.


  • Peter Kolb

    Peter Kolb - 2008-05-18

    ZIP archive with patch files for XYPlot, AbstractXYItemRenderer, and DatasetUtilities

  • Henry Proudhon

    Henry Proudhon - 2008-05-24

    Logged In: YES
    Originator: NO

    this looks like a good idea and a sound implementation to me.
    I'm not sure I've got all the understanding of the code to comment your patch but I personnaly use a similar approach to achieve the same result.
    So in short I'd like to see this accepted :)
    Perhaps the thing one might like to see is a more general approach than just limited to the XY thing.

  • Peter Kolb

    Peter Kolb - 2008-07-06

    Logged In: YES
    Originator: YES

    New version patched against JFreeChart 1.0.10 and updated:
    - The ignoreHiddenSeriesInRange flag and the corresponding getters/setters have been moved from XYPlot to Plot and can thus be used from CategoryPlot as well.
    - Change to AbstractCategoryItemRenderer: findRangeBounds(CategoryDataset dataset) now returns DatasetUtilities.findRangeBounds(dataset, true, this, getPlot().getIgnoreHiddenSeriesInRange()). The behaviour of AbstractXYItemRenderer.findRange/DomainBounds(XYDataset dataset) has been changed. These methods now return DatasetUtilities.find[Range|Domain]Bounds(dataset,true,this,getPlot().getIgnoreHiddenSeriesInRange())i.e. intervals will be included.
    - Several new methods for DatasetUtilities:
    public static Range findRangeBounds(CategoryDataset dataset,boolean includeInterval,CategoryItemRenderer renderer,boolean ignoreHiddenSeries) that calls
    public static Range iterateRangeBounds(CategoryDataset dataset,boolean includeInterval,CategoryItemRenderer renderer,boolean ignoreHiddenSeries). Hidden series are omitted from the calculation of the axis range dependent on the ignoreHiddenSeries flag.

    Several other DatasetUtilities-methods concerning the range determination have been updated since treatment of Double.NaN values was sometimes missing.

    BarRenderer has been patched. BarRenderer.findRangeBounds(CategoryDataset dataset) now calls super.findRangeBounds() instead of invoking a DatasetUtilities-method and thus profits from the hidden series treatment. The present behaviour of BarRenderer concerning hidden series (hidden series are only removed from the legend but the bars are still drawn) has been corrected as well.

    File Added: HiddenSeriesPatch_incl_category.zip

  • Peter Kolb

    Peter Kolb - 2008-07-06

    File with updated patches for Abstract[XY/Category]ItemRenderer, BarRenderer,Plot,DatasetUtilities

  • David Gilbert

    David Gilbert - 2008-10-07
    • priority: 5 --> 8
    • assigned_to: nobody --> mungady

Log in to post a comment.