Could be a few things. The charger could be damaged. The connection within the laptop could be. Could also be something in/on the motherboard. If you can I would try another charger on it and see if the same thing happens. If it doesn't, then you know it is your charger and it would need replacing.
Again, however, if it is under warranty, I would contact the manufacturer.