wangyao5 / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

Please size the legend area to the text, if possible #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Right now the legend area seems to be some fixed % of the entire Chart view.  

Please make this smarter, so that if there are only a couple of items in the 
legend, it doesn't waste so much space on the bottom, for example, in Portrait 
mode.

It should be fairly simple to measure the text, and size the legend area 
accordingly.  Adding an API for specifing the max number of legend "lines" 
could be done, or just use the current fixed height as the maximum.  It should 
probably be rounded down to the nearest integer line count, though, as 
currently in my app, the chart in Landscape mode shows partial legend lines, 
which is useless.

Original issue reported on code.google.com by zvasv...@gmail.com on 11 Jan 2012 at 6:55

GoogleCodeExporter commented 9 years ago
There are a lot of APIs for tweaking the legend appearance.
The one you need is:
renderer.setFitLegend();

There is other useful stuff, too:
renderer.setShowLegend();
renderer.setLegendHeight();

Original comment by dandrome...@gmail.com on 11 Jan 2012 at 7:53

GoogleCodeExporter commented 9 years ago
Ok, thanks.  Will try those.  You can go ahead and close this ten.

Original comment by zvasv...@gmail.com on 11 Jan 2012 at 7:59

GoogleCodeExporter commented 9 years ago

Original comment by 4viewsoft@gmail.com on 11 Jan 2012 at 8:18