*/
public void adjustWidth(HashMap<String, Double> chartMetrics, int chartType, String[] legends) {
Pos p= (Pos) Chart.findRec(this.chartArr, Pos.class);
int[] coords= p.getLegendCoords(); // x, y, w, h, fh, legendpos
if (coords!=null) {
Font f= this.getFnt();
// legend position LEFT and RIGHT display each legend on a separate line (fVert==true)
// TOP and BOTTOM are displayed horizontally with symbols and spacing between entries (fVert==false)
int position= this.getLegendPosition();
float cw= chartMetrics.get("canvasw").floatValue();
float x= (int)Math.ceil(Pos.convertFromSPRC(coords[0], cw, 0))-3;
float w= chartMetrics.get("w").floatValue();
// calculate how much width the legends take up -- algorithm works well for about 80% of the cases ...
double legendsWidth= 0;
java.awt.Font jf= new java.awt.Font(f.getFontName(), f.getFontWeight(), (int)f.getFontHeightInPoints());
int extras= (chartType==ChartConstants.LINECHART|| chartType==ChartConstants.RADARCHART?15:5); // pad for legend symbols, etc -
for (int i= 0; i < legends.length; i++) {
if (fVert)
legendsWidth= Math.max(legendsWidth, StringTool.getApproximateStringWidth(jf, " " + legends[i] + " "));
else