Draw a vertical line in the middle of the line chart (indicator)

I use a chart library called MPAndroidChart and I am very pleased with it. However, I want to draw a thick vertical line (as a background, not as data), which serves as an indicator in the middle of the line chart. How can i do this?

Sincerely.

+6
source share
2 answers

You can use the LimitLine class to do this.

Basically, this class allows you to draw a custom string at a specified position along the y axis in the diagram and add a description to it.

After creating the string, you need to assign it to XAxis or YAxis .

See the documentation for more details. You can find the limit values ​​at the bottom of the page.

In addition, in this example, the class shows how to use them: https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity1.java

UPDATE : now LimitLines can be assigned to any axis!

+6
source

You can draw vertical lines on a chart using the Highlight class. See fooobar.com/questions/555331 / ...

0
source

Source: https://habr.com/ru/post/983695/


All Articles