Hi,

You can use this ScaleProvider to manage BarChart scale to graph not only positive but negative figures, and generates integer adhoc intervals.

Code:
public class BarScaleProvider implements ScaleProvider {

	public Scale calcScale(double min, double max) {
		Scale result=null;
		int divideCount=0;
		boolean found=false;
		Double interval;
		Double minValue;
		Double maxValue;
		
		double offset=max - min;
		if(offset>1000){
			while(!found){
				offset=offset / 1000;
				divideCount++;
				if(offset<1000)
					found=true;
			}
		}
		interval=this.getInterval(offset);
		for(int i=0; i<divideCount;i++){
			interval=interval*1000;
		}
		interval=interval.intValue()*1.0;
		minValue=min;
		minValue=minValue.intValue()*1.0;
		maxValue=max;
		maxValue=maxValue.intValue()*1.0;
		Double remainder=maxValue / interval;
		remainder=remainder.intValue()*1.0;
		maxValue=maxValue+interval-remainder;
		if(min<0.0){
			minValue=0.0;
			while(minValue>min){
				minValue=minValue-interval;
			}
		}
		result=new Scale();
		result.setMin(minValue);
		result.setMax(maxValue);
		result.setInterval(interval);
		return result;
	}
	
	protected double getInterval(double value){
		Range[] ranges={ new Range(500, 1000, 100), new Range(200, 500, 50),
						 new Range(100, 200, 20)  , new Range(50, 100, 10),
						 new Range(20, 50, 5)     , new Range(10, 20, 2),
						 new Range(5, 10, 1)      , new Range(2, 5, 0.5), 
						 new Range(1, 2, 0.2)};
		double interval=0;
		for(Range r : ranges){
			if(value>=r.left && value<r.right){
				interval=r.interval;
				break;
			}
		}
		return interval;
		
	}
	
	protected class Range {
		double left;
		double right;
		double interval;
		
		protected Range(double left, double right, double interval){
			this.left=left;
			this.right=right;
			this.interval=interval;
		}
	}

}