Amalo
Amalo

Reputation: 772

Android horizontal bar chart change height of BarDataSet

I have an horizontal bar chart i need to make the height of every line thinner, so i need to change the height of BarDataSet

this is my bar chart code:

  BarDataSet dataset = new BarDataSet(entries, "");


        ArrayList<String> array = new ArrayList<String>();
        for (int i = 0; i < poll.getQuestions().get(0).getAnswers().size(); i++)
            array.add(poll.getQuestions().get(0).getAnswers().get(i).getAnswer());
        BarData data = new BarData(array, dataset);
        dataset.setColor(ContextCompat.getColor(PollDetailActivity.this,R.color.green)); //
        dataset.setBarSpacePercent(5f);
        pieChart.setDescription("");
        pieChart.getAxisLeft().setDrawGridLines(false);
        pieChart.getXAxis().setDrawGridLines(false);
        //   pieChart.getAx().setDrawLabels(false);
        pieChart.setData(data);
        pieChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
        //   pieChart.getXAxis().setEnabled(false);
        pieChart.getAxisRight().setEnabled(false);

        pieChart.animateY(5000);

This image show that the line is so wideenter image description here

so how i can make the lines thinner ?

Upvotes: 1

Views: 818

Answers (1)

Фред Генкин
Фред Генкин

Reputation: 163

Try data.setBarWidth(0.9f); this may work.

Upvotes: 1

Related Questions