use of com.db.chart.animation.Animation in project WilliamChart by diogobernardino.
the class BarFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.fragment_bar, container, false);
mChart = (BarChartView) layout.findViewById(R.id.chart);
mFirstStage = true;
layout.setOnClickListener(this);
mChart.setOnClickListener(this);
BarSet dataset = new BarSet(mLabels, mValues[0]);
dataset.setColor(Color.parseColor("#eb993b"));
mChart.addData(dataset);
mChart.setBarSpacing(Tools.fromDpToPx(3));
mChart.setXLabels(AxisRenderer.LabelPosition.NONE).setYLabels(AxisRenderer.LabelPosition.NONE).setXAxis(false).setYAxis(false);
mChart.show(new Animation().setEasing(new BounceInterpolator()));
return layout;
}
use of com.db.chart.animation.Animation in project WilliamChart by diogobernardino.
the class BarCardOne method show.
@Override
public void show(Runnable action) {
super.show(action);
// Data
BarSet barSet = new BarSet(mLabels, mValues[0]);
barSet.setColor(Color.parseColor("#fc2a53"));
mChart.addData(barSet);
mChart.setBarSpacing(Tools.fromDpToPx(20));
mChart.setRoundCorners(Tools.fromDpToPx(2));
mChart.setBarBackgroundColor(Color.parseColor("#592932"));
// Chart
mChart.setXAxis(false).setYAxis(false).setXLabels(XRenderer.LabelPosition.OUTSIDE).setYLabels(YRenderer.LabelPosition.NONE).setLabelsColor(Color.parseColor("#86705c")).setAxisColor(Color.parseColor("#86705c"));
int[] order = { 1, 0, 2, 3 };
final Runnable auxAction = action;
Runnable chartOneAction = new Runnable() {
@Override
public void run() {
auxAction.run();
showTooltip();
}
};
mChart.show(new Animation().setOverlap(.7f, order).setEndAction(chartOneAction));
}
use of com.db.chart.animation.Animation in project WilliamChart by diogobernardino.
the class BarCardThree method show.
@Override
public void show(Runnable action) {
super.show(action);
Tooltip tip = new Tooltip(mContext);
tip.setBackgroundColor(Color.parseColor("#CC7B1F"));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 1);
tip.setEnterAnimation(alpha).setDuration(150);
alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 0);
tip.setExitAnimation(alpha).setDuration(150);
}
mChart.setTooltips(tip);
BarSet dataset = new BarSet(mLabels, mValues[0]);
dataset.setColor(Color.parseColor("#eb993b"));
mChart.addData(dataset);
mChart.setBarSpacing(Tools.fromDpToPx(1.5f));
mChart.setXLabels(AxisRenderer.LabelPosition.NONE).setYLabels(AxisRenderer.LabelPosition.NONE).setXAxis(false).setYAxis(false);
Animation anim = new Animation().setEasing(new AccelerateDecelerateInterpolator()).setEndAction(action);
mChart.show(anim);
}
use of com.db.chart.animation.Animation in project WilliamChart by diogobernardino.
the class BarCardTwo method dismiss.
@Override
public void dismiss(Runnable action) {
super.dismiss(action);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1)
mTextViewValue.animate().alpha(0).setDuration(100);
else
mTextViewValue.setVisibility(View.INVISIBLE);
mChart.dismissAllTooltips();
int[] order = { 0, 1, 2, 3, 4 };
mChart.dismiss(new Animation().setOverlap(.5f, order).setEndAction(action));
}
use of com.db.chart.animation.Animation in project WilliamChart by diogobernardino.
the class BarCardTwo method show.
@Override
public void show(Runnable action) {
super.show(action);
Tooltip tip = new Tooltip(mContext);
tip.setBackgroundColor(Color.parseColor("#f39c12"));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
tip.setEnterAnimation(PropertyValuesHolder.ofFloat(View.ALPHA, 1)).setDuration(150);
tip.setExitAnimation(PropertyValuesHolder.ofFloat(View.ALPHA, 0)).setDuration(150);
}
mChart.setTooltips(tip);
mChart.setOnEntryClickListener(new OnEntryClickListener() {
@Override
public void onClick(int setIndex, int entryIndex, Rect rect) {
mTextViewValue.setText(Integer.toString((int) mValues[0][entryIndex]));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1)
mTextViewValue.animate().alpha(1).setDuration(200);
else
mTextViewValue.setVisibility(View.VISIBLE);
}
});
mChart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1)
mTextViewValue.animate().alpha(0).setDuration(100);
else
mTextViewValue.setVisibility(View.INVISIBLE);
}
});
BarSet barSet = new BarSet();
Bar bar;
for (int i = 0; i < mLabels.length; i++) {
bar = new Bar(mLabels[i], mValues[0][i]);
switch(i) {
case 0:
bar.setColor(Color.parseColor("#77c63d"));
break;
case 1:
bar.setColor(Color.parseColor("#27ae60"));
break;
case 2:
bar.setColor(Color.parseColor("#47bac1"));
break;
case 3:
bar.setColor(Color.parseColor("#16a085"));
break;
case 4:
bar.setColor(Color.parseColor("#3498db"));
break;
default:
break;
}
barSet.addBar(bar);
}
mChart.addData(barSet);
mChart.setBarSpacing(Tools.fromDpToPx(4));
mChart.setBorderSpacing(0).setXAxis(false).setYAxis(false).setLabelsColor(Color.parseColor("#FF8E8A84")).setXLabels(XRenderer.LabelPosition.NONE);
int[] order = { 4, 3, 2, 1, 0 };
mChart.show(new Animation().setOverlap(.5f, order).setEndAction(action));
}
Aggregations