Home | History | Annotate | Download | only in xy
      1 /*
      2  * Copyright 2012 AndroidPlot.com
      3  *
      4  *    Licensed under the Apache License, Version 2.0 (the "License");
      5  *    you may not use this file except in compliance with the License.
      6  *    You may obtain a copy of the License at
      7  *
      8  *        http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  *    Unless required by applicable law or agreed to in writing, software
     11  *    distributed under the License is distributed on an "AS IS" BASIS,
     12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  *    See the License for the specific language governing permissions and
     14  *    limitations under the License.
     15  */
     16 
     17 package com.androidplot.xy;
     18 
     19 import android.graphics.Canvas;
     20 import android.graphics.RectF;
     21 import com.androidplot.exception.PlotRenderException;
     22 import com.androidplot.ui.SeriesAndFormatterList;
     23 import com.androidplot.ui.SeriesRenderer;
     24 import com.androidplot.util.ZIndexable;
     25 
     26 import java.util.Hashtable;
     27 
     28 public abstract class XYSeriesRenderer<XYFormatterType extends XYSeriesFormatter>
     29         extends SeriesRenderer<XYPlot, XYSeries, XYFormatterType> {
     30 
     31     public XYSeriesRenderer(XYPlot plot) {
     32         super(plot);
     33     }
     34 
     35     public Hashtable<XYRegionFormatter, String> getUniqueRegionFormatters() {
     36 
     37         Hashtable<XYRegionFormatter, String> found = new Hashtable<XYRegionFormatter, String>();
     38         SeriesAndFormatterList<XYSeries, XYFormatterType> sfl = getSeriesAndFormatterList();
     39 
     40         if (sfl != null) {
     41             for (XYFormatterType xyf : sfl.getFormatterList()) {
     42                 ZIndexable<RectRegion> regionIndexer = xyf.getRegions();
     43                 for (RectRegion region : regionIndexer.elements()) {
     44                     XYRegionFormatter f = xyf.getRegionFormatter(region);
     45                     found.put(f, region.getLabel());
     46                 }
     47             }
     48         }
     49 
     50         return found;
     51     }
     52 }
     53