Package com.positive.charts.util

Examples of com.positive.charts.util.Line


  protected void drawRangeLine(final GC gc, final Rectangle dataArea,
      final double value, final Stroke stroke, final Color paint) {

    final double java2D = this.getRangeAxis().valueToJava2D(value,
        dataArea, this.getRangeAxisEdge());
    Line line = null;
    if (this.orientation == PlotOrientation.HORIZONTAL) {
      line = Line.Double(java2D, RectangleUtil.getMinY(dataArea), java2D,
          RectangleUtil.getMaxY(dataArea));
    } else if (this.orientation == PlotOrientation.VERTICAL) {
      line = Line.Double(RectangleUtil.getMinX(dataArea), java2D,
View Full Code Here


   *            the Java2D value at which the grid line should be drawn.
   */
  public void drawDomainGridline(final GC gc, final CategoryPlot plot,
      final Rectangle dataArea, final double value) {

    Line line = null;
    final PlotOrientation orientation = plot.getOrientation();

    if (orientation == PlotOrientation.HORIZONTAL) {
      line = Line.Double(RectangleUtil.getMinX(dataArea), value,
          RectangleUtil.getMaxX(dataArea), value);
View Full Code Here

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

    }

    final PlotOrientation orientation = plot.getOrientation();
    final double v = axis.valueToJava2D(value, dataArea, plot
        .getRangeAxisEdge());
    Line line = null;
    if (orientation == PlotOrientation.HORIZONTAL) {

      line = Line.Double(v, RectangleUtil.getMinY(dataArea), v,
          RectangleUtil.getMaxY(dataArea));
    } else if (orientation == PlotOrientation.VERTICAL) {
View Full Code Here

      gc.setAlpha(marker.getAlpha());

      final PlotOrientation orientation = plot.getOrientation();
      final double v = axis.valueToJava2D(value, dataArea.getRectangle(),
          plot.getRangeAxisEdge());
      Line line = null;
      if (orientation == PlotOrientation.HORIZONTAL) {
        line = Line
            .Double(v, dataArea.getMinY(), v, dataArea.getMaxY());
      } else if (orientation == PlotOrientation.VERTICAL) {
        line = Line
            .Double(dataArea.getMinX(), v, dataArea.getMaxX(), v);
      }

      gc.setForeground(marker.getPaint());
      marker.getStroke().set(gc);
      GCUtilities.draw(gc, line);

      final String label = marker.getLabel();
      final RectangleAnchor anchor = marker.getLabelAnchor();
      if (label != null) {
        final Font labelFont = marker.getLabelFont();
        gc.setFont(labelFont);
        gc.setForeground(marker.getLabelPaint());
        final Point coordinates = this
            .calculateRangeMarkerTextAnchorPoint(gc, orientation,
                dataArea.getRectangle(), line.getBounds(),
                marker.getLabelOffset(),
                LengthAdjustmentType.EXPAND, anchor);
        TextUtilities.drawAlignedString(label, gc, coordinates.x,
            coordinates.y, marker.getLabelTextAnchor());
      }

      gc.setAlpha(oldAlpha);
    } else if (marker instanceof IntervalMarker) {

      final IntervalMarker im = (IntervalMarker) marker;
      final double start = im.getStartValue();
      final double end = im.getEndValue();
      final Range range = axis.getRange();
      if (!(range.intersects(start, end))) {
        return;
      }

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

      final double start2d = axis.valueToJava2D(start, dataArea
          .getRectangle(), plot.getRangeAxisEdge());
      final double end2d = axis.valueToJava2D(end, dataArea
          .getRectangle(), plot.getRangeAxisEdge());

      final PlotOrientation orientation = plot.getOrientation();
      Rectangle rect = null;
      if (orientation == PlotOrientation.HORIZONTAL) {
        rect = RectangleUtil.Double(Math.min(start2d, end2d), dataArea
            .getMinY(), Math.abs(end2d - start2d), dataArea
            .getHeight());
      } else if (orientation == PlotOrientation.VERTICAL) {
        rect = RectangleUtil.Double(dataArea.getMinX(), Math.min(
            start2d, end2d), dataArea.getWidth(), Math.abs(end2d
            - start2d));
      }
      final Color p = marker.getPaint();
      gc.setBackground(p);
      gc.fillRectangle(rect);

      // now draw the outlines, if visible...
      if ((im.getOutlinePaint() != null)
          && (im.getOutlineStroke() != null)) {
        final int x0 = RectangleUtil.getMinX(rect);
        final int x1 = RectangleUtil.getMaxX(rect);
        final int y0 = RectangleUtil.getMinY(rect);
        final int y1 = RectangleUtil.getMaxY(rect);
        if (orientation == PlotOrientation.VERTICAL) {
          final Line line = Line.Double(x0, y0, x1, y0);
          gc.setForeground(im.getOutlinePaint());
          im.getOutlineStroke().set(gc);
          GCUtilities.draw(gc, line);
          line.setLine(x0, y1, x1, y1);
          GCUtilities.draw(gc, line);
        } else { // PlotOrientation.HORIZONTAL
          final Line line = Line.Double(x0, y0, x0, y1);
          gc.setForeground(im.getOutlinePaint());
          im.getOutlineStroke().set(gc);
          GCUtilities.draw(gc, line);
          line.setLine(x1, y0, x1, y1);
          GCUtilities.draw(gc, line);
        }
      }

      final String label = marker.getLabel();
View Full Code Here

TOP

Related Classes of com.positive.charts.util.Line

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.