Package com.positive.charts.renderer.xy

Examples of com.positive.charts.renderer.xy.XYItemRenderer


    // of the ranges.
    final Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
      final XYDataset d = (XYDataset) iterator.next();
      if (d != null) {
        final XYItemRenderer r = this.getRendererForDataset(d);
        if (isDomainAxis) {
          if (r != null) {
            result = Range.combine(result, r.findDomainBounds(d));
          } else {
            result = Range.combine(result, DatasetUtilities
                .findDomainBounds(d));
          }
        } else {
          if (r != null) {
            result = Range.combine(result, r.findRangeBounds(d));
          } else {
            result = Range.combine(result, DatasetUtilities
                .findRangeBounds(d));
          }
        }
View Full Code Here


    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

   *            the dataset (<code>null</code> permitted).
   *
   * @return The renderer (possibly <code>null</code>).
   */
  public XYItemRenderer getRendererForDataset(final XYDataset dataset) {
    XYItemRenderer result = null;
    for (int i = 0; i < this.datasets.size(); i++) {
      if (this.datasets.get(i) == dataset) {
        if (i < this.renderers.size()) {
          result = (XYItemRenderer) this.renderers.get(i);
        }
View Full Code Here

      return false;
    }

    final ValueAxis xAxis = this.getDomainAxisForDataset(index);
    final ValueAxis yAxis = this.getRangeAxisForDataset(index);
    XYItemRenderer renderer = this.getRenderer(index);
    if (renderer == null) {
      renderer = this.getRenderer();
    }

    // assert renderer != null : "Renderer is null";

    final XYItemRendererState state = renderer.initialise(gc, dataArea,
        this, dataset, info);
    final int passCount = renderer.getPassCount();

    final SeriesRenderingOrder seriesOrder = this.getSeriesRenderingOrder();
    if (seriesOrder == SeriesRenderingOrder.REVERSE) {
      // render series in reverse order
      for (int pass = 0; pass < passCount; pass++) {
        final int seriesCount = dataset.getSeriesCount();
        for (int series = seriesCount - 1; series >= 0; series--) {
          final int itemCount = dataset.getItemCount(series);
          for (int item = 0; item < itemCount; item++) {
            renderer.drawItem(gc, state, dataArea, info, this,
                xAxis, yAxis, dataset, series, item, cstate,
                pass);
          }
        }
      }
    } else {
      // render series in forward order
      for (int pass = 0; pass < passCount; pass++) {
        final int seriesCount = dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
          final int itemCount = dataset.getItemCount(series);
          for (int item = 0; item < itemCount; item++) {
            renderer.drawItem(gc, state, dataArea, info, this,
                xAxis, yAxis, dataset, series, item, cstate,
                pass);
          }
        }
      }
View Full Code Here

   * @param notify
   *            notify listeners?
   */
  public void setRenderer(final int index, final XYItemRenderer renderer,
      final boolean notify) {
    final XYItemRenderer existing = this.getRenderer(index);
    if (existing != null) {
      existing.removeChangeListener(this);
    }
    if (index < this.renderers.size()) {
      this.renderers.set(index, renderer);
    } else {
      this.renderers.add(index, renderer);
View Full Code Here

    final XYDataset dataset = this.getDataset(index);
    if (DatasetUtilities.isEmptyOrNull(dataset)) {
      return false;
    }

    XYItemRenderer renderer = this.getRenderer(index);
    if (renderer == null) {
      renderer = this.getRenderer();
    }

    final ValueAxis domainAxis = this.getDomainAxisForDataset(index);
    final ValueAxis rangeAxis = this.getRangeAxisForDataset(index);
    final double lowerBound = domainAxis.getLowerBound();
    final double upperBound = domainAxis.getUpperBound();

    List series;
    if (dataset instanceof TableXYDataset) {
      series = ((TableXYDataset) dataset).getSeries();
    } else if (dataset instanceof XYSeriesCollection) {
      series = ((XYSeriesCollection) dataset).getSeries();
    } else {
      return false;
    }

    for (final Iterator iter = series.iterator(); iter.hasNext();) {
      final XYSeries s = (XYSeries) iter.next();
      final List items = s.getItems();
      if (items.size() == 0) {
        continue;
      }

      int fromIndex = Collections.binarySearch(items, new XYDataItem(
          lowerBound, 0));
      if (fromIndex < 0) {
        fromIndex = -fromIndex - 2;
      }
      if (fromIndex < 0) {
        fromIndex = 0;
      }
      int toIndex = Collections.binarySearch(items, new XYDataItem(
          upperBound, 0));
      if (toIndex < 0) {
        toIndex = -toIndex;
      }
      if (toIndex >= items.size()) {
        toIndex = items.size() - 1;
      }
      final List subSeries = items.subList(fromIndex, toIndex);

      renderer.drawSeriesItems(gc, dataArea, info, this, domainAxis,
          rangeAxis, dataset, dataset.indexOf(s.getKey()), subSeries);
    }

    return true;
  }
View Full Code Here

TOP

Related Classes of com.positive.charts.renderer.xy.XYItemRenderer

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.