Package com.positive.charts.legend

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


   */
  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

   *
   * @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

   * 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

   *
   * @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

   *
   * @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

TOP

Related Classes of com.positive.charts.legend.LegendItemCollection

Copyright © 2018 www.massapicom. 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.