I am using MPAndroidChart
library version 2.2.4
. My requirement is I want to set three marker lines in a BarChart
with values "Minimum", "Average" and "Maximum" like in the image below, but I can't find any solution for this.
In MPAndroidChart 3.x.x what you are asking for is called a LimitLine
There is an example of how to consume it in the sample project:
LimitLine ll1 = new LimitLine(150f, "Upper Limit");
ll1.setLineWidth(4f);
ll1.enableDashedLine(10f, 10f, 0f);
ll1.setLabelPosition(LimitLabelPosition.RIGHT_TOP);
ll1.setTextSize(10f);
ll1.setTypeface(tf);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
leftAxis.addLimitLine(ll1);
If you require a customized limit line, you will have to look at the instructions in this question here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With