MPAndroidChart setting chart padding / offset

前端 未结 3 724
不思量自难忘°
不思量自难忘° 2021-01-11 09:52

I\'m using the MPAndroidChart for my bar graph and I\'m struggling with removing the padding of the graph (see pic below)

相关标签:
3条回答
  • 2021-01-11 10:20

    This worked for me:

    barChart.getAxisLeft().setXOffset(-9f);
    
    0 讨论(0)
  • 2021-01-11 10:26

    I know that's pretty late for answer, but now Chart has the following method:

    setViewPortOffsets(-40f, 0f, 0f, 0f)
    

    (setting weird -40f value instead 0 seems unnatural, but it still works)

    0 讨论(0)
  • 2021-01-11 10:31

    I am currently working on an update that will allow to set all paddings!

    The currently available method for setting the offsets is buggy.

    In the meantime you could try to set a negative padding or margin via .xml. Let me know if this works!

    0 讨论(0)
提交回复
热议问题