Ejemplo n.º 1
0
  @Override
  public void calculateOffsets() {
    super.calculateOffsets();

    // prevent nullpointer when no data set
    if (mDataNotSet) return;

    float diameter = getDiameter();
    float radius = diameter / 2f;

    PointF c = getCenterOffsets();

    final List<PieDataSet> dataSets = mData.getDataSets();

    float maxShift = 0.f;
    for (int i = 0; i < dataSets.size(); i++) {
      final float shift = dataSets.get(i).getSelectionShift();
      if (shift > maxShift) maxShift = shift;
    }

    final float halfMaxShift = maxShift / 2.f;

    // create the circle box that will contain the pie-chart (the bounds of
    // the pie-chart)
    mCircleBox.set(
        c.x - radius + halfMaxShift,
        c.y - radius + halfMaxShift,
        c.x + radius - halfMaxShift,
        c.y + radius - halfMaxShift);
  }
Ejemplo n.º 2
0
  public void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (mDataNotSet) return;

    long starttime = System.currentTimeMillis();

    drawXLabels();

    drawWeb();

    drawLimitLines();

    drawData();

    drawAdditional();

    drawHighlights();

    drawYLabels();

    drawValues();

    drawLegend();

    drawDescription();

    drawMarkers();

    canvas.drawBitmap(mDrawBitmap, 0, 0, mDrawPaint);

    Log.i(LOG_TAG, "RadarChart DrawTime: " + (System.currentTimeMillis() - starttime) + " ms");
  }
Ejemplo n.º 3
0
  @Override
  public void prepare() {
    super.prepare();

    prepareYLabels();
    prepareXLabels();
  }
Ejemplo n.º 4
0
  @Override
  public void setPaint(Paint p, int which) {
    super.setPaint(p, which);

    switch (which) {
      case PAINT_RADAR_WEB:
        mWebPaint = p;
        break;
    }
  }
Ejemplo n.º 5
0
  @Override
  protected void init() {
    super.init();

    mWebLineWidth = Utils.convertDpToPixel(1.5f);
    mInnerWebLineWidth = Utils.convertDpToPixel(0.75f);

    mWebPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mWebPaint.setStyle(Paint.Style.STROKE);

    mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mHighlightPaint.setStyle(Paint.Style.STROKE);
    mHighlightPaint.setStrokeWidth(2f);
    mHighlightPaint.setColor(Color.rgb(255, 187, 115));
  }
Ejemplo n.º 6
0
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (mDataNotSet) return;

    mRenderer.drawData(canvas);

    if (valuesToHighlight()) mRenderer.drawHighlighted(canvas, mIndicesToHighlight);

    mRenderer.drawExtras(canvas);

    mRenderer.drawValues(canvas);

    mLegendRenderer.renderLegend(canvas);

    drawDescription(canvas);

    drawMarkers(canvas);
  }
Ejemplo n.º 7
0
  @Override
  protected void init() {
    super.init();

    mRenderer = new PieChartRenderer(this, mAnimator, mViewPortHandler);
  }
Ejemplo n.º 8
0
  @Override
  protected void calcMinMax() {
    super.calcMinMax();

    calcAngles();
  }
Ejemplo n.º 9
0
  @Override
  protected void calcMinMax(boolean fixedValues) {
    super.calcMinMax(fixedValues);

    mYChartMin = 0;
  }