Search in sources :

Example 1 with StackBarChartView

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

Aggregations

DashPathEffect (android.graphics.DashPathEffect)1 Paint (android.graphics.Paint)1 View (android.view.View)1 Animation (com.db.chart.animation.Animation)1 BarSet (com.db.chart.model.BarSet)1 StackBarChartView (com.db.chart.view.StackBarChartView)1