Package com.positive.charts.data.category

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


  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();
View Full Code Here


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

    // calculate the bar width
    final CategoryDataset data = plot.getDataset(rendererIndex);
    if (data != null) {
      final double barWidth = this.calculateBarWidth(plot, dataArea,
          rendererIndex);
      state.setBarWidth(barWidth);
    }
View Full Code Here

    }
  }

  public double calculateMaxBarWidth(final CategoryPlot plot,
      final Rectangle dataArea, final int 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;
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();
View Full Code Here

      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();
      }

View Full Code Here

      final RectangleEdge domainAxisEdge = this.getDomainAxisEdge();
      final Stroke gridStroke = this.getDomainGridlineStroke();
      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
View Full Code Here

    final List result = new ArrayList();
    final int axisIndex = this.domainAxes.indexOf(axis);
    final List datasets = this.datasetsMappedToDomainAxis(axisIndex);
    final Iterator iterator = datasets.iterator();
    while (iterator.hasNext()) {
      final CategoryDataset dataset = (CategoryDataset) iterator.next();
      // add the unique categories from this dataset
      for (int i = 0; i < dataset.getColumnCount(); i++) {
        final Comparable category = dataset.getColumnKey(i);
        if (!result.contains(category)) {
          result.add(category);
        }
      }
    }
View Full Code Here

    // iterate through the datasets that map to the axis and get the union
    // of the ranges.
    final Iterator iterator = mappedDatasets.iterator();
    while (iterator.hasNext()) {
      final CategoryDataset d = (CategoryDataset) iterator.next();
      final CategoryItemRenderer r = this.getRendererForDataset(d);
      if (r != null) {
        result = Range.combine(result, r.findRangeBounds(d));
      }
    }
View Full Code Here

   *            the dataset index.
   *
   * @return The dataset (possibly <code>null</code>).
   */
  public CategoryDataset getDataset(final int index) {
    CategoryDataset result = null;
    if (this.datasets.size() > index) {
      result = (CategoryDataset) this.datasets.get(index);
    }
    return result;
  }
View Full Code Here

    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

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.