Package com.positive.charts.plot

Examples of com.positive.charts.plot.IntervalMarker


      }

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

TOP

Related Classes of com.positive.charts.plot.IntervalMarker

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.