Mpandroidchart: How to draw horizontal stacked bar chart?

Created on 7 Sep 2015  路  9Comments  路  Source: PhilJay/MPAndroidChart

Hi PhilJay,

Could you please suggest how to draw horizontal stacked bar chart.

Most helpful comment

capture

I want this kind of bar for working hour in a day. how to get that. and need to display for week

All 9 comments

Thank you PhilJay,

I have on more issue -

values_not_clear

In above image the women age distribution values are not fully visible. Even after zoom also not visible. So we can't find the second entry's exact value

mChart.getAxisRight().setStartAtZero(true);

ArrayList yValues = new ArrayList();
yValues.add(new BarEntry(new float[]{ 10, 10 }, 0));
yValues.add(new BarEntry(new float[]{ 12, 13 }, 1));
yValues.add(new BarEntry(new float[]{ 15, 15 }, 2));
yValues.add(new BarEntry(new float[]{ 17, 17 }, 3));
yValues.add(new BarEntry(new float[]{ 19, 20 }, 4));
yValues.add(new BarEntry(new float[]{ 19, 19 }, 5));
yValues.add(new BarEntry(new float[]{ 16, 16 }, 6));
yValues.add(new BarEntry(new float[]{ 13, 14 }, 7));
yValues.add(new BarEntry(new float[]{ 10, 11 }, 8));
yValues.add(new BarEntry(new float[]{ 5, 6 }, 9));
yValues.add(new BarEntry(new float[]{ 1, 2 }, 10));

That is because the axis in the example has a fixed limit:

mChart.getAxisRight().setAxisMaxValue(25f);
mChart.getAxisRight().setAxisMinValue(-25f);

Remove it and it will work.

Thank you very much !

capture

I want this kind of bar for working hour in a day. how to get that. and need to display for week

I have the same issue. I want to have such bar for working hours. How to get this? And whether it is possible to put a filter there ? for filtering out monthly/weekly

hello beother i want creat bar chart for below my json formate data in below i want Y axis as runtime and X axis as date please help me

{
"ResponseCode": "200",
"ResponseMessage": "Success",
"ResponseData": [
{
"date": "2017-07-24",
"distance": 23.045,
"run_time": "01:02:50"
},
{
"date": "2017-07-25",
"distance": 14.561,
"run_time": "01:36:18"
},
{
"date": "2017-07-27",
"distance": 19.666,
"run_time": "02:33:21"
},
{
"date": "2017-07-28",
"distance": 18.691,
"run_time": "03:17:02"
},
{
"date": "2017-07-29",
"distance": 0,
"run_time": "00:00:00"
}
],
"DisplayMessage": null
}

image

Yes this is what I would like to have as well.

@Rsl717 @tribitinfotech @JKorsten Hello,did you find solution of your question?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andreyfel picture andreyfel  路  3Comments

rohitkumarbhagat picture rohitkumarbhagat  路  3Comments

mrZizik picture mrZizik  路  3Comments

SutharRohit picture SutharRohit  路  3Comments

AndroidJiang picture AndroidJiang  路  3Comments