Use an AlgorithmicColorRamp to color a ClassBreaksRenderer

Description:

This sample demonstrates a tool for producing a user-specified AlgorithmicColorRamp, which is then used to color the symbols on an existing ClassBreaksRenderer on a feature layer. A Visual Basic project provides a DLL command for use in ArcMap.

How to use:
  1. Create the tool DLL
  2. Open the Visual Basic project AlgorithmicColorRamp.vbp. Compile the DLL. Set the project Version Compatibility from "Project Compatibility" to "Binary Compatibility". Build the DLL again. Exit VB.
  3. In ArcMap
  4. Open ArcMap, and create a new Map. Add a feature layer (containing polygons, lines or points).
  5. Open the Customize dialog, click Add From File and select the DLL you just made. Click OK.
  6. Still within the Customize dialog, select the Context Menus option. From the Context Menus menu item, navigate to Toolbars > Context Menus > Feature Layer Context Menu, and open it.
  7. Under the Commands tab of the Customize dialog, select the new AlgorithmicColorRamp command from the Developer Samples category and drag it onto the Feature Layer context menu. Exit the Customize dialog.
  8. Now use the new tool
  9. Render your layer with a ClassBreaksRenderer (right-click the layer and go to Properties, Symbology. Choose the Quantities, GraduatedColors option and add values from any suitable Value Field).
  10. Change the colors on the renderer by right-clicking the feature layer in the table of contents. The dialog which appears allows you to create an AlgorithmicColorRamp, based on a FromColor, a ToColor and an Algorithm.
  11. Click OK to re-color your feature layer renderer according to your selections.

Application:
ArcMap

Requires: Microsoft Windows Common Controls 6.0.

Difficulty: Intermediate


Visual Basic
File Description
AlgorithmicColorRamp.cls VB Class module containing tool implementation.
AlgorithmicColorRamp.frm VB form file containing the tool's dialog.
AlgorithmicColorRamp.vbp Visual Basic project file.
AlgorithmicColorRamp.dll Compiled component.


Key CoClasses: AlgorithmicColorRamp, ClassBreaksRenderer
Key Interfaces: IAlgorithmicColorRamp, IClassBreaksRenderer
Key Members: IAlgorithmicColorRamp::Colors, IAlgorithmicColorRamp::CreateRamp, IClassBreaksRenderer::Symbol