Search in sources :

Example 1 with ChartAnimator

use of com.github.mikephil.charting.animation.ChartAnimator in project MPAndroidChart by PhilJay.

the class Chart method init.

/**
     * initialize all paints and stuff
     */
protected void init() {
    setWillNotDraw(false);
    if (android.os.Build.VERSION.SDK_INT < 11)
        mAnimator = new ChartAnimator();
    else
        mAnimator = new ChartAnimator(new AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                // ViewCompat.postInvalidateOnAnimation(Chart.this);
                postInvalidate();
            }
        });
    // initialize the utils
    Utils.init(getContext());
    mMaxHighlightDistance = Utils.convertDpToPixel(500f);
    mDescription = new Description();
    mLegend = new Legend();
    mLegendRenderer = new LegendRenderer(mViewPortHandler, mLegend);
    mXAxis = new XAxis();
    mDescPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mInfoPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    // orange
    mInfoPaint.setColor(Color.rgb(247, 189, 51));
    mInfoPaint.setTextAlign(Align.CENTER);
    mInfoPaint.setTextSize(Utils.convertDpToPixel(12f));
    if (mLogEnabled)
        Log.i("", "Chart.init()");
}
Also used : Legend(com.github.mikephil.charting.components.Legend) Description(com.github.mikephil.charting.components.Description) LegendRenderer(com.github.mikephil.charting.renderer.LegendRenderer) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) Paint(android.graphics.Paint) ValueAnimator(android.animation.ValueAnimator) ChartAnimator(com.github.mikephil.charting.animation.ChartAnimator) XAxis(com.github.mikephil.charting.components.XAxis)

Aggregations

ValueAnimator (android.animation.ValueAnimator)1 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)1 Paint (android.graphics.Paint)1 ChartAnimator (com.github.mikephil.charting.animation.ChartAnimator)1 Description (com.github.mikephil.charting.components.Description)1 Legend (com.github.mikephil.charting.components.Legend)1 XAxis (com.github.mikephil.charting.components.XAxis)1 LegendRenderer (com.github.mikephil.charting.renderer.LegendRenderer)1