use of com.db.chart.view.StackBarChartView 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;
}
Aggregations