Examples of LegendItemCollection


Examples of com.positive.charts.legend.LegendItemCollection

      this.items.setArrangement(this.hLayout);
    } else {
      this.items.setArrangement(this.vLayout);
    }
    for (int s = 0; s < this.sources.length; s++) {
      final LegendItemCollection legendItems = this.sources[s]
          .getLegendItems();
      if (legendItems != null) {
        for (int i = 0; i < legendItems.getItemCount(); i++) {
          final LegendItem item = legendItems.get(i);
          final Block block = this.createLegendItemBlock(item);
          this.items.add(block);
        }
      }
    }
View Full Code Here

Examples of com.positive.charts.legend.LegendItemCollection

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

Examples of com.positive.charts.legend.LegendItemCollection

   *
   * @return The legend item collection (never <code>null</code>).
   */
  public LegendItemCollection getLegendItems() {
    if (this.plot == null) {
      return new LegendItemCollection();
    }
    final LegendItemCollection result = new LegendItemCollection();
    final int index = this.plot.getIndexOf(this);
    final XYDataset dataset = this.plot.getDataset(index);
    if (dataset != null) {
      final int seriesCount = dataset.getSeriesCount();
      for (int i = 0; i < seriesCount; i++) {
        if (this.isSeriesVisibleInLegend(i)) {
          final LegendItem item = this.getLegendItem(index, i);
          if (item != null) {
            result.add(item);
          }
        }
      }

    }
View Full Code Here

Examples of com.positive.charts.legend.LegendItemCollection

   * behaviour by overriding this method.
   *
   * @return The legend items.
   */
  public LegendItemCollection getLegendItems() {
    LegendItemCollection result = this.fixedLegendItems;
    if (result == null) {
      result = new LegendItemCollection();
      // get the legend items for the datasets...
      final int count = this.datasets.size();
      for (int datasetIndex = 0; datasetIndex < count; datasetIndex++) {
        final CategoryDataset dataset = this.getDataset(datasetIndex);
        if (dataset != null) {
          final CategoryItemRenderer renderer = this
              .getRenderer(datasetIndex);
          if (renderer != null) {
            final int seriesCount = dataset.getRowCount();
            for (int i = 0; i < seriesCount; i++) {
              final LegendItem item = renderer.getLegendItem(
                  datasetIndex, i);
              if (item != null) {
                result.add(item);
              }
            }
          }
        }
      }
View Full Code Here

Examples of com.positive.charts.legend.LegendItemCollection

   *
   * @return The legend item collection (never <code>null</code>).
   */
  public LegendItemCollection getLegendItems() {
    if (this.plot == null) {
      return new LegendItemCollection();
    }
    final LegendItemCollection result = new LegendItemCollection();
    final int index = this.plot.getIndexOf(this);
    final CategoryDataset dataset = this.plot.getDataset(index);
    if (dataset != null) {
      final int seriesCount = dataset.getRowCount();
      for (int i = 0; i < seriesCount; i++) {
        if (this.isSeriesVisibleInLegend(i)) {
          final LegendItem item = this.getLegendItem(index, i);
          if (item != null) {
            result.add(item);
          }
        }
      }

    }
View Full Code Here

Examples of com.positive.charts.legend.LegendItemCollection

   *
   * @return The legend items (never <code>null</code>).
   */
  public LegendItemCollection getLegendItems() {

    final LegendItemCollection result = new LegendItemCollection();
    if (this.dataset == null) {
      return result;
    }
    final List keys = this.dataset.getKeys();
    int section = 0;
    this.getLegendItemShape();
    final Rectangle shape = new Rectangle(0, 0, 8, 8);
    final Iterator iterator = keys.iterator();
    while (iterator.hasNext()) {
      final Comparable key = (Comparable) iterator.next();
      final Number n = this.dataset.getValue(key);
      boolean include = true;
      if (n == null) {
        include = !this.ignoreNullValues;
      } else {
        final double v = n.doubleValue();
        if (v == 0.0) {
          include = !this.ignoreZeroValues;
        } else {
          include = v > 0.0;
        }
      }
      if (include) {
        final String label = this.legendLabelGenerator
            .generateSectionLabel(this.dataset, key);
        if (label != null) {
          final String description = label;
          String toolTipText = null;
          if (this.legendLabelToolTipGenerator != null) {
            toolTipText = this.legendLabelToolTipGenerator
                .generateSectionLabel(this.dataset, key);
          }
          String urlText = null;
          if (this.legendLabelURLGenerator != null) {
            urlText = this.legendLabelURLGenerator.generateURL(
                this.dataset, key, this.pieIndex);
          }
          final Color Color = this.lookupSectionPaint(key, true);
          final Color outlinePaint = this
              .lookupSectionOutlinePaint(key);
          final Stroke outlineStroke = this
              .lookupSectionOutlineStroke(key);
          final LegendItem item = new LegendItem(label, description,
              toolTipText, urlText, true, shape, true, Color,
              true, outlinePaint,
              outlineStroke,
              false, // line
              // not
              // visible
              new Rectangle(0, 0, 0, 0), new Stroke(1),
              StaticColorChecker.dublicateColor(SWT.COLOR_BLACK));
          // Display
          // .getDefault().getSystemColor(
          // SWT.COLOR_BLACK));
          item.setDataset(this.getDataset());
          result.add(item);
        }
        section++;
      } else {
        section++;
      }
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

     *
     * @return The legend items (never <code>null</code>).
     */
    public LegendItemCollection getLegendItems()
    {
      final LegendItemCollection result = new LegendItemCollection();
      if (getDataset() == null)
      {
        return result;
      }
      List keys = null;
      final CategoryDataset dataset = getDataset();
      final TableOrder dataExtractOrder = getDataExtractOrder();
      if (dataExtractOrder == TableOrder.BY_ROW)
      {
        keys = dataset.getRowKeys();
      }
      else if (dataExtractOrder == TableOrder.BY_COLUMN)
      {
        keys = dataset.getColumnKeys();
      }
      if (keys == null)
      {
        return result;
      }

      int series = 0;
      final Iterator iterator = keys.iterator();
      final Shape shape = getLegendItemShape();
      while (iterator.hasNext())
      {
        final Comparable key = (Comparable) iterator.next();
        if (key instanceof GridCategoryItem)
        {
          continue;
        }
        final String label = key.toString();
        final Paint paint = getSeriesPaint(series);
        final Paint outlinePaint = getSeriesOutlinePaint(series);
        final Stroke stroke = getSeriesOutlineStroke(series);
        final LegendItem item = new LegendItem(label, label,
            null, null, shape, paint, stroke, outlinePaint);
        item.setDataset(getDataset());
        item.setSeriesKey(key);
        item.setSeriesIndex(series);
        result.add(item);
        series++;
      }
      return result;
    }
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

        t.setMargin(4.0, 0.0, 2.0, 4.0);
        chart.addSubtitle(t);

        // get a reference to the plot for further customisation...
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
        LegendItemCollection items = new LegendItemCollection();
        items.add(new LegendItem("Against all torture", null, null, null,
                new Rectangle2D.Double(-6.0, -3.0, 12.0, 6.0), Color.green));
        items.add(new LegendItem("Some degree permissible", null, null, null,
                new Rectangle2D.Double(-6.0, -3.0, 12.0, 6.0), Color.red));
        plot.setFixedLegendItems(items);
        plot.setInsets(new RectangleInsets(5, 5, 5, 20));
        LegendTitle legend = new LegendTitle(plot);
        legend.setPosition(RectangleEdge.BOTTOM);
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

     *
     * @return The legend items (never <code>null</code>).
     */
    public LegendItemCollection getLegendItems()
    {
      final LegendItemCollection result = new LegendItemCollection();
      if (getDataset() == null)
      {
        return result;
      }
      List keys = null;
      final CategoryDataset dataset = getDataset();
      final TableOrder dataExtractOrder = getDataExtractOrder();
      if (dataExtractOrder == TableOrder.BY_ROW)
      {
        keys = dataset.getRowKeys();
      }
      else if (dataExtractOrder == TableOrder.BY_COLUMN)
      {
        keys = dataset.getColumnKeys();
      }
      if (keys == null)
      {
        return result;
      }

      int series = 0;
      final Iterator iterator = keys.iterator();
      final Shape shape = getLegendItemShape();
      while (iterator.hasNext())
      {
        final Comparable key = (Comparable) iterator.next();
        if (key instanceof GridCategoryItem)
        {
          continue;
        }
        final String label = key.toString();
        final Paint paint = getSeriesPaint(series);
        final Paint outlinePaint = getSeriesOutlinePaint(series);
        final Stroke stroke = getSeriesOutlineStroke(series);
        final LegendItem item = new LegendItem(label, label,
            null, null, shape, paint, stroke, outlinePaint);
        item.setDataset(getDataset());
        item.setSeriesKey(key);
        item.setSeriesIndex(series);
        result.add(item);
        series++;
      }
      return result;
    }
View Full Code Here

Examples of org.jfree.chart.LegendItemCollection

   }

   @Override
   public LegendItemCollection getLegendItems()
   {
      LegendItemCollection licUnsorted = super.getLegendItems();

      if (licUnsorted == null || licUnsorted.getItemCount() < 2)
         return licUnsorted;

      // ---

      LegendItem[] objs = new LegendItem[licUnsorted.getItemCount()];

      for (int i = 0; i < objs.length; i++)
         objs[i] = licUnsorted.get(i);

      Arrays.sort(objs, new MyComparator()); // ATTN possible memory leaks
      LegendItemCollection licSorted = new LegendItemCollection();

      for (int i = 0; i < objs.length; i++)
         licSorted.add(objs[i]);

      return licSorted;
   }
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.