Aloha
Aloha

Reputation: 914

How do I add trend lines to a chart?

For the uninitiated, this is a trend line: enter image description here

How do I do that in an Android charting library, like MPAndroidChart? I've already set up the necessary code to produce the needed line chart, but I have no idea how to overlay a trend line over it.

Upvotes: 1

Views: 2272

Answers (1)

Carl Poole
Carl Poole

Reputation: 2030

You could calculate the trend line mathematically and add a new line to the chart for that new line. Here's a tutorial on how to calculate trend lines.

If you followed that tutorial it would give you the equation you could plug in some values to get the X and Y coordinates to plot on the chart.

Upvotes: 2

Related Questions