Search in sources :

Example 11 with Animation

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

the class BarCardOne method dismiss.

@Override
public void dismiss(Runnable action) {
    super.dismiss(action);
    mChart.dismissAllTooltips();
    int[] order = { 0, 2, 1, 3 };
    mChart.dismiss(new Animation().setOverlap(.7f, order).setEndAction(action));
}
Also used : Animation(com.db.chart.animation.Animation)

Example 12 with Animation

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

the class BarCardThree method dismiss.

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

Example 13 with Animation

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

the class StackedFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_stacked, container, false);
    mChart = (StackBarChartView) layout.findViewById(R.id.chart);
    mFirstStage = true;
    layout.setOnClickListener(this);
    mChart.setOnClickListener(this);
    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(AxisRenderer.LabelPosition.OUTSIDE).setYAxis(false).setYLabels(AxisRenderer.LabelPosition.NONE).setValueThreshold(89.f, 89.f, thresPaint);
    mChart.show(new Animation().setOverlap(.5f, new int[] { 0, 1, 2, 3, 4, 5, 6 }));
    return layout;
}
Also used : BarSet(com.db.chart.model.BarSet) Animation(com.db.chart.animation.Animation) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint) StackBarChartView(com.db.chart.view.StackBarChartView) View(android.view.View)

Example 14 with Animation

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

the class LineCardOne method dismiss.

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

Example 15 with Animation

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

the class LineCardOne method show.

@Override
public void show(Runnable action) {
    super.show(action);
    // Tooltip
    mTip = new Tooltip(mContext, R.layout.linechart_three_tooltip, R.id.value);
    ((TextView) mTip.findViewById(R.id.value)).setTypeface(Typeface.createFromAsset(mContext.getAssets(), "OpenSans-Semibold.ttf"));
    mTip.setVerticalAlignment(Tooltip.Alignment.BOTTOM_TOP);
    mTip.setDimensions((int) Tools.fromDpToPx(58), (int) Tools.fromDpToPx(25));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        mTip.setEnterAnimation(PropertyValuesHolder.ofFloat(View.ALPHA, 1), PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f), PropertyValuesHolder.ofFloat(View.SCALE_X, 1f)).setDuration(200);
        mTip.setExitAnimation(PropertyValuesHolder.ofFloat(View.ALPHA, 0), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0f), PropertyValuesHolder.ofFloat(View.SCALE_X, 0f)).setDuration(200);
        mTip.setPivotX(Tools.fromDpToPx(65) / 2);
        mTip.setPivotY(Tools.fromDpToPx(25));
    }
    mChart.setTooltips(mTip);
    // Data
    LineSet dataset = new LineSet(mLabels, mValues[0]);
    dataset.setColor(Color.parseColor("#758cbb")).setFill(Color.parseColor("#2d374c")).setDotsColor(Color.parseColor("#758cbb")).setThickness(4).setDashed(new float[] { 10f, 10f }).beginAt(5);
    mChart.addData(dataset);
    dataset = new LineSet(mLabels, mValues[0]);
    dataset.setColor(Color.parseColor("#b3b5bb")).setFill(Color.parseColor("#2d374c")).setDotsColor(Color.parseColor("#ffc755")).setThickness(4).endAt(6);
    mChart.addData(dataset);
    // Chart
    mChart.setBorderSpacing(Tools.fromDpToPx(15)).setAxisBorderValues(0, 20).setYLabels(AxisRenderer.LabelPosition.NONE).setLabelsColor(Color.parseColor("#6a84c3")).setXAxis(false).setYAxis(false);
    mBaseAction = action;
    Runnable chartAction = new Runnable() {

        @Override
        public void run() {
            mBaseAction.run();
            mTip.prepare(mChart.getEntriesArea(0).get(3), mValues[0][3]);
            mChart.showTooltip(mTip, true);
        }
    };
    Animation anim = new Animation().setEasing(new BounceInterpolator()).setEndAction(chartAction);
    mChart.show(anim);
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator) Tooltip(com.db.chart.tooltip.Tooltip) Animation(com.db.chart.animation.Animation) TextView(android.widget.TextView) LineSet(com.db.chart.model.LineSet)

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