Try starting up the phone in "Safe Mode" and see if you still have this problem. If you don't, then there is something on the phone (app, etc.) that is hindering it charging while on. You need to figure out what it is, and remove it.
To get into "Safe Mode" please do the following.
1. First turn off the phone.
2. Next press and hold "Power" until you see the manufacturers logo on the screen, then release the power button.
3. "Quickly" press "Volume Down" and hold it for few seconds until you see the message "Safe mode: ON" or something similar.
4. If you wanted disable it, simply repeat the steps above, and you should see "Safe Mode: OFF" rather than on.
If that doesn't help, it may well be the battery, or the charging circuit in the phone. In the case of the battery, if it is a simple to remove one, you might want to try replacing it. If it isn't, then I would look into if the device is still under warranty. If it is, then I would contact the manufacturer.