Class ClassBreaksRenderer

java.lang.Object
com.esri.arcgisruntime.symbology.Renderer
com.esri.arcgisruntime.symbology.ClassBreaksRenderer
All Implemented Interfaces:
JsonSerializable

public final class ClassBreaksRenderer extends Renderer
A class breaks renderer is a renderer that classifies numeric data into two or more ranges of values to create a visualization.

A class breaks renderer contains a collection of ranges (or class breaks). Each ClassBreak has a MinValue, MaxValue, and a unique Symbol. The ranges reflect a specific ClassBreaksRenderer.RendererClassificationMethod, such as equal interval, natural breaks, quantile, standard deviation and manual classification.

ClassBreaksRenderer contains properties for setting the field that the class breaks refer to and also for controlling normalization. It also defines a default label and symbol to display for values that don't fall within any of the class breaks. You can add or remove a ClassBreak from this renderer via the getClassBreaks() collection.

Class breaks can be defined as continuous, where the minimum value of a break is defined by the maximum value of the previous class break. For continuous class breaks only the max value needs to be set on each ClassBreak.

For discontinuous class breaks, set both a min and a max value in each ClassBreak.

Since:
100.0.0
See Also:
  • Constructor Details

    • ClassBreaksRenderer

      public ClassBreaksRenderer()
      Creates a new empty class breaks renderer.
      Since:
      100.0.0
    • ClassBreaksRenderer

      public ClassBreaksRenderer(String fieldName, Iterable<ClassBreaksRenderer.ClassBreak> classBreaks)
      Creates a new class breaks renderer with the given class breaks applied to the given field.
      Parameters:
      fieldName - the field name that the class breaks apply to
      classBreaks - the collection of class breaks to apply to the given field
      Since:
      100.0.0
  • Method Details

    • getBackgroundFillSymbol

      public Symbol getBackgroundFillSymbol()
      Gets the renderer's background fill symbol.
      Returns:
      background fill symbol, or null if none
      Since:
      100.4.0
    • setBackgroundFillSymbol

      public void setBackgroundFillSymbol(Symbol backgroundFillSymbol)
      Sets the renderer's background fill symbol.
      Parameters:
      backgroundFillSymbol - the renderer's background fill symbol
      Throws:
      IllegalArgumentException - if backgroundFillSymbol is null
      Since:
      100.4.0
    • getSymbol

      public Symbol getSymbol(Feature feature)
      Returns the symbol that is used to visualize the given feature.

      If the renderer is a DictionaryRenderer and its associated DictionarySymbolStyle references a style file hosted on ArcGIS Online or an ArcGIS Enterprise portal (also referred to as a web style), this method returns null. If the layer has rendered and the symbol is already drawn on the view, this method returns a valid MultilayerSymbol. If you want to get the symbol before the layer is rendered, use DictionarySymbolStyle.getSymbolAsync(Map).

      Specified by:
      getSymbol in class Renderer
      Parameters:
      feature - the Feature to get a Symbol from, not null
      Returns:
      the Symbol of the Feature that was passed
      Throws:
      IllegalArgumentException - if feature is null
      Since:
      100.0.0
      See Also:
    • getSymbol

      public Symbol getSymbol(Graphic graphic)
      Returns the symbol that is used to visualize the given graphic.

      If the renderer is a DictionaryRenderer and its associated DictionarySymbolStyle references a style file hosted on ArcGIS Online or an ArcGIS Enterprise portal (also referred to as a web style), this method returns null. If the layer has rendered and the symbol is already drawn on the view, this method returns a valid MultilayerSymbol. If you want to get the symbol before the layer is rendered, use DictionarySymbolStyle.getSymbolAsync(Map).

      Specified by:
      getSymbol in class Renderer
      Parameters:
      graphic - the Graphic to get a Symbol from, not null
      Returns:
      the Symbol of the Graphic that was passed
      Throws:
      IllegalArgumentException - if graphic is null
      Since:
      100.0.0
      See Also:
    • getClassBreaks

      public List<ClassBreaksRenderer.ClassBreak> getClassBreaks()
      Gets the collection of class breaks which define each range in this renderer.

      Changes to this list will be reflected in the renderer instance. As the returned list is a ListenableList any listener registered with the list will be notified whenever a ClassBreak is added or removed. Note that each call to this method will return the same ListenableList instance.

      Returns:
      the collection of class breaks which define each range in this renderer
      Since:
      100.0.0
    • getDefaultLabel

      public String getDefaultLabel()
      Gets the label used for the default symbol, suitable for showing in a legend, for values that don't fall within any of the class breaks.
      Returns:
      the default label. If no default label was set, this returns null.
      Since:
      100.0.0
    • setDefaultLabel

      public void setDefaultLabel(String defaultLabel)
      Sets the label used for the default symbol, suitable for showing in a legend, for values that don't fall within any of the class breaks.
      Parameters:
      defaultLabel - the new default label
      Since:
      100.0.0
    • getDefaultSymbol

      public Symbol getDefaultSymbol()
      Gets the default symbol for values that don't fall within any of the class breaks.
      Returns:
      the default symbol. If no default symbol was set, this returns null.
      Since:
      100.0.0
    • setDefaultSymbol

      public void setDefaultSymbol(Symbol defaultSymbol)
      Sets the default symbol for values that don't fall within any of the class breaks.
      Parameters:
      defaultSymbol - the new default symbol
      Since:
      100.0.0
    • getFieldName

      public String getFieldName()
      Gets the name of the field that the class breaks will apply to.
      Returns:
      the name of the field that the class breaks will apply to
      Since:
      100.0.0
    • setFieldName

      public void setFieldName(String fieldName)
      Sets the name of the field that the class breaks will apply to.
      Parameters:
      fieldName - the name of the field that the class breaks will apply to
      Since:
      100.0.0
    • getMinValue

      public double getMinValue()
      Gets the minimum value of the first class break if the renderer uses continuous class breaks.

      This will set the minimum value of the first class break in a renderer containing continuous class breaks where each ClassBreaksRenderer.ClassBreak does not define a minimum value. In this case the minimum value of each break will be the maximum value of the preceding one. As the first class break has no class break before it, this value will define its minimum.

      Returns:
      the min value for this renderer
      Since:
      100.0.0
      See Also:
    • setMinValue

      public void setMinValue(double minValue)
      Sets the minimum value of the first class break if the renderer uses continuous class breaks.

      This will set the minimum value of the first class break in a renderer containing continuous class breaks where each ClassBreaksRenderer.ClassBreak does not define a minimum value. In this case the minimum value of each break will be the maximum value of the preceding one. As the first class break has no class break before it, this value will define its minimum.

      Parameters:
      minValue - the new min value
      Since:
      100.0.0
    • getNormalizationField

      public String getNormalizationField()
      Gets the renderer's normalization field.

      This field will be used to normalize the data when the getNormalizationType() is set to ClassBreaksRenderer.NormalizationType.BY_FIELD.

      Returns:
      the normalization field
      Since:
      100.0.0
      See Also:
    • setNormalizationField

      public void setNormalizationField(String normalizationField)
      Sets the renderer's normalization field.

      This field will be used to normalize the data when the getNormalizationType() is set to ClassBreaksRenderer.NormalizationType.BY_FIELD.

      Parameters:
      normalizationField - the new normalization field
      Since:
      100.0.0
    • getNormalizationTotal

      public double getNormalizationTotal()
      Gets the renderer's normalization total.

      This is the normalization total when getNormalizationType() is set to ClassBreaksRenderer.NormalizationType.BY_PERCENT_OF_TOTAL. This means that the minimum and maximum values in each class break are defined as percentages of this total.

      Returns:
      the normalization total
      Since:
      100.0.0
    • setNormalizationTotal

      public void setNormalizationTotal(double normalizationTotal)
      Sets the renderer's normalization total.

      This is the normalization total when getNormalizationType() is set to ClassBreaksRenderer.NormalizationType.BY_PERCENT_OF_TOTAL. This means that the minimum and maximum values in each class break are defined as percentages of this total.

      Parameters:
      normalizationTotal - the normalization total
      Since:
      100.0.0
      See Also:
    • getNormalizationType

      public ClassBreaksRenderer.NormalizationType getNormalizationType()
      Gets the renderer's normalization type.

      If this property is not ClassBreaksRenderer.NormalizationType.NONE, then the class breaks contain a normalized min/max value instead of the actual value. In this case, the type will indicate the way in which the value in the field given by getFieldName() should be normalized before comparing with the class breaks.

      The default value is NormalizationType.NONE.

      Returns:
      the ClassBreaksRenderer.NormalizationType type
      Since:
      100.0.0
    • setNormalizationType

      public void setNormalizationType(ClassBreaksRenderer.NormalizationType normalizationType)
      Sets the renderer's normalization type.

      If this property is not ClassBreaksRenderer.NormalizationType.NONE, then the class breaks contain a normalized min/max value instead of the actual value. In this case, the type will indicate the way in which the value in the field given by getFieldName() should be normalized before comparing with the class breaks.

      Parameters:
      normalizationType - the normalization type
      Since:
      100.0.0
      See Also:
    • getRendererClassificationMethod

      public ClassBreaksRenderer.RendererClassificationMethod getRendererClassificationMethod()
      Gets the renderer's classification method.
      Since:
      100.4.0