Package com.positive.charts.data.category

Examples of com.positive.charts.data.category.CategoryDataset


   */
  public boolean render(final GC g2, final Rectangle dataArea,
      final int index, final PlotRenderingInfo info) {

    boolean foundData = false;
    final CategoryDataset currentDataset = this.getDataset(index);
    final CategoryItemRenderer renderer = this.getRenderer(index);
    final CategoryAxis domainAxis = this.getDomainAxisForDataset(index);
    final ValueAxis rangeAxis = this.getRangeAxisForDataset(index);
    final boolean hasData = !DatasetUtilities.isEmptyOrNull(currentDataset);
    if (hasData && (renderer != null)) {

      foundData = true;
      final CategoryItemRendererState state = renderer.initialise(g2,
          dataArea, this, index, info);
      final int columnCount = currentDataset.getColumnCount();
      final int rowCount = currentDataset.getRowCount();
      final int passCount = renderer.getPassCount();
      for (int pass = 0; pass < passCount; pass++) {
        if (this.columnRenderingOrder == SortOrder.ASCENDING) {
          for (int column = 0; column < columnCount; column++) {
            if (this.rowRenderingOrder == SortOrder.ASCENDING) {
View Full Code Here


   * @param dataset
   *            the dataset (<code>null</code> permitted).
   */
  public void setDataset(final int index, final CategoryDataset dataset) {

    final CategoryDataset existing = (CategoryDataset) this.datasets
        .get(index);
    if (existing != null) {
      existing.removeChangeListener(this);
    }
    this.datasets.set(index, dataset);
    if (dataset != null) {
      dataset.addChangeListener(this);
    }
View Full Code Here

  public void drawDomainMarker(final GC gc, final CategoryPlot plot,
      final CategoryAxis axis, final CategoryMarker marker,
      final Rectangle dataArea) {

    final Comparable category = marker.getKey();
    final CategoryDataset dataset = plot.getDataset(plot.getIndexOf(this));
    final int columnIndex = dataset.getColumnIndex(category);
    if (columnIndex < 0) {
      return;
    }

    final int oldAlpha = gc.getAlpha();
    // transparency
    gc.setAlpha(marker.getAlpha());

    final PlotOrientation orientation = plot.getOrientation();
    Rectangle bounds = null;
    if (marker.getDrawAsLine()) {
      final double v = axis.getCategoryMiddle(columnIndex, dataset
          .getColumnCount(), dataArea, plot.getDomainAxisEdge());
      Line line = null;
      if (orientation == PlotOrientation.HORIZONTAL) {

        line = Line.Double(RectangleUtil.getMinX(dataArea), v,
            RectangleUtil.getMaxX(dataArea), v);
      } else if (orientation == PlotOrientation.VERTICAL) {
        line = Line.Double(v, RectangleUtil.getMinY(dataArea), v,
            RectangleUtil.getMaxY(dataArea));
      }
      gc.setForeground(marker.getPaint());
      marker.getStroke().set(gc);
      GCUtilities.draw(gc, line);
      bounds = line.getBounds();
    } else {
      final double v0 = axis.getCategoryStart(columnIndex, dataset
          .getColumnCount(), dataArea, plot.getDomainAxisEdge());
      final double v1 = axis.getCategoryEnd(columnIndex, dataset
          .getColumnCount(), dataArea, plot.getDomainAxisEdge());
      Rectangle area = null;
      if (orientation == PlotOrientation.HORIZONTAL) {
        area = RectangleUtil.Double(RectangleUtil.getMinX(dataArea),
            v0, dataArea.width, (v1 - v0));
View Full Code Here

    final CategoryPlot p = this.getPlot();
    if (p == null) {
      return null;
    }

    CategoryDataset dataset;
    dataset = p.getDataset(datasetIndex);
    final String label = this.legendItemLabelGenerator.generateLabel(
        dataset, series);
    final String description = label;
    String toolTipText = null;
View Full Code Here

    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

  public CategoryItemRendererState initialise(final GC g2,
      final Rectangle dataArea, final CategoryPlot plot,
      final int rendererIndex, final PlotRenderingInfo info) {

    this.setPlot(plot);
    final CategoryDataset data = plot.getDataset(rendererIndex);
    if (data != null) {
      this.rowCount = data.getRowCount();
      this.columnCount = data.getColumnCount();
    } else {
      this.rowCount = 0;
      this.columnCount = 0;
    }
    return new CategoryItemRendererState(info);
View Full Code Here

  protected void calculateBarWidth(final CategoryPlot plot,
      final Rectangle dataArea, final int rendererIndex,
      final CategoryItemRendererState state) {

    final CategoryAxis domainAxis = this.getDomainAxis(plot, rendererIndex);
    final CategoryDataset dataset = plot.getDataset(rendererIndex);
    if (dataset != null) {
      final int columns = dataset.getColumnCount();
      final int rows = dataset.getRowCount();
      double space = 0.0;
      final PlotOrientation orientation = plot.getOrientation();
      if (orientation == PlotOrientation.HORIZONTAL) {
        space = dataArea.height;
      } else if (orientation == PlotOrientation.VERTICAL) {
View Full Code Here

    final CategoryPlot cp = this.getPlot();
    if (cp == null) {
      return null;
    }

    CategoryDataset dataset;
    dataset = cp.getDataset(datasetIndex);
    final String label = this.getLegendItemLabelGenerator().generateLabel(
        dataset, series);
    final String description = label;
    String toolTipText = null;
View Full Code Here

    }

    g2.setFont(this.subLabelFont);
    g2.setForeground(this.getSubLabelPaint());
    final CategoryPlot plot = (CategoryPlot) this.getPlot();
    final CategoryDataset dataset = plot.getDataset();
    final int categoryCount = dataset.getColumnCount();

    final double maxdim = this.getMaxDim(g2, edge);
    for (int categoryIndex = 0; categoryIndex < categoryCount; categoryIndex++) {

      double x0 = 0.0;
View Full Code Here

TOP

Related Classes of com.positive.charts.data.category.CategoryDataset

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.