List of usage examples for org.jfree.chart.renderer.xy XYItemRenderer findDomainBounds
public Range findDomainBounds(XYDataset dataset);
From source file:ucar.unidata.idv.control.chart.MyXYPlot.java
/** * Returns the range for the specified axis. * * @param axis the axis./* ww w . j av a2 s . c o m*/ * * @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; }