Covered many many times on the forum.
Search mysql chart
Example: Dynamic series identification from message, send data to Chart - #5 by Steve-Mcl
There are many more threads too.
Give something a try and when you get stuck on a specific bit, head back and ask.