I have to render a feature layer with a graduated colors renderer, using the ArcGIS API for Java (or VB, .NET).
As the feature layer data is created dynamically using webservices, I don't in advance the range of values, so I need to get the classification to be generated using the natural breaks algorithm.
Here is what I need to set:

In addition, I need to get the largest values overlaying the smallest:

I need to get n classes, using a AlgorithmicColorRamp from one given color to another color and symbolized by a simple line with a given width.
I tried to write this method, called after the layer data source is set:
public static void applyGraduatedColorsLineRenderer(IGeoFeatureLayer geoFeatureLayer, String field, int count, IColor fromColor, IColor toColor, double width) throws UnknownHostException, IOException { IAlgorithmicColorRamp colorRamp = new AlgorithmicColorRamp(); colorRamp.setAlgorithm(esriColorRampAlgorithm.esriCIELabAlgorithm); colorRamp.setFromColor(fromColor); colorRamp.setToColor(toColor); colorRamp.setSize(count); boolean[] ok = new boolean[1]; colorRamp.createRamp(ok); ClassBreaksRenderer classBreaksRenderer = new ClassBreaksRenderer(); classBreaksRenderer.setField(field); classBreaksRenderer.setBreakCount(count); classBreaksRenderer.setSortClassesAscending(false); classBreaksRenderer.setFlipSymbols(false); classBreaksRenderer.setColorRampByRef(colorRamp); for(int i = 0; i < count; i++) { SimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol(); simpleLineSymbol.setColor(fromColor); simpleLineSymbol.setStyle(esriSimpleLineStyle.esriSLSSolid); simpleLineSymbol.setWidth(width); classBreaksRenderer.setSymbol(i, simpleLineSymbol); } geoFeatureLayer.setRendererByRef(classBreaksRenderer); } The problem is that I don't get the right range for my data, and the classification method is set to "manual" instead of "Natural Breaks": 
Moreover, I don't know what is the equivalent in ArcObjects of checking "Draw this layer using the symbol levels specified below".