Bear spray on the animal's fur will have no effect: the spray must enter the eyes, nares, or mouth of the animal. Full effect can only be had if the animal is inhaling when sprayed. Bears don't much depend on eyesight. Spray on the ground or on the animal's fur can be an attractant rather than a deterrent. The spray should be practised and proven under likely weather conditions, including cold.
Carry 2 or 3 cans of spray. Sprayed bears sometimes come back and some bears require a full can before leaving the first time. And where there's one bear, there may well be two. If he comes back, you'd better have something to greet him with. Also, peace of mind for the trail home.
A bear in aggressive charge is a different beast than one displaying, bluff charging, or curious. In the last instances, the bear has time to evaluate the scent of spray, time to change his mind, and may be discouraged. In a full-on aggressive charge, the bear will get to you from max effective spray range in well under a second (assuming 30 mph and a 30 ft max effective range). And he is in the grips of an instinctively programmed reflex action. Chances of him changing his mind if you spray him seem small, due to lack of exposure time and to his being in the grips of a pre-programmed action.
Spray is unpleasant. A bullet hurts, damages, shocks and may be effective against a reflex action. A bullet presents a different and more damaging effect than spray on an aggressively attacking bear.
I suggest that bear encounter stats don't discriminate well between an aggressive attack and display, bluff, or curiosity. That may account for the claimed curiously high percentage of success with spray. Remember that display, bluff, or curiosity can turn into an aggressive deadly charge. Spray may discourage that.
Full-on aggressive attacks may result from violating the bear's claimed space, from predatory instinct, or from stumbling onto a bear's food cache. A grizzly bear thus triggered is going to kill you unless you stop it. A black is as dangerous if his attack is predatory. Almost all black bear attacks on people are predatory.
A grizzly sow with cubs may be triggered to attack aggressively if the cubs don't run in the direction away from you; if they climb a nearby tree or come forward, you'll likely have an aggressive charge on hand. Even in the aggressive charge mode, the sow with cubs may not try to kill you, just teach you a lesson. You may just be badly mauled. If the cubs are yearlings and come forward, you may become the object of a lesson in predation, with small survival odds. On the other hand, black bear cubs climbing a nearby tree will likely induce mama to follow suit.
I favor a pistol. In a real aggressive attack, I'll not trust spray. I won't have time to choose if I carry both. A rifle or a shotgun is likely to be removed from your grasp by the bear immediately on contact. A pistol may remain available.
If I am lucky enough to be aware of the bear before he hits me, I'll have a chance with my sidearm.