Examples of ItemLabelPosition


Examples of com.positive.charts.labels.ItemLabelPosition

    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(
          ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT);
      renderer.setBasePositiveItemLabelPosition(position1);
      final ItemLabelPosition position2 = new ItemLabelPosition(
          ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT);
      renderer.setBaseNegativeItemLabelPosition(position2);
    } else if (orientation == PlotOrientation.VERTICAL) {
      final ItemLabelPosition position1 = new ItemLabelPosition(
          ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
      renderer.setBasePositiveItemLabelPosition(position1);
      final ItemLabelPosition position2 = new ItemLabelPosition(
          ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
      renderer.setBaseNegativeItemLabelPosition(position2);
    }
    if (tooltips) {
      renderer
View Full Code Here

Examples of com.positive.charts.labels.ItemLabelPosition

    super();
    this.renderAsPercentages = renderAsPercentages;

    // set the default item label positions, which will only be used if
    // the user requests visible item labels...
    final ItemLabelPosition p = new ItemLabelPosition(
        ItemLabelAnchor.CENTER, TextAnchor.CENTER);
    this.setBasePositiveItemLabelPosition(p);
    this.setBaseNegativeItemLabelPosition(p);
    this.setPositiveItemLabelPositionFallback(null);
    this.setNegativeItemLabelPositionFallback(null);
View Full Code Here

Examples of com.positive.charts.labels.ItemLabelPosition

    g2.setFont(labelFont);
    // Color paint = getItemLabelColor(series, item);
    // g2.setPaint(paint);

    // find out where to place the label...
    ItemLabelPosition position = null;
    if (!negative) {
      position = this.getPositiveItemLabelPosition(series, item);
    } else {
      position = this.getNegativeItemLabelPosition(series, item);
    }

    // work out the label anchor point...
    final Point anchorPoint = this.calculateLabelAnchorPoint(position
        .getItemLabelAnchor(), bar, plot.getOrientation());

    // if (isInternalAnchor(position.getItemLabelAnchor())) {
    // Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2,
    // (float) anchorPoint.getX(), (float) anchorPoint.getY(), position
    // .getTextAnchor(), position.getAngle(), position.getRotationAnchor());
    //
    // if (bounds != null) {
    // if (!bar.contains(bounds.getBounds2D())) {
    // if (!negative) {
    // position = getPositiveItemLabelPositionFallback();
    // } else {
    // position = getNegativeItemLabelPositionFallback();
    // }
    // if (position != null) {
    // anchorPoint =
    // calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar,
    // plot.getOrientation());
    // }
    // }
    // }
    // }

    if (position != null) {
      TextUtilities.drawRotatedString(label, g2, anchorPoint.x,
          anchorPoint.y, position.getTextAnchor(), position
              .getAngle(), position.getRotationAnchor());
    }
  }
View Full Code Here

Examples of com.positive.charts.labels.ItemLabelPosition

    this.seriesVisibleInLegendList = new ArrayList();
    this.itemLabelsVisibleList = new ArrayList();
    this.itemLabelFontList = new ArrayList();

    this.positiveItemLabelPositionList = new ArrayList();
    this.basePositiveItemLabelPosition = new ItemLabelPosition(
        ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);

    this.negativeItemLabelPositionList = new ArrayList();
    this.baseNegativeItemLabelPosition = new ItemLabelPosition(
        ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);

    this.createEntitiesList = new ArrayList();

    this.paintMap = new TreeMap();
View Full Code Here

Examples of com.positive.charts.labels.ItemLabelPosition

    if (this.negativeItemLabelPosition != null) {
      return this.negativeItemLabelPosition;
    }

    // otherwise look up the position list
    ItemLabelPosition position = (ItemLabelPosition) this.negativeItemLabelPositionList
        .get(series);
    if (position == null) {
      position = this.baseNegativeItemLabelPosition;
    }
    return position;
View Full Code Here

Examples of com.positive.charts.labels.ItemLabelPosition

    if (this.positiveItemLabelPosition != null) {
      return this.positiveItemLabelPosition;
    }

    // otherwise look up the position table
    ItemLabelPosition position = (ItemLabelPosition) this.positiveItemLabelPositionList
        .get(series);
    if (position == null) {
      position = this.basePositiveItemLabelPosition;
    }
    return position;
View Full Code Here

Examples of com.positive.charts.labels.ItemLabelPosition

      // g2.setForeground(color);
      g2.setFont(labelFont);
      final String label = generator.generateLabel(dataset, series, item);

      // get the label position..
      ItemLabelPosition position = null;
      if (!negative) {
        position = this.getPositiveItemLabelPosition(series, item);
      } else {
        position = this.getNegativeItemLabelPosition(series, item);
      }

      // work out the label anchor point...
      final Point anchorPoint = this.calculateLabelAnchorPoint(position
          .getItemLabelAnchor(), (int) x, (int) y, orientation);
      TextUtilities.drawRotatedString(label, g2, anchorPoint.x,
          anchorPoint.y, position.getTextAnchor(), position
              .getAngle(), position.getRotationAnchor());
    }

  }
View Full Code Here

Examples of com.positive.charts.labels.ItemLabelPosition

      final Font labelFont = this.getItemLabelFont(row, column);
      final Color paint = this.getItemLabelPaint(row, column);
      g2.setFont(labelFont);
      g2.setForeground(paint);
      final String label = generator.generateLabel(dataset, row, column);
      ItemLabelPosition position = null;
      if (!negative) {
        position = this.getPositiveItemLabelPosition(row, column);
      } else {
        position = this.getNegativeItemLabelPosition(row, column);
      }
      final Point anchorPoint = this.calculateLabelAnchorPoint(position
          .getItemLabelAnchor(), (int) (x + 0.5), (int) (y + 0.5),
          orientation);
      TextUtilities.drawRotatedString(label, g2, anchorPoint.x,
          anchorPoint.y, position.getTextAnchor(), position
              .getAngle(), position.getRotationAnchor());
    }

  }
View Full Code Here

Examples of com.positive.charts.labels.ItemLabelPosition

    gc.setFont(labelFont);
    final Color paint = this.getItemLabelPaint(row, column);
    gc.setForeground(paint);

    // find out where to place the label...
    ItemLabelPosition position = null;
    if (!negative) {
      position = this.getPositiveItemLabelPosition(row, column);
    } else {
      position = this.getNegativeItemLabelPosition(row, column);
    }

    // work out the label anchor point...
    Point anchorPoint = this.calculateLabelAnchorPoint(position
        .getItemLabelAnchor(), bar, plot.getOrientation());

    if (this.isInternalAnchor(position.getItemLabelAnchor())) {
      // TODO : correct rotation code
      // Rectangle bounds =
      // TextUtilities.calculateRotatedStringBounds(label,
      // gc, (float) anchorPoint.x, (float) anchorPoint.y,
      // position.getTextAnchor(), position.getAngle(),
      // position.getRotationAnchor());

      final RectangleAdapter bounds = new RectangleAdapter(TextUtilities
          .getTextBounds(label, gc));

      if (bounds != null) {
        if (!RectangleUtil.contains(bar, bounds.getBounds())) {
          if (!negative) {
            position = this.getPositiveItemLabelPositionFallback();
          } else {
            position = this.getNegativeItemLabelPositionFallback();
          }
          if (position != null) {
            anchorPoint = this.calculateLabelAnchorPoint(position
                .getItemLabelAnchor(), bar, plot
                .getOrientation());
          }
        }
      }

    }

    if (position != null) {
      TextUtilities.drawRotatedString(label, gc, anchorPoint.x,
          anchorPoint.y, position.getTextAnchor(), position
              .getAngle(), position.getRotationAnchor());
    }
  }
View Full Code Here

Examples of org.jfree.chart.labels.ItemLabelPosition

      renderer.setBaseItemLabelFont(getItemLabelFont());
    }

    if (categoricalItemLabelRotation != null)
    {
      final ItemLabelPosition orgPosItemLabelPos = renderer.getBasePositiveItemLabelPosition();
      if (orgPosItemLabelPos == null)
      {
        final ItemLabelPosition pos2 = new ItemLabelPosition
            (ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER,
                TextAnchor.CENTER, categoricalItemLabelRotation.doubleValue());
        renderer.setBasePositiveItemLabelPosition(pos2);
      }
      else
      {
        final ItemLabelPosition pos2 = new ItemLabelPosition
            (orgPosItemLabelPos.getItemLabelAnchor(), orgPosItemLabelPos.getTextAnchor(),
                orgPosItemLabelPos.getRotationAnchor(), categoricalItemLabelRotation.doubleValue());
        renderer.setBasePositiveItemLabelPosition(pos2);
      }

      final ItemLabelPosition orgNegItemLabelPos = renderer.getBaseNegativeItemLabelPosition();
      if (orgNegItemLabelPos == null)
      {
        final ItemLabelPosition pos2 = new ItemLabelPosition
            (ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER,
                TextAnchor.CENTER, categoricalItemLabelRotation.doubleValue());
        renderer.setBaseNegativeItemLabelPosition(pos2);
      }
      else
      {
        final ItemLabelPosition neg2 = new ItemLabelPosition
            (orgNegItemLabelPos.getItemLabelAnchor(), orgNegItemLabelPos.getTextAnchor(),
                orgNegItemLabelPos.getRotationAnchor(), categoricalItemLabelRotation.doubleValue());
        renderer.setBaseNegativeItemLabelPosition(neg2);
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.