Class: ClassBreaksRenderer

Description

Class added v1.4.

A class breaks renderer symbolizes each graphic based on the value of some numeric attribute. For more information about renderers, see Symbolizing graphics with renderers.

Samples

Search for samples that use this class.  

Class hierarchy

esri.Renderer
  |_ esri.renderer.ClassBreaksRenderer

Constructor

Constructor Description
esri.renderer.ClassBreaksRenderer(defaultSymbol, attributeField) Creates a new ClassBreaksRenderer object.

Properties

Property Type Description
attributeField String The name of the attribute field the renderer uses to match values against.
breaks Object[] Deprecated at v2.0, use infos instead. A 2-D array representing defined breaks. The array consists of [minValue,maxValue] pairs.
infos Object[] Each element in the array is an object that provides information about the class breaks associated with the renderer. The object has the following properties:
<Number> minValue The minimum value.
<Number> maxValue The maximum value.
<Symbol> symbol The symbol used to display the value.
<String> label Label for the symbol used to draw the value.
<String> description Label for the symbol used to draw the value.

Methods

Method Return Value Description
addBreak(minValue or info, maxValue?, symbol?) none Adds a class break. You can provide the minimum, maximum and symbol values as individual arguments or using the info object. The range of the break is greater than or equal to the minimum value and less than the maximum value. After making changes, you must refresh the graphic.
removeBreak(minValue, maxValue) none Removes a break. After making changes, you must refresh the graphic.
Constructor Detail

esri.renderer.ClassBreaksRenderer(defaultSymbol, attributeField)

Creates a new ClassBreaksRenderer object.
Parameters:
<Symbol> defaultSymbol Required Default symbol for the renderer. This symbol is used for unmatched values.
<String> attributeField Required Attribute field renderer uses to match values.
Code snippets:
var renderer = new esri.renderer.ClassBreaksRenderer(symbol, "POP07_SQMI");
Properties Detail

<String> attributeField

The name of the attribute field the renderer uses to match values against.

<Object[]> breaks

Deprecated at v2.0, use infos instead. A 2-D array representing defined breaks. The array consists of [minValue,maxValue] pairs.

<Object[]> infos

Each element in the array is an object that provides information about the class breaks associated with the renderer. The object has the following properties:
<Number> minValue The minimum value.
<Number> maxValue The maximum value.
<Symbol> symbol The symbol used to display the value.
<String> label Label for the symbol used to draw the value.
<String> description Label for the symbol used to draw the value.
(As of v2.0)
Code snippets:
//create an array containing the label and symbol for the renderer
var symbols = dojo.map(results[0].layer.renderer.infos,function(info){
  return  {label: info.label,symbol:info.symbol};
});

Methods Detail

addBreak(minValue or info, maxValue?, symbol?)

Adds a class break. You can provide the minimum, maximum and symbol values as individual arguments or using the info object. The range of the break is greater than or equal to the minimum value and less than the maximum value. After making changes, you must refresh the graphic.
Return value: none
Input Parameters:
<Number> minValue or info Required The value can be provided as individual arguments or as an info object with the following properties:
<Number> minValue The minimum value.
<Number> maxValue The maximum value.
<Symbol> symbol The symbol used to display the value.
<String> label Label for the symbol used to draw the value.
<String> description Label for the symbol used to draw the value.
<Number> maxValue Optional Maximum value in the break.
<Symbol> symbol Optional Symbol used for the break.
Code snippets:
Specify the minimum and maximum values and symbol as individual arguments.
renderer.addBreak(2, 5, symbol);
Specify the minimum and maximum values and symbol as an info object.
renderer.addBreak({
  minValue: 2,
  maxValue: 5,
  symbol: symbol,
  label: "Low Density"
});

removeBreak(minValue, maxValue)

Removes a break. After making changes, you must refresh the graphic.
Return value: none
Input Parameters:
<Number> minValue Required Minimum value in the break to remove.
<Number> maxValue Required Maximum value in the break to remove.