Package com.positive.charts.axis

Examples of com.positive.charts.axis.CategoryAxis


      final boolean legend, final boolean tooltips) {

    if (orientation == null) {
      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    final CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    final ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    final BarRenderer renderer = new BarRenderer();
    if (orientation == PlotOrientation.HORIZONTAL) {
      final ItemLabelPosition position1 = new ItemLabelPosition(
View Full Code Here


  }

  public double calculateBarWidth(final CategoryPlot plot,
      final Rectangle dataArea, final int rendererIndex) {
    // calculate the bar width
    final CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex);
    final CategoryDataset data = plot.getDataset(rendererIndex);
    if (data != null) {
      final PlotOrientation orientation = plot.getOrientation();
      double space = 0.0;
      if (orientation == PlotOrientation.HORIZONTAL) {
        space = dataArea.height;
      } else if (orientation == PlotOrientation.VERTICAL) {
        space = dataArea.width;
      }
      final double maxWidth = this.calculateMaxBarWidth(plot, dataArea,
          rendererIndex);
      final int groups = this.seriesToGroupMap.getGroupCount();
      final int categories = data.getColumnCount();
      final int columns = groups * categories;
      double categoryMargin = 0.0;
      double itemMargin = 0.0;
      if (categories > 1) {
        categoryMargin = xAxis.getCategoryMargin();
      }
      if (groups > 1) {
        itemMargin = this.getItemMargin();
      }

      final double used = space
          * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin()
              - categoryMargin - itemMargin);

      double barWidth = 0.0;

      if (columns > 0) {
View Full Code Here

  }

  public double calculateMinSpaceForBarWidth(final CategoryPlot plot,
      final int rendererIndex, final double givenBarWidth) {
    double space = 0.0;
    final CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex);
    final CategoryDataset data = plot.getDataset(rendererIndex);
    if (data != null) {
      final int groups = this.seriesToGroupMap.getGroupCount();
      final int categories = data.getColumnCount();
      final int columns = groups * categories;
      double categoryMargin = 0.0;
      double itemMargin = 0.0;
      if (categories > 1) {
        categoryMargin = xAxis.getCategoryMargin();
      }
      if (groups > 1) {
        itemMargin = this.getItemMargin();
      }

      final double denom = 1 - xAxis.getLowerMargin()
          - xAxis.getUpperMargin() - categoryMargin - itemMargin;

      if (denom == 0) {
        return 0;
      }

View Full Code Here

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

    // calculate the bar width
    final CategoryAxis xAxis = plot.getDomainAxisForDataset(rendererIndex);
    final CategoryDataset data = plot.getDataset(rendererIndex);
    if (data != null) {
      final PlotOrientation orientation = plot.getOrientation();
      double space = 0.0;
      if (orientation == PlotOrientation.HORIZONTAL) {
        space = dataArea.height;
      } else if (orientation == PlotOrientation.VERTICAL) {
        space = dataArea.width;
      }
      final double maxWidth = space * this.getMaximumBarWidth();
      final int columns = data.getColumnCount();
      double categoryMargin = 0.0;
      if (columns > 1) {
        categoryMargin = xAxis.getCategoryMargin();
      }

      final double used = space
          * (1 - xAxis.getLowerMargin() - xAxis.getUpperMargin() - categoryMargin);
      if (columns > 0) {
        state.setBarWidth(Math.min(used / columns, maxWidth));
      } else {
        state.setBarWidth(Math.min(used, maxWidth));
      }
View Full Code Here

   * Clears the domain axes from the plot and sends a {@link PlotChangeEvent}
   * to all registered listeners.
   */
  public void clearDomainAxes() {
    for (int i = 0; i < this.domainAxes.size(); i++) {
      final CategoryAxis axis = (CategoryAxis) this.domainAxes.get(i);
      if (axis != null) {
        axis.removeChangeListener(this);
      }
    }
    this.domainAxes.clear();
    this.notifyListeners(new PlotChangeEvent(this));
  }
View Full Code Here

  /**
   * Configures the domain axes.
   */
  public void configureDomainAxes() {
    for (int i = 0; i < this.domainAxes.size(); i++) {
      final CategoryAxis axis = (CategoryAxis) this.domainAxes.get(i);
      if (axis != null) {
        axis.configure();
      }
    }
  }
View Full Code Here

    final AxisCollection axisCollection = new AxisCollection();

    // add domain axes to lists...
    for (int index = 0; index < this.domainAxes.size(); index++) {
      final CategoryAxis xAxis = (CategoryAxis) this.domainAxes
          .get(index);
      if (xAxis != null) {
        axisCollection.add(xAxis, this.getDomainAxisEdge(index));
      }
    }
View Full Code Here

      final Color gridPaint = this.getDomainGridlinePaint();
      if ((gridStroke != null) && (gridPaint != null)) {
        // iterate over the categories
        final CategoryDataset data = this.getDataset();
        if (data != null) {
          final CategoryAxis axis = this.getDomainAxis();
          if (axis != null) {
            final int columnCount = data.getColumnCount();
            for (int c = 0; c < columnCount; c++) {
              final double xx = axis.getCategoryJava2DCoordinate(
                  anchor, c, columnCount, dataArea,
                  domainAxisEdge);
              final CategoryItemRenderer renderer1 = this
                  .getRenderer();
              if (renderer1 != null) {
View Full Code Here

    if (r == null) {
      return;
    }

    final Collection markers = this.getDomainMarkers(index, layer);
    final CategoryAxis axis = this.getDomainAxisForDataset(index);
    if ((markers != null) && (axis != null)) {
      final Iterator iterator = markers.iterator();
      while (iterator.hasNext()) {
        final CategoryMarker marker = (CategoryMarker) iterator.next();
        r.drawDomainMarker(g2, this, axis, marker, dataArea);
View Full Code Here

   *            the axis index.
   *
   * @return The axis (<code>null</code> possible).
   */
  public CategoryAxis getDomainAxis(final int index) {
    CategoryAxis result = null;
    if (index < this.domainAxes.size()) {
      result = (CategoryAxis) this.domainAxes.get(index);
    }
    if (result == null) {
      final Plot parent = this.getParent();
View Full Code Here

TOP

Related Classes of com.positive.charts.axis.CategoryAxis

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.