コード例 #1
0
  protected void setDialFrame(ChartDocument chartDocument, DialPlot dialPlot) {
    // ~ params begin
    Color frameForegroundPaint = Color.black;
    Color frameInnerForegroundPaint = Color.black;
    Color frameBackgroundPaint = Color.white;
    Stroke frameStroke = new BasicStroke(2.0f);
    // ~ params end

    final StrokeFactory strokeFacObj = StrokeFactory.getInstance();

    ChartElement plotElement = getUniqueElement(chartDocument, ChartElement.TAG_NAME_PLOT);

    final BasicStroke borderStyleStroke = strokeFacObj.getBorderStroke(plotElement);
    if (borderStyleStroke != null) {
      frameStroke = borderStyleStroke;
    }

    final Color outerBorderColor =
        ColorFactory.getInstance().getColor(plotElement, BorderStyleKeys.BORDER_TOP_COLOR);
    if (outerBorderColor != null) {
      frameForegroundPaint = outerBorderColor;
    }

    final Color innerBorderColorTmp =
        ColorFactory.getInstance().getColor(plotElement, BorderStyleKeys.BORDER_BOTTOM_COLOR);
    if (innerBorderColorTmp != null) {
      frameInnerForegroundPaint = innerBorderColorTmp;
    }

    final Color borderBackgroundColorTmp = ColorFactory.getInstance().getColor(plotElement);
    if (borderBackgroundColorTmp != null) {
      frameBackgroundPaint = borderBackgroundColorTmp;
    }

    final DoubleLineDialFrame dialFrame = new DoubleLineDialFrame();
    dialFrame.setForegroundPaint(frameForegroundPaint);
    dialFrame.setInnerForegroundPaint(frameInnerForegroundPaint);
    dialFrame.setStroke(frameStroke);
    dialFrame.setBackgroundPaint(frameBackgroundPaint);

    dialPlot.setDialFrame(dialFrame);
  }
コード例 #2
0
  protected void setDialCap(ChartDocument chartDocument, DialPlot dialPlot) {
    // ~ params begin
    double capRadius = 0.05; // expressed as percentage of dial's framing rectangle
    Color capFillPaint = Color.white;
    Color capOutlinePaint = Color.black;
    Stroke capOutlineStroke = new BasicStroke(2.0f);
    // ~ params end

    final StrokeFactory strokeFacObj = StrokeFactory.getInstance();

    ChartElement dialCapElement = getUniqueElement(chartDocument, DIALCAP);

    final BasicStroke borderStyleStroke = strokeFacObj.getBorderStroke(dialCapElement);
    if (borderStyleStroke != null) {
      capOutlineStroke = borderStyleStroke;
    }

    final Color borderColor =
        ColorFactory.getInstance().getColor(dialCapElement, BorderStyleKeys.BORDER_TOP_COLOR);
    if (borderColor != null) {
      capOutlinePaint = borderColor;
    }

    final Color capColor = ColorFactory.getInstance().getColor(dialCapElement);
    if (capColor != null) {
      capFillPaint = capColor;
    }

    capRadius = parseDouble(dialCapElement.getLayoutStyle().getValue(BoxStyleKeys.WIDTH)) / 100;

    DialCap dialCap = new DialCap();
    dialCap.setRadius(capRadius);
    dialCap.setFillPaint(capFillPaint);
    dialCap.setOutlinePaint(capOutlinePaint);
    dialCap.setOutlineStroke(capOutlineStroke);
    dialPlot.setCap(dialCap);
  }