How to make a line graph w/ MCUFRIEND ili9486 TFT

I have a 3.5" LCD TFT ili 9486 display shield on a MEGA running MCUFRIEND, and it works beautifully. In fact I am so happy I want to press my luck and try setting up another page that will show a line graph of water pressure readings. I have a beginning of an understanding of how to set up another page and buttons to get there and back, but not how to display a graph. I have done the screen calibration.

I have read a fair amount, and watched youtube videos, but it seems most are directed toward the adafruit library, not McuFriend. As nearly as I can tell, none of the arduino mcufriend examples consider a line graph.

Can someone tell me how to get started ?

If continuous plot individual points with tft.drawPixel() e.g. sin(x)
If you have a few discrete values, draw a line between each point

is there an example that shows how to set up and label axes ? and how to plot points and connect with a line ?

read libraries, read examples, made a line. but i don't see anywhere how to make the line fatter.

.... made a line. but i don't see anywhere how to make the line fatter....

Define top and bottom end pixel positions immediately next to the line and draw a second line. This is easy with horizontal and vertical lines, but not-so-easy with steep lines.

Adafruit_GFX has all the necessary graphics methods e.g.

      drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color),

You will need to use the Arduino map() function to convert raw ADC readings into x, y pixel values for plotting a point.

You can join up all your points with drawLine()
You can draw a tiny circle, square, triangle, at each measurement point on the graph e.g. in different colour.

You sit down and design what you want to do by drawing ideas on paper.
We can help you implement your design.

You can pick up a few ideas from the Internet. Post links to the tutorials that interest you.


yep, yep, it's coming together like an avalanche. i have gotten to the point of starting to sort out how to set up my auto plot code, and also what to do when the points go past the right boundary.

D_P -

i am getting those issues worked out, but have come to one that is much more difficult, at least for me.

I have been unable to find any guidance or examples or videos on how to flip pages on my 3.5" ili 9486 controller display. I just want to be able to make a button on one screen, and go to another screen by touching it.

maybe there is help out there for MCUFRIEND TFT, but i can't find it.

any suggestions ?