gt:             if (orientation == PlotOrientation.HORIZONTAL) {
context: /* ===========================================================
   * AFreeChart : a free chart library for Android(tm) platform.
   *              (based on JFreeChart and JCommon)
   * ===========================================================
   *
   * (C) Copyright 2010, by ICOMSYSTECH Co.,Ltd.
   * (C) Copyright 2000-2009, by Object Refinery Limited and Contributors.
   *
   * Project Info:
   *    AFreeChart: http://code.google.com/p/afreechart/
   *    JFreeChart: http://www.jfree.org/jfreechart/index.html
   *    JCommon   : http://www.jfree.org/jcommon/index.html
   *
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   * 
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU Lesser General Public License for more details.
   * 
   * You should have received a copy of the GNU Lesser General Public License
   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
   *
   * [Android is a trademark of Google Inc.]
   *
   * ----------------------
   * DeviationRenderer.java
   * ----------------------
   * 
   * (C) Copyright 2010, by ICOMSYSTECH Co.,Ltd.
   *
   * Original Author:  shiraki  (for ICOMSYSTECH Co.,Ltd);
   * Contributor(s):   Sato Yoshiaki ;
   *                   Niwano Masayoshi;
   *
   * Changes (from 19-Nov-2010)
   * --------------------------
   * 19-Nov-2010 : port JFreeChart 1.0.13 to Android as "AFreeChart"
   * 
   * ------------- JFreeChart ---------------------------------------------
   * (C) Copyright 2007-2009, by Object Refinery Limited and Contributors.
   *
   * Original Author:  David Gilbert (for Object Refinery Limited);
   * Contributor(s):   -;
   *
   * Changes
   * -------
   * 21-Feb-2007 : Version 1 (DG);
   * 04-May-2007 : Set processVisibleItemsOnly flag to false (DG);
   * 11-Apr-2008 : New override for findRangeBounds() (DG);
   * 27-Mar-2009 : Updated findRangeBounds() to call new inherited method (DG);
   * 
   */
  
  package org.afree.chart.renderer.xy;
  
  import java.util.List;
  
  import android.graphics.Canvas;
  import android.graphics.Paint;
  
  import org.afree.ui.RectangleEdge;
  import org.afree.chart.axis.ValueAxis;
  import org.afree.data.xy.IntervalXYDataset;
  import org.afree.data.Range;
  import org.afree.data.xy.XYDataset;
  import org.afree.chart.entity.EntityCollection;
  import org.afree.chart.plot.CrosshairState;
  import org.afree.chart.plot.PlotOrientation;
  import org.afree.chart.plot.PlotRenderingInfo;
  import org.afree.chart.plot.XYPlot;
  import org.afree.graphics.geom.PathShape;
  import org.afree.graphics.geom.RectShape;
  import org.afree.graphics.PaintUtility;
  
  /**
   * A specialised subclass of the {@link XYLineAndShapeRenderer} that requires
   * an {@link IntervalXYDataset} and represents the y-interval by shading an
   * area behind the y-values on the chart.
   * The example shown here is generated by the
   * <code>DeviationRendererDemo1.java</code> program included in the
   * AFreeChart demo collection:
   * <br><br>
   * <img src="../../../../../images/DeviationRendererSample.png"
   * alt="DeviationRendererSample.png" />
   *
   * @since JFreeChart 1.0.5
   */
  public class DeviationRenderer extends XYLineAndShapeRenderer {
  
      /**
       * 
       */
      private static final long serialVersionUID = 5133843508142509280L;
  
      /**
       * A state object that is passed to each call to <code>drawItem</code>.
       */
      public static class State extends XYLineAndShapeRenderer.State {
  
          /**
           * A list of coordinates for the upper y-values in the current series
           * (after translation into Java2D space).
           */
          public List upperCoordinates;
  
          /**
           * A list of coordinates for the lower y-values in the current series
           * (after translation into Java2D space).
           */
          public List lowerCoordinates;
  
          /**
           * Creates a new state instance.
           *
           * @param info  the plot rendering info.
           */
          public State(PlotRenderingInfo info) {
              super(info);
              this.lowerCoordinates = new java.util.ArrayList();
              this.upperCoordinates = new java.util.ArrayList();
          }
  
      }
  
      /** The alpha transparency for the interval shading. */
      private float alpha;
  
      /**
       * Creates a new renderer that displays lines and shapes for the data
       * items, as well as the shaded area for the y-interval.
       */
      public DeviationRenderer() {
          this(true, true);
      }
  
      /**
       * Creates a new renderer.
       *
       * @param lines  show lines between data items?
       * @param shapes  show a shape for each data item?
       */
      public DeviationRenderer(boolean lines, boolean shapes) {
          super(lines, shapes);
          super.setDrawSeriesLineAsPath(true);
          this.alpha = 0.5f;
      }
  
      /**
       * Returns the alpha transparency for the background shading.
       *
       * @return The alpha transparency.
       *
       * @see #setAlpha(float)
       */
      public float getAlpha() {
          return this.alpha;
      }
  
      /**
       * Sets the alpha transparency for the background shading, and sends a
       * {@link RendererChangeEvent} to all registered listeners.
       *
       * @param alpha   the alpha (in the range 0.0f to 1.0f).
       *
       * @see #getAlpha()
       */
      public void setAlpha(float alpha) {
          if (alpha < 0.0f || alpha > 1.0f) {
              throw new IllegalArgumentException(
                      "Requires 'alpha' in the range 0.0 to 1.0.");
          }
          this.alpha = alpha;
          fireChangeEvent();
      }
  
      /**
       * This method is overridden so that this flag cannot be changed---it is
       * set to <code>true</code> for this renderer.
       *
       * @param flag  ignored.
       */
      public void setDrawSeriesLineAsPath(boolean flag) {
          // ignore
      }
  
      /**
       * Returns the range of values the renderer requires to display all the
       * items from the specified dataset.
       *
       * @param dataset  the dataset (<code>null</code> permitted).
       *
       * @return The range (<code>null</code> if the dataset is <code>null</code>
       *         or empty).
       */
      public Range findRangeBounds(XYDataset dataset) {
          return findRangeBounds(dataset, true);
      }
  
      /**
       * Initialises and returns a state object that can be passed to each
       * invocation of the {@link #drawItem} method.
       *
       * @param canvas  the graphics target.
       * @param dataArea  the data area.
       * @param plot  the plot.
       * @param dataset  the dataset.
       * @param info  the plot rendering info.
       *
       * @return A newly initialised state object.
       */
      public XYItemRendererState initialise(Canvas canvas, RectShape dataArea,
              XYPlot plot, XYDataset dataset, PlotRenderingInfo info) {
          State state = new State(info);
          state.seriesPath = new PathShape();
          state.setProcessVisibleItemsOnly(false);
          return state;
      }
  
      /**
       * Returns the number of passes (through the dataset) used by this
       * renderer.
       *
       * @return <code>3</code>.
       */
      public int getPassCount() {
          return 3;
      }
  
      /**
       * Returns <code>true</code> if this is the pass where the shapes are
       * drawn.
       *
       * @param pass  the pass index.
       *
       * @return A boolean.
       *
       * @see #isLinePass(int)
       */
      protected boolean isItemPass(int pass) {
          return (pass == 2);
      }
  
      /**
       * Returns <code>true</code> if this is the pass where the lines are
       * drawn.
       *
       * @param pass  the pass index.
       *
       * @return A boolean.
       *
       * @see #isItemPass(int)
       */
      protected boolean isLinePass(int pass) {
          return (pass == 1);
      }
  
      /**
       * Draws the visual representation of a single data item.
       *
       * @param canvas  the graphics device.
       * @param state  the renderer state.
       * @param dataArea  the area within which the data is being drawn.
       * @param info  collects information about the drawing.
       * @param plot  the plot (can be used to obtain standard color
       *              information etc).
       * @param domainAxis  the domain axis.
       * @param rangeAxis  the range axis.
       * @param dataset  the dataset.
       * @param series  the series index (zero-based).
       * @param item  the item index (zero-based).
       * @param crosshairState  crosshair information for the plot
       *                        (<code>null</code> permitted).
       * @param pass  the pass index.
       */
      public void drawItem(Canvas canvas,
                           XYItemRendererState state,
                           RectShape dataArea,
                           PlotRenderingInfo info,
                           XYPlot plot,
                           ValueAxis domainAxis,
                           ValueAxis rangeAxis,
                           XYDataset dataset,
                           int series,
                           int item,
                           CrosshairState crosshairState,
                           int pass) {
  
          // do nothing if item is not visible
          if (!getItemVisible(series, item)) {
              return;
          }
  
          // first pass draws the shading
          if (pass == 0) {
              IntervalXYDataset intervalDataset = (IntervalXYDataset) dataset;
              State drState = (State) state;
  
              double x = intervalDataset.getXValue(series, item);
              double yLow = intervalDataset.getStartYValue(series, item);
              double yHigh  = intervalDataset.getEndYValue(series, item);
  
              RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
              RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
  
              double xx = domainAxis.valueToJava2D(x, dataArea, xAxisLocation);
              double yyLow = rangeAxis.valueToJava2D(yLow, dataArea,
                      yAxisLocation);
              double yyHigh = rangeAxis.valueToJava2D(yHigh, dataArea,
                      yAxisLocation);
  
              PlotOrientation orientation = plot.getOrientation();
  