Search in sources :

Example 1 with Animation

use of com.db.chart.animation.Animation in project WilliamChart by diogobernardino.

the class LineCardTwo method dismiss.

@Override
public void dismiss(Runnable action) {
    super.dismiss(action);
    mChart.dismiss(new Animation().setStartPoint(1, .5f).setEndAction(action));
}
Also used : Animation(com.db.chart.animation.Animation)

Example 2 with Animation

use of com.db.chart.animation.Animation in project WilliamChart by diogobernardino.

the class StackedCardOne method show.

@Override
public void show(Runnable action) {
    super.show(action);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        mChart.setOnEntryClickListener(new OnEntryClickListener() {

            @SuppressLint("NewApi")
            @Override
            public void onClick(int setIndex, int entryIndex, Rect rect) {
                if (setIndex == 2)
                    mLegendOneRed.animate().scaleY(1.3f).scaleX(1.3f).setDuration(100).withEndAction(new Runnable() {

                        @Override
                        public void run() {
                            mLegendOneRed.animate().scaleY(1.0f).scaleX(1.0f).setDuration(100);
                        }
                    });
                else if (setIndex == 1) {
                    mLegendOneYellow.animate().scaleY(1.3f).scaleX(1.3f).setDuration(100).withEndAction(new Runnable() {

                        @Override
                        public void run() {
                            mLegendOneYellow.animate().scaleY(1.0f).scaleX(1.0f).setDuration(100);
                        }
                    });
                } else {
                    mLegendOneGreen.animate().scaleY(1.3f).scaleX(1.3f).setDuration(100).withEndAction(new Runnable() {

                        @Override
                        public void run() {
                            mLegendOneGreen.animate().scaleY(1.0f).scaleX(1.0f).setDuration(100);
                        }
                    });
                }
            }
        });
    Paint thresPaint = new Paint();
    thresPaint.setColor(Color.parseColor("#dad8d6"));
    thresPaint.setPathEffect(new DashPathEffect(new float[] { 10, 20 }, 0));
    thresPaint.setStyle(Paint.Style.STROKE);
    thresPaint.setAntiAlias(true);
    thresPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
    BarSet stackBarSet = new BarSet(mLabels, mValuesOne[0]);
    stackBarSet.setColor(Color.parseColor("#a1d949"));
    mChart.addData(stackBarSet);
    stackBarSet = new BarSet(mLabels, mValuesOne[1]);
    stackBarSet.setColor(Color.parseColor("#ffcc6a"));
    mChart.addData(stackBarSet);
    stackBarSet = new BarSet(mLabels, mValuesOne[2]);
    stackBarSet.setColor(Color.parseColor("#ff7a57"));
    mChart.addData(stackBarSet);
    mChart.setBarSpacing(Tools.fromDpToPx(15));
    mChart.setRoundCorners(Tools.fromDpToPx(1));
    mChart.setXAxis(false).setXLabels(XRenderer.LabelPosition.OUTSIDE).setYAxis(false).setYLabels(YRenderer.LabelPosition.NONE).setValueThreshold(89.f, 89.f, thresPaint);
    int[] order = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
    mChart.show(new Animation().setOverlap(.5f, order).setEndAction(action));
}
Also used : Rect(android.graphics.Rect) OnEntryClickListener(com.db.chart.listener.OnEntryClickListener) BarSet(com.db.chart.model.BarSet) Animation(com.db.chart.animation.Animation) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Example 3 with Animation

use of com.db.chart.animation.Animation in project WilliamChart by diogobernardino.

the class StackedCardThree method show.

@Override
public void show(Runnable action) {
    super.show(action);
    BarSet dataset = new BarSet(mLabels, mValues[0]);
    dataset.setColor(Color.parseColor("#687E8E"));
    mChart.addData(dataset);
    dataset = new BarSet(mLabels, mValues[1]);
    dataset.setColor(Color.parseColor("#FF5C8E67"));
    mChart.addData(dataset);
    mChart.setRoundCorners(Tools.fromDpToPx(5));
    mChart.setBarSpacing(Tools.fromDpToPx(5));
    mChart.setBorderSpacing(Tools.fromDpToPx(5)).setYLabels(AxisRenderer.LabelPosition.NONE).setXLabels(AxisRenderer.LabelPosition.NONE).setXAxis(false).setYAxis(false).setAxisBorderValues(-80, 80, 10);
    Animation anim = new Animation().setEasing(new DecelerateInterpolator()).setEndAction(action);
    mChart.show(anim);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) BarSet(com.db.chart.model.BarSet) Animation(com.db.chart.animation.Animation)

Example 4 with Animation

use of com.db.chart.animation.Animation in project WilliamChart by diogobernardino.

the class StackedCardTwo method dismiss.

@Override
public void dismiss(Runnable action) {
    super.dismiss(action);
    mChart.dismiss(new Animation().setDuration(2500).setEasing(new AccelerateInterpolator()).setEndAction(action));
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) Animation(com.db.chart.animation.Animation)

Example 5 with Animation

use of com.db.chart.animation.Animation in project WilliamChart by diogobernardino.

the class StackedCardTwo method show.

@Override
public void show(Runnable action) {
    super.show(action);
    BarSet barSet = new BarSet(mLabels, mValues[0]);
    barSet.setColor(Color.parseColor("#90ee7e"));
    mChart.addData(barSet);
    barSet = new BarSet(mLabels, mValues[1]);
    barSet.setColor(Color.parseColor("#2b908f"));
    mChart.addData(barSet);
    Paint gridPaint = new Paint();
    gridPaint.setColor(Color.parseColor("#e7e7e7"));
    gridPaint.setStyle(Paint.Style.STROKE);
    gridPaint.setAntiAlias(true);
    gridPaint.setStrokeWidth(Tools.fromDpToPx(.7f));
    mChart.setBarSpacing(Tools.fromDpToPx(10));
    mChart.setBorderSpacing(0).setStep(1).setGrid(0, 10, gridPaint).setXAxis(false).setYAxis(false).setLabelsFormat(new DecimalFormat("##'M'")).show(new Animation().setDuration(2500).setEasing(new AccelerateInterpolator()).setEndAction(action));
}
Also used : BarSet(com.db.chart.model.BarSet) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) DecimalFormat(java.text.DecimalFormat) Animation(com.db.chart.animation.Animation) Paint(android.graphics.Paint)

Aggregations

Animation (com.db.chart.animation.Animation)19 BarSet (com.db.chart.model.BarSet)8 Paint (android.graphics.Paint)5 DashPathEffect (android.graphics.DashPathEffect)4 View (android.view.View)4 LineSet (com.db.chart.model.LineSet)4 BounceInterpolator (android.view.animation.BounceInterpolator)3 Tooltip (com.db.chart.tooltip.Tooltip)3 Rect (android.graphics.Rect)2 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)2 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)2 TextView (android.widget.TextView)2 OnEntryClickListener (com.db.chart.listener.OnEntryClickListener)2 Point (com.db.chart.model.Point)2 PropertyValuesHolder (android.animation.PropertyValuesHolder)1 CardView (android.support.v7.widget.CardView)1 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)1 Bar (com.db.chart.model.Bar)1 BarChartView (com.db.chart.view.BarChartView)1 ChartView (com.db.chart.view.ChartView)1