Examples of LegendItemCollection


Examples of org.jfree.chart.LegendItemCollection

     */
    public LegendItemCollection getLegendItems() {
        if (this.fixedLegendItems != null) {
            return this.fixedLegendItems;
        }
        LegendItemCollection result = new LegendItemCollection();
        // get the legend items for the datasets...
        int count = this.datasets.size();
        for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {
            CategoryDataset dataset = getDataset(datasetIndex);
            if (dataset != null) {
                CategoryItemRenderer renderer = getRenderer(datasetIndex);
                if (renderer != null) {
                    result.addAll(renderer.getLegendItems());
                }
            }
        }
        return result;
    }
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

     *
     * @return The legend items.
     */
    public LegendItemCollection getLegendItems() {

        LegendItemCollection result = new LegendItemCollection();
        if (this.dataset == null) {
            return result;
        }

        List keys = null;
        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }
        if (keys == null) {
            return result;
        }
        int section = 0;
        Iterator iterator = keys.iterator();
        while (iterator.hasNext()) {
            Comparable key = (Comparable) iterator.next();
            String label = key.toString()// TODO: use a generator here
            String description = label;
            Paint paint = (Paint) this.sectionPaints.get(key);
            LegendItem item = new LegendItem(label, description, null,
                    null, getLegendItemShape(), paint,
                    Plot.DEFAULT_OUTLINE_STROKE, paint);
            item.setSeriesKey(key);
            item.setSeriesIndex(section);
            item.setDataset(getDataset());
            result.add(item);
            section++;
        }
        if (this.limit > 0.0) {
            LegendItem a = new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    getLegendItemShape(), this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE, this.aggregatedItemsPaint);
            result.add(a);
        }
        return result;
    }
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

    * @return The legend items.
    */
   @Override
   public LegendItemCollection getLegendItems()
   {
      LegendItemCollection result = getFixedLegendItems();
      if (result == null)
      {
         result = new LegendItemCollection();
         if (this.subplots != null)
         {
            Iterator iterator = this.subplots.iterator();
            while (iterator.hasNext())
            {
               XYPlot plot = (XYPlot) iterator.next();
               LegendItemCollection more = plot.getLegendItems();
               result.addAll(more);
            }
         }
      }
      return result;
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

     * Returns a collection of legend items for the plot.
     *
     * @return The legend items.
     */
    public LegendItemCollection getLegendItems() {
        LegendItemCollection result = getFixedLegendItems();
        if (result == null) {
            result = new LegendItemCollection();
            if (this.subplots != null) {
                Iterator iterator = this.subplots.iterator();
                while (iterator.hasNext()) {
                    CategoryPlot plot = (CategoryPlot) iterator.next();
                    LegendItemCollection more = plot.getLegendItems();
                    result.addAll(more);
                }
            }
        }
        return result;
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

     */
    public LegendItemCollection getLegendItems() {
        if (this.fixedLegendItems != null) {
            return this.fixedLegendItems;
        }
        LegendItemCollection result = new LegendItemCollection();
        int count = this.datasets.size();
        for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {
            XYDataset dataset = getDataset(datasetIndex);
            PolarItemRenderer renderer = getRenderer(datasetIndex);
            if (dataset != null && renderer != null) {
                int seriesCount = dataset.getSeriesCount();
                for (int i = 0; i < seriesCount; i++) {
                    LegendItem item = renderer.getLegendItem(i);
                    result.add(item);
                }
            }
        }
        return result;
    }
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

     * Returns a collection of legend items for the plot.
     *
     * @return The legend items.
     */
    public LegendItemCollection getLegendItems() {
        LegendItemCollection result = getFixedLegendItems();
        if (result == null) {
            result = new LegendItemCollection();

            if (this.subplots != null) {
                Iterator iterator = this.subplots.iterator();
                while (iterator.hasNext()) {
                    XYPlot plot = (XYPlot) iterator.next();
                    LegendItemCollection more = plot.getLegendItems();
                    result.addAll(more);
                }
            }
        }
        return result;
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

     * Returns an item for each interval.
     *
     * @return A collection of legend items.
     */
    public LegendItemCollection getLegendItems() {
        LegendItemCollection result = new LegendItemCollection();
        Iterator iterator = this.intervals.iterator();
        while (iterator.hasNext()) {
            MeterInterval mi = (MeterInterval) iterator.next();
            Paint color = mi.getBackgroundPaint();
            if (color == null) {
                color = mi.getOutlinePaint();
            }
            LegendItem item = new LegendItem(mi.getLabel(), mi.getLabel(),
                    null, null, new Rectangle2D.Double(-4.0, -4.0, 8.0, 8.0),
                    color);
            item.setDataset(getDataset());
            result.add(item);
        }
        return result;
    }
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

   @Override
   public LegendItemCollection getLegendItems()
   {
      if (this.plot == null)
      {
         return new LegendItemCollection();
      }
      LegendItemCollection result = new LegendItemCollection();
      int index = this.plot.getIndexOf(this);
      XYDataset dataset = this.plot.getDataset(index);
      if (dataset != null)
      {
         int seriesCount = dataset.getSeriesCount();
         for (int i = 0; i < seriesCount; i++)
         {
            if (isSeriesVisibleInLegend(i))
            {
               LegendItem item = getLegendItem(index, i);
               if (item != null)
               {
                  result.add(item);
               }
            }
         }

      }
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

     * @return The legend item collection (never <code>null</code>).
     *
     * @see #getLegendItem(int, int)
     */
    public LegendItemCollection getLegendItems() {
        LegendItemCollection result = new LegendItemCollection();
        if (this.plot == null) {
            return result;
        }
        int index = this.plot.getIndexOf(this);
        CategoryDataset dataset = this.plot.getDataset(index);
        if (dataset == null) {
            return result;
        }
        int seriesCount = dataset.getRowCount();
        if (plot.getRowRenderingOrder().equals(SortOrder.ASCENDING)) {
            for (int i = 0; i < seriesCount; i++) {
                if (isSeriesVisibleInLegend(i)) {
                    LegendItem item = getLegendItem(index, i);
                    if (item != null) {
                        result.add(item);
                    }
                }
            }
        }
        else {
            for (int i = seriesCount - 1; i >= 0; i--) {
                if (isSeriesVisibleInLegend(i)) {
                    LegendItem item = getLegendItem(index, i);
                    if (item != null) {
                        result.add(item);
                    }
                }
            }
        }
        return result;
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

    *
    * @return The legend items.
    */
   public LegendItemCollection getLegendCollection()
   {
      LegendItemCollection result = new LegendItemCollection();
      if (this.paintIndex != null && this.paintIndex.size() > 0)
      {
         if (this.paintIndex.size() <= this.paintLimit)
         {
            for (Iterator i = this.paintIndex.entrySet().iterator();
                    i.hasNext();)
            {
               // in this case, every color has a unique value
               Map.Entry entry = (Map.Entry) i.next();
               String label = entry.getKey().toString();
               String description = label;
               Shape shape = new Rectangle2D.Double(1d, 1d, 1d, 1d);
               Paint paint = lookupSeriesPaint(
                       ((Integer) entry.getValue()).intValue());
               Paint outlinePaint = Color.black;
               Stroke outlineStroke = DEFAULT_STROKE;

               result.add(new LegendItem(label, description, null,
                       null, shape, paint, outlineStroke, outlinePaint));

            }
         }
         else
         {
            // in this case, every color has a range of values
            Set unique = new HashSet();
           
            for (Iterator i = this.paintIndex.entrySet().iterator();
                    i.hasNext();)
            {
               Map.Entry entry = (Map.Entry) i.next();
               if (unique.add(entry.getValue()))
               {
                  String label = getMinPaintValue(
                          (Integer) entry.getValue()).toString()
                          + " - " + getMaxPaintValue(
                          (Integer) entry.getValue()).toString();
                  String description = label;
                  Shape shape = new Rectangle2D.Double(1d, 1d, 1d, 1d);
                 
                  Paint paint = getSeriesPaint(
                          ((Integer) entry.getValue()).intValue());
                 
                  Paint outlinePaint = Color.black;
                  Stroke outlineStroke = DEFAULT_STROKE;

                  result.add(new LegendItem(label, description,
                          null, null, shape, paint, outlineStroke,
                          outlinePaint));
               }
            } // end foreach map entry
         } // end else
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.