djsiz djsiz - 9 months ago 31
Android Question

Displaying the YAxisRight values to be fixed places , not depending upon the data to be populated

I am trying to implement a Data Consumption Usage Graph in my App, and have been using MPAndroidChart for that. I had done full customisation of the Graph, but the problem is , I am not able to show the YAxisRight Values to be in fixed places ( not depending upon the data to be populated). I wanted to show the YAxisRight Labels in fixed places always even if the dataList is 0 or 100.

BTW I had done YAxisValueFormatter for showing values in range, but that is depending upon the data being populated.

As shown in the figure, the values on YAxisRight should always in fixed place , without depending upon the data being populated!

Thanks for the awesome library MPAndroidChart :)

enter image description here


Finally, I implemented it . and for others who want to do it.. Its called the LimitLine so you have set the LimitLine to the yAxis.

ex: //showing limit at 2 and 4 in the graph...

LimitLine l = new LimitLine(2f);
//customize you limitline .. lineColor, label text color size etc
l.label = "my limit1";

Limit l1 = new LimitLine(3f);
l.label = "my limit2";

Hope it helps someone!