Appropriate temperatures allow for proper digestion...which thus plays a part in nutrient absorption....so hopefully the warmest part of the cage where the chameleon can sit is in the mid 80's?
Exposure to UVB (either direct sunlight or a proper UVB light) allows the chameleon to produce D3 which allows it to use the calcium in its system. There should be no glass or plastic between the chameleon and the light.
Now, its great that the chameleon produces D3, but it needs calcium to go along with it and if you don't provide it with some in its diet, it will take it from the bones. Since most insects we use as feeders (especially if they aren't fed/gutloaded properly) have a poor ratio of calcium to phosphorous...so its important to dust them before giving them to the chameleon at most feedings with a phos.-free calcium powder to make up for this. (More about the phos. later.)
I dust twice a month with a phos.-free calcium/D3 to ensure that the chameleon gets some D3 without overdosing it. The rest of the D3 should be produced from exposure to the UVB. D3 from supplements can build up in the system and cause problems...so its important not to overdo it.
I also dust twice a month with a vitamin powder that has a beta carotene (prOformed) source of vitamin A. Beta carotene can't build up in the system like prEformed vitamin A can. However, there is controversy as to whether any/all chameleons can convert beta carotene...so some people give a little prEformed vitamin A once in a while. Excess prEformed vitamin A can prevent the D3 from doing its job and push the chameleon towards MBD.
Its important to gutload/feed your insects a nutritious diet too. Crickets, roaches, superworms can be fed a wide variety of greens (dandelions, kale, collards, endive, escarole, mustard greens, etc.) and veggies (carrots, squash, sweet potato, sweet red pepper, zucchini, celery leaves, etc.). Other insects should be fed things appropriate for them too.
So...calcium, phos., D3 and vitamin A are all important players in bone health and they need to be in balance. When trying to attain that balance you need to look at what supplements you use, what you feed the insects, what you feed the chameleon, the UVB, the temperature, etc.
Now...weak legs can be a sign of MBD but we need more information. Other indications of MBD include but are not limited to...inability to lift the body off the branches, crooked or flexible casque, crooked arms and/or legs, deformed jaw, twitching and later on, lethargy, sitting lower in the branches, lack of appetite, etc.
If your chameleon is having problems the best advice I can give you is to take it to a good vet who is familiar with chameleons and their issues.