Skip to content

Commit

Permalink
Merged.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilJay committed Feb 21, 2015
2 parents e29f401 + 1871519 commit de83223
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.SuppressLint;

/**
* Object responsible for all animations in the Chart. ANIMATIONS ONLY WORK FOR
* API LEVEL 11 (Android 3.0.x) AND HIGHER.
*
* @author Philipp Jahoda
*/
@SuppressLint("NewApi")
public class ChartAnimator {

Expand Down
14 changes: 8 additions & 6 deletions MPChartLib/src/com/github/mikephil/charting/charts/Chart.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ protected void init() {
mAnimator = new ChartAnimator();
else
mAnimator = new ChartAnimator(new AnimatorUpdateListener() {

@Override
public void onAnimationUpdate(ValueAnimator animation) {
ViewCompat.postInvalidateOnAnimation(Chart.this);
Expand Down Expand Up @@ -993,8 +993,7 @@ protected void drawMarkers() {

/**
* ################ ################ ################ ################
* Animation support below Honeycomb thanks to Jake Wharton's awesome
* nineoldandroids library: https://github.com/JakeWharton/NineOldAndroids
* ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
*/
/** CODE BELOW THIS RELATED TO ANIMATION */

Expand All @@ -1010,7 +1009,8 @@ public ChartAnimator getAnimator() {
/**
* 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.
* 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
Expand All @@ -1022,7 +1022,8 @@ public void animateXY(int durationMillisX, int durationMillisY) {
/**
* 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.
* invalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FOR
* API LEVEL 11 (Android 3.0.x) AND HIGHER.
*
* @param durationMillis
*/
Expand All @@ -1033,7 +1034,8 @@ public void animateX(int durationMillis) {
/**
* 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.
* invalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FOR
* API LEVEL 11 (Android 3.0.x) AND HIGHER.
*
* @param durationMillis
*/
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,11 @@ All chart types support animations that can be used to create / build up the cha
- `animateXY(int xDuration, int yDuration)`: Animates both horizontal and vertical axis, resulting in a left/right bottom/top build-up.

```java
mChart.animateX(3000f); // animate horizontal 3000 milliseconds
mChart.animateX(3000); // animate horizontal 3000 milliseconds
// or:
mChart.animateY(3000f); // animate vertical 3000 milliseconds
mChart.animateY(3000); // animate vertical 3000 milliseconds
// or:
mChart.animateXY(3000f, 3000f); // animate horizontal and vertical 3000 milliseconds
mChart.animateXY(3000, 3000); // animate horizontal and vertical 3000 milliseconds
```

If `animate(...)` (of any kind) is called, no further calling of `invalidate()` is necessary to refresh the chart.
Expand Down

0 comments on commit de83223

Please sign in to comment.