What's wrong ?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
lonelyplanetfr

What's wrong ?

Post by lonelyplanetfr » Mon Feb 18, 2002 5:48 pm

Hi, can someone tell me what's wrng with this code !

I want to avoid legend's overlapping in a vBarChart.


Method ChangeHistogramDesign(JFreeChart jfc ) {

RealHistDataset dcat = (RealHistDataset)jfc.getDataset() ;
// get Dataset (RealHistDataset heritated from dataset)

int prec = dcat.getLabelPrecision(); // = number of figures to display after dot
Double db ;



for(int i = 0 ; i < dcat.getCategories().size() ; i++){
db = new Double( ( (Double)(dcat.getCategories().get(i)) ).doubleValue() ) ;
dcat.getCategories().set( i, new Double(HistogramChart.cutDouble(db.doubleValue() , prec) )) ;
}



} // Method ChangeHistogramDesign

private static double cutDouble( double db , int numberOfFiguresAfterDot){
double prec = Math.pow(10 , numberOfFiguresAfterDot ) ;
System.out.println(db + " " + Math.rint( db * prec ) / prec ) ;
return Math.rint( db * prec ) / prec ;
}
} // Class HistogramChart


When I run it, I get the correct values printed in console, but the categoryLabel is unchanged...

thanks...

Locked