当前位置: 首页>>代码示例>>Java>>正文


Java DefaultRenderer.isShowLabels方法代码示例

本文整理汇总了Java中org.achartengine.renderer.DefaultRenderer.isShowLabels方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultRenderer.isShowLabels方法的具体用法?Java DefaultRenderer.isShowLabels怎么用?Java DefaultRenderer.isShowLabels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.achartengine.renderer.DefaultRenderer的用法示例。


在下文中一共展示了DefaultRenderer.isShowLabels方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLegendSize

import org.achartengine.renderer.DefaultRenderer; //导入方法依赖的package包/类
/**
 * Calculates the current legend size.
 * 
 * @param renderer the renderer
 * @param defaultHeight the default height
 * @param extraHeight the added extra height
 * @return the legend size
 */
protected int getLegendSize(DefaultRenderer renderer, int defaultHeight, float extraHeight) {
  int legendSize = renderer.getLegendHeight();
  if (renderer.isShowLegend() && legendSize == 0) {
    legendSize = defaultHeight;
  }
  if (!renderer.isShowLegend() && renderer.isShowLabels()) {
    legendSize = (int) (renderer.getLabelsTextSize() * 4 / 3 + extraHeight);
  }
  return legendSize;
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:19,代码来源:AbstractChart.java

示例2: getLegendSize

import org.achartengine.renderer.DefaultRenderer; //导入方法依赖的package包/类
protected int getLegendSize(DefaultRenderer defaultrenderer, int i, float f)
{
    int j = defaultrenderer.getLegendHeight();
    if (!defaultrenderer.isShowLegend() || j != 0)
    {
        i = j;
    }
    if (!defaultrenderer.isShowLegend() && defaultrenderer.isShowLabels())
    {
        i = (int)(f + (4F * defaultrenderer.getLabelsTextSize()) / 3F);
    }
    return i;
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:14,代码来源:AbstractChart.java

示例3: drawLabel

import org.achartengine.renderer.DefaultRenderer; //导入方法依赖的package包/类
/**
 * Draws a text label.
 * 
 * @param canvas the canvas
 * @param labelText the label text
 * @param renderer the renderer
 * @param prevLabelsBounds the previous rendered label bounds
 * @param centerX the round chart center on X axis
 * @param centerY the round chart center on Y axis
 * @param shortRadius the short radius for the round chart
 * @param longRadius the long radius for the round chart
 * @param currentAngle the current angle
 * @param angle the label extra angle
 * @param left the left side
 * @param right the right side
 * @param color the label color
 * @param paint the paint
 * @param line if a line to the label should be drawn
 * @param display display the label anyway
 */
protected void drawLabel(Canvas canvas, String labelText, DefaultRenderer renderer,
    List<RectF> prevLabelsBounds, int centerX, int centerY, float shortRadius, float longRadius,
    float currentAngle, float angle, int left, int right, int color, Paint paint, boolean line,
    boolean display) {
  if (renderer.isShowLabels() || display) {
    paint.setColor(color);
    double rAngle = Math.toRadians(90 - (currentAngle + angle / 2));
    double sinValue = Math.sin(rAngle);
    double cosValue = Math.cos(rAngle);
    int x1 = Math.round(centerX + (float) (shortRadius * sinValue));
    int y1 = Math.round(centerY + (float) (shortRadius * cosValue));
    int x2 = Math.round(centerX + (float) (longRadius * sinValue));
    int y2 = Math.round(centerY + (float) (longRadius * cosValue));

    float size = renderer.getLabelsTextSize();
    float extra = Math.max(size / 2, 10);
    paint.setTextAlign(Align.LEFT);
    if (x1 > x2) {
      extra = -extra;
      paint.setTextAlign(Align.RIGHT);
    }
    float xLabel = x2 + extra;
    float yLabel = y2;
    float width = right - xLabel;
    if (x1 > x2) {
      width = xLabel - left;
    }
    labelText = getFitText(labelText, width, paint);
    float widthLabel = paint.measureText(labelText);
    boolean okBounds = false;
    while (!okBounds && line) {
      boolean intersects = false;
      int length = prevLabelsBounds.size();
      for (int j = 0; j < length && !intersects; j++) {
        RectF prevLabelBounds = prevLabelsBounds.get(j);
        if (prevLabelBounds.intersects(xLabel, yLabel, xLabel + widthLabel, yLabel + size)) {
          intersects = true;
          yLabel = Math.max(yLabel, prevLabelBounds.bottom);
        }
      }
      okBounds = !intersects;
    }

    if (line) {
      y2 = (int) (yLabel - size / 2);
      canvas.drawLine(x1, y1, x2, y2, paint);
      canvas.drawLine(x2, y2, x2 + extra, y2, paint);
    } else {
      paint.setTextAlign(Align.CENTER);
    }
    canvas.drawText(labelText, xLabel, yLabel, paint);
    if (line) {
      prevLabelsBounds.add(new RectF(xLabel, yLabel, xLabel + widthLabel, yLabel + size));
    }
  }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:77,代码来源:AbstractChart.java


注:本文中的org.achartengine.renderer.DefaultRenderer.isShowLabels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。