Beispiel #1
0
 /**
  * Animates the drawing / rendering of the chart on both x- and y-axis with the specified
  * animation time. If animate(...) is called, no further calling of invalidate() is necessary to
  * refresh the chart. ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
  *
  * @param durationMillisX
  * @param durationMillisY
  * @param easingX a predefined easing option
  * @param easingY a predefined easing option
  */
 public void animateXY(
     int durationMillisX,
     int durationMillisY,
     Easing.EasingOption easingX,
     Easing.EasingOption easingY) {
   mAnimator.animateXY(durationMillisX, durationMillisY, easingX, easingY);
 }
Beispiel #2
0
  /** draws all MarkerViews on the highlighted positions */
  protected void drawMarkers(Canvas canvas) {

    // if there is no marker view or drawing marker is disabled
    if (mMarkerView == null || !mDrawMarkerViews || !valuesToHighlight()) return;

    for (int i = 0; i < mIndicesToHighlight.length; i++) {

      Highlight highlight = mIndicesToHighlight[i];
      int xIndex = highlight.getXIndex();
      int dataSetIndex = highlight.getDataSetIndex();

      float deltaX = mXAxis.mAxisRange;

      if (xIndex <= deltaX && xIndex <= deltaX * mAnimator.getPhaseX()) {

        Entry e = mData.getEntryForHighlight(mIndicesToHighlight[i]);

        // make sure entry not null
        if (e == null || e.getXIndex() != mIndicesToHighlight[i].getXIndex()) continue;

        float[] pos = getMarkerPosition(e, highlight);

        // check bounds
        if (!mViewPortHandler.isInBounds(pos[0], pos[1])) continue;

        // callbacks to update the content
        mMarkerView.refreshContent(e, highlight);

        // mMarkerView.measure(MeasureSpec.makeMeasureSpec(0,
        // MeasureSpec.UNSPECIFIED),
        // MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
        // mMarkerView.layout(0, 0, mMarkerView.getMeasuredWidth(),
        // mMarkerView.getMeasuredHeight());
        // mMarkerView.draw(mDrawCanvas, pos[0], pos[1]);

        mMarkerView.measure(
            MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
            MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
        mMarkerView.layout(0, 0, mMarkerView.getMeasuredWidth(), mMarkerView.getMeasuredHeight());

        if (pos[1] - mMarkerView.getHeight() <= 0) {
          float y = mMarkerView.getHeight() - pos[1];
          mMarkerView.draw(canvas, pos[0], pos[1] + y);
        } else {
          mMarkerView.draw(canvas, pos[0], pos[1]);
        }
      }
    }
  }
Beispiel #3
0
 /**
  * Animates the drawing / rendering of the chart on both x- and y-axis with the specified
  * animation time. If animate(...) is called, no further calling of invalidate() is necessary to
  * refresh the chart. ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
  *
  * @param durationMillisX
  * @param durationMillisY
  */
 public void animateXY(int durationMillisX, int durationMillisY) {
   mAnimator.animateXY(durationMillisX, durationMillisY);
 }
Beispiel #4
0
 /**
  * Animates the rendering of the chart on the y-axis with the specified animation time. If
  * animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
  * ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
  *
  * @param durationMillis
  */
 public void animateY(int durationMillis) {
   mAnimator.animateY(durationMillis);
 }
Beispiel #5
0
 /**
  * Animates the rendering of the chart on the y-axis with the specified animation time. If
  * animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
  * ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
  *
  * @param durationMillis
  * @param easing a predefined easing option
  */
 public void animateY(int durationMillis, Easing.EasingOption easing) {
   mAnimator.animateY(durationMillis, easing);
 }
Beispiel #6
0
 /**
  * Animates the rendering of the chart on the x-axis with the specified animation time. If
  * animate(...) is called, no further calling of invalidate() is necessary to refresh the chart.
  * ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
  *
  * @param durationMillis
  * @param easing a custom easing function to be used on the animation phase
  */
 public void animateX(int durationMillis, EasingFunction easing) {
   mAnimator.animateX(durationMillis, easing);
 }