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));
}
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));
}
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;
}
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));
}
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);
}
Aggregations