I've been having this issue occur and I've read several articles about the issue occuring on multiple phones. There are several possible issues that it could be; a. Bad charger (improper connection causing static surges in phone, weak charger), b. Software bug (some believe it's virus related or just bad protocols) c. Hardware bug (screen cables, touch screen, bad sensors.) People have done everything from factory resets to throwing the phone or other device across the room with explicit language. If it is doing it only when on charge it is charger related, try replacing your charger or trying other outlets or taking it to another building all together to try to boil it down to any of those, check cable for damage, usb chargers try using a different base to connect to, different cords, so forth all items have different outputs even made by the same company and it could be something as little as the cord isn't able to send enough charge or is sending too much charge.