A good gauge of what level you need to before you fight a Gym Leader is to fight the Gym's trainers. The Gym Leader's first few will usually be around that level (usually the highest level Pokemon a Gym trainer has), while their last Pokemon will usually be about 2 level higher.
You can raise the level of your weaker team members, by (using the old and proven technique of) starting with you weakest and swapping it with you strongest. At the end of the battle the EXP will be split between the two. Later on in the game, you will find a Lucky Egg (+50% EXP gained) or an Exp Share (the Pokemon you give it to will always get half of the EXP gained, whether or not the Pokemon was in battle. The other half is split between those in battle) these items can help you level your weaker members faster.
There are many places around Nimbasa City level off trainers and wild Pokemon. To the south of the city is Route 4 and the vast Desert Resort (go left at the split path when you get out of the city), to the west is Route 5, and to the east is Route 16.
Since the Nimbasa Gym specializes in Electric-types try the following types:
Ground-type Pokemon/moves: Ground-type Pokemon are immune to Electric, Ground-type moves deals x2 damage to Electric types. Be careful of Electric/Flying types (and Electric Types with the ability Levitate) as they are immune to Ground type attacks.
Dragon, Steel, Grass-type Pokemon: They all take half damage from Electric attacks. Be careful with Grass-types, because most of the trainers in the Gym will have an Emolga, that uses Flying-type moves which do double damage to Grass.
Ice-type moves (as per @StrixVaria's note): it's effective against her first Pokemon, as her last Pokemon has a Fire-type move (Flame Charge) that will do double damage against it. They have a move called "Volt Blitz" what switches between the them. Unfortunately, there are no Ice-type moves/TMs (on non-Water-types) available at this point.
Rock-type Pokemon/moves: they do double damage to the Electric/Flying Types at the Gym. And does though at no advantage against Electric type moves, Rock-type Pokemon take half damage against against her last Pokemon's Fire-type move (Flame Charge) and Flying-type moves (From those Pesky Electric/Fire-types).
Some Pokemon: Sandile and Scraggy from around Route 4 and the Desert Resort area. Dust clouds (rare encounters, like shaking grass) Drilbur from Wellspring Cave. Roggenrola/Boldore (common encounter in Wellspring Cave) is another good choice against as it's effective against the Electric/Flying types in the Gym.
If you play your moves (stat boosts and inflicting status conditions such as Confuse + Sleep) and recovery items right you can probably beat the Gym leader with just your Pignite. Be on the look out for Electric Pokemon with Flying and Fire-type moves or Electric/Flying dual types (Emolga) at this gym.