Click or drag to resize

ClassBreaksRenderer Class

A custom symbology renderer where the features of a Layer are displayed via groups based upon numerical data. The groups (aka. class breaks) are defined by specified MinValue and MaxValue values in the ClassBreakInfo objects of the ClassBreaks collection.
Inheritance Hierarchy
SystemObject
  Esri.ArcGISRuntime.SymbologyRenderer
    Esri.ArcGISRuntime.SymbologyClassBreaksRenderer

Namespace:  Esri.ArcGISRuntime.Symbology
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.7.0.0
Syntax
[ContentPropertyAttribute("ClassBreaks")]
public class ClassBreaksRenderer : Renderer

The ClassBreaksRenderer type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyBackgroundFillSymbol
Gets or sets the renderer's background fill symbol which is of type SimpleFillSymbol
Public propertyClassBreaks
Gets the collection of ClassBreak objects which define each group of numerical observations being symbolized in a Layer.
Public propertyClassificationMethod
Gets the renderer's classification method.
Public propertyDefaultLabel
Gets or sets the label used for the default symbol.
Public propertyDefaultSymbol
Gets or sets the default symbol that will be used by the ClassBreaksRenderer when there is no group specified by the ClassBreak's objects for a particular observation.
Public propertyFieldName
Gets or sets the name of the name of the Field that will be symbolized via groups using ClassBreak objects in this instance.
Public propertyMinValue
Gets or sets the minimum value
Public propertyNormalizationField
Gets or sets the normalization field.
Public propertyNormalizationTotal
Gets or sets the normalization total.
Public propertyNormalizationType
Gets or sets the renderer's normalization type.
Public propertyCode exampleRotationExpression
Gets/sets the expression describing how a Graphic's attributes are translated into a rotation to be applied to the Graphic.
(Inherited from Renderer.)
Public propertyRotationType
Gets/sets whether the rotation calculated from the RotationExpression is screen- or map-relative.
(Inherited from Renderer.)
Public propertyCode exampleSceneProperties
Gets or sets the scene properties for the renderer.
(Inherited from Renderer.)
Public propertyUnknownJson
Gets unknown data from the source JSON.
(Inherited from Renderer.)
Public propertyUnsupportedJson
Gets unsupported data from the source JSON.
(Inherited from Renderer.)
Top
Methods
  NameDescription
Public methodClone
Returns a clone of the Renderer.
(Inherited from Renderer.)
Public methodGetSymbol(GeoElement)
Returns the symbol the renderer uses to represent the supplied GeoElement.
(Inherited from Renderer.)
Public methodGetSymbol(GeoElement, Boolean)
Returns the symbol that should be used to visualize the given GeoElement with override attributes from renderer.
(Inherited from Renderer.)
Public methodToJson
Returns the json representation of the renderer
(Inherited from Renderer.)
Top
Events
  NameDescription
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from Renderer.)
Top
Examples

WPF

Example Name: ChangeSublayerRenderer

Apply a renderer to a sublayer.

Code example screen shot.

C#
// Copyright 2018 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
// language governing permissions and limitations under the License.

using System.Collections.Generic;
using System.Windows;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using System.Drawing;

namespace ArcGISRuntime.WPF.Samples.ChangeSublayerRenderer
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Change sublayer renderer",
        "Layers",
        "This sample demonstrates how to change the sub-layer renderer of an ArcGIS map image layer. A unique value renderer is applied to see different population ranges in the counties sub-layer data.",
        "Click the 'Change Sublayer Renderer' button to apply a unique value renderer to the counties sub-layer.",
        "")]
    public partial class ChangeSublayerRenderer
    {
        // ArcGIS map image layer that contains four Census sub-layers.
        private ArcGISMapImageLayer _arcGISMapImageLayer;

        public ChangeSublayerRenderer()
        {
            InitializeComponent();

            // Load the initial datasets in the map.
            Initialize();
        }

        private void Initialize()
        {
            // Create a new map based on the streets base map.
            Map newMap = new Map(Basemap.CreateStreets());

            // Create an envelope that covers the continental US in the web Mercator spatial reference.
            Envelope continentalUSEnvelope = new Envelope(-14193469.5655232, 2509617.28647268, -7228772.04749191, 6737139.97573925 , SpatialReferences.WebMercator);

            // Zoom the map to the extent of the envelope.
            newMap.InitialViewpoint = new  Viewpoint(continentalUSEnvelope);

            // Assign the map to the MapView.
            MyMapView.Map = newMap;

            // Create an ArcGIS map image layer based on the Uri to that points to an ArcGIS Server map service that contains four Census sub-layers.
            // NOTE: sub-layer[0] = Census Block Points, sub-layer[1] = Census Block Group, sub-layer[3] = Counties, sub-layer[3] = States. 
            _arcGISMapImageLayer = new ArcGISMapImageLayer(new System.Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer"));

            // Add the ArcGIS map image layer to the map's operation layers collection.
            newMap.OperationalLayers.Add(_arcGISMapImageLayer);
        }

        private ClassBreaksRenderer CreateClassBreaksRenderer()
        {
            // Define the colors that will be used by the unique value renderer.
            Color gray = Color.FromArgb(255, 153, 153, 153);
            Color blue1 = Color.FromArgb(255, 227, 235, 207);
            Color blue2 = Color.FromArgb(255, 150, 194, 191);
            Color blue3 = Color.FromArgb(255, 97, 166, 181);
            Color blue4 = Color.FromArgb(255, 69, 125, 150);
            Color blue5 = Color.FromArgb(255, 41, 84, 120);

            // Create a gray outline and five fill symbols with different shades of blue.
            SimpleLineSymbol outlineSimpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, gray, 1);
            SimpleFillSymbol simpleFileSymbol1 = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, blue1, outlineSimpleLineSymbol);
            SimpleFillSymbol simpleFileSymbol2 = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, blue2, outlineSimpleLineSymbol);
            SimpleFillSymbol simpleFileSymbol3 = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, blue3, outlineSimpleLineSymbol);
            SimpleFillSymbol simpleFileSymbol4 = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, blue4, outlineSimpleLineSymbol);
            SimpleFillSymbol simpleFileSymbol5 = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, blue5, outlineSimpleLineSymbol);

            // Create a list of five class breaks for different population ranges.
            List<ClassBreak> listClassBreaks = new List<ClassBreak>
            {
                new ClassBreak("-99 to 8560", "-99 to 8560", -99, 8560, simpleFileSymbol1),
                new ClassBreak("> 8,560 to 18,109", "> 8,560 to 18,109", 8560, 18109, simpleFileSymbol2),
                new ClassBreak("> 18,109 to 35,501", "> 18,109 to 35,501", 18109, 35501, simpleFileSymbol3),
                new ClassBreak("> 35,501 to 86,100", "> 35,501 to 86,100", 35501, 86100, simpleFileSymbol4),
                new ClassBreak("> 86,100 to 10,110,975", "> 86,100 to 10,110,975", 86100, 10110975, simpleFileSymbol5)
            };

            // Create and return the a class break renderer for use with the POP2007 field in the counties sub-layer.
            return new ClassBreaksRenderer("POP2007", listClassBreaks);
        }

        private void ChangeSublayerRendererButton_Click(object sender, RoutedEventArgs e)
        {
            // Get the counties sub-layer (the 3rd layer) from the ArcGIS map image layer.
            ArcGISMapImageSublayer countiesArcGISMapImageSubLayer = (ArcGISMapImageSublayer)_arcGISMapImageLayer.Sublayers[2];

            // Set the renderer of the ArcGIS map image sub-layer to a class break renderer based on population.
            countiesArcGISMapImageSubLayer.Renderer = CreateClassBreaksRenderer();

            // Disable the button after has been used.
            ChangeSublayerRendererButton.IsEnabled = false;
        }

    }
}
XAML
<UserControl x:Class="ArcGISRuntime.WPF.Samples.ChangeSublayerRenderer.ChangeSublayerRenderer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <StackPanel>
                <TextBlock x:Name="ChangeSublayerRendererInstructionsLabel"
                           Text="Click 'Change sublayer renderer' to apply a unique value renderer to the counties sub-layer."
                           TextWrapping="Wrap" FontWeight="SemiBold"
                           Margin="0,0,0,5" />
                <Button x:Name="ChangeSublayerRendererButton"
                        Content="Change sublayer renderer"
                        Click="ChangeSublayerRendererButton_Click" />
            </StackPanel>
        </Border>
    </Grid>
</UserControl>
See Also
Additional Examples
Hyperlink to ExampleDescription
ChangeSublayerRendererApply a renderer to a sublayer.