ClassBreaksRenderer Class

  • ClassBreaksRenderer
  • class Esri::ArcGISRuntime::ClassBreaksRenderer

    A class breaks renderer classifies numeric data into two or more ranges of values to create a visualization. More...

    Header: #include <ClassBreaksRenderer.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Renderer

    Public Functions

    ClassBreaksRenderer(QObject *parent = nullptr)
    ClassBreaksRenderer(const QString &field, const QList<Esri::ArcGISRuntime::ClassBreak *> &classBreaks, QObject *parent = nullptr)
    virtual ~ClassBreaksRenderer() override
    Esri::ArcGISRuntime::Symbol *backgroundFillSymbol() const
    Esri::ArcGISRuntime::ClassBreakListModel *classBreaks() const
    Esri::ArcGISRuntime::RendererClassificationMethod classificationMethod() const
    QString defaultLabel() const
    Esri::ArcGISRuntime::Symbol *defaultSymbol() const
    QString fieldName() const
    double minValue() const
    QString normalizationField() const
    double normalizationTotal() const
    Esri::ArcGISRuntime::RendererNormalizationType normalizationType() const
    void setBackgroundFillSymbol(Esri::ArcGISRuntime::Symbol *backgroundFillSymbol)
    void setDefaultLabel(const QString &label)
    void setDefaultSymbol(Esri::ArcGISRuntime::Symbol *symbol)
    void setFieldName(const QString &fieldName)
    void setMinValue(double minValue)
    void setNormalizationField(const QString &field)
    void setNormalizationTotal(double total)
    void setNormalizationType(Esri::ArcGISRuntime::RendererNormalizationType type)

    Detailed Description

    A class breaks renderer contains a collection of ranges (or class breaks). Each ClassBreak has a ClassBreak::minValue, ClassBreak::maxValue, and a unique ClassBreak::symbol. The ranges reflect a specific 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 classBreaks 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.

    Example:

    Apply a ClassBreaksRenderer to a point feature layer repesenting cities of different population sizes:

    // Create the class breaks for the different sized cities
    ClassBreak* classBreak1 = new ClassBreak("Small cities", "Cities with up to 50,000 people", 0, 50000, new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Circle, QColor(Qt::gray), 5, this), this);
    ClassBreak* classBreak2 = new ClassBreak("Moderate cities", "Cities with between 50,001 and 100,000 people", 50000, 100000, new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Circle, QColor(Qt::green), 10, this), this);
    ClassBreak* classBreak3 = new ClassBreak("Large cities", "Cities with between 100,001 and 500,000 people", 100000, 500000, new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Circle, QColor(Qt::blue), 15, this), this);
    ClassBreak* classBreak4 = new ClassBreak("Very large cities", "Cities with 500,001 or more people", 500000, 100000000, new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Circle, QColor(Qt::red), 20, this), this);
    
    // Add the class breaks to the renderer
    ClassBreaksRenderer* classBreaksRenderer = new ClassBreaksRenderer("Population", QList<ClassBreak*>() << classBreak1 << classBreak2 << classBreak3 << classBreak4, this);
    
    // Create a feature layer and apply the renderer to the layer
    ServiceFeatureTable* featureTable1 = new ServiceFeatureTable(serviceUrl, this);
    FeatureLayer* featureLayer1 = new FeatureLayer(featureTable1, this);
    featureLayer1->setRenderer(classBreaksRenderer);

    See also ClassBreakListModel and ClassBreak.

    Member Function Documentation

    [explicit] ClassBreaksRenderer::ClassBreaksRenderer(QObject *parent = nullptr)

    Default constructor that creates a new empty class breaks renderer with an optional parent.

    • parent - The optional parent QObject.

    ClassBreaksRenderer::ClassBreaksRenderer(const QString &field, const QList<Esri::ArcGISRuntime::ClassBreak *> &classBreaks, QObject *parent = nullptr)

    Constructor that creates a new class breaks renderer with a field and list of classBreaks, with an optional parent.

    • field - The field name that the class breaks apply to.
    • classBreaks - The collection of class breaks to apply to the given field.
    • parent - The optional parent QObject.

    [override virtual] ClassBreaksRenderer::~ClassBreaksRenderer()

    Destructor.

    [since Esri::ArcGISRuntime 100.2] Esri::ArcGISRuntime::Symbol *ClassBreaksRenderer::backgroundFillSymbol() const

    Returns the renderer's background fill symbol which should be of type SimpleFillSymbol.

    By default this symbol will be a nullptr. This symbol will only be applied if all of the following conditions apply:

    • The geometry being rendered is of type Polygon.
    • The polygon is symbolised using a ClassBreak with a point symbol at its centroid.

    This allows you to symbolise a polygon with a point for the class break but still show its full geometry. For example, a background fill symbol could be added to a ClassBreaksRenderer which shows population polygons with graduated circle symbols to indicate the number of residents. By setting the background symbol, you can show the population quantity as a point and still display the outline of the underlying polygon.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    See also setBackgroundFillSymbol().

    Esri::ArcGISRuntime::ClassBreakListModel *ClassBreaksRenderer::classBreaks() const

    Returns a collection of class breaks for the renderer as a ClassBreakListModel.

    The ClassBreakListModel will contain a list model of all the class breaks defined in the renderer.

    [since Esri::ArcGISRuntime 100.2] Esri::ArcGISRuntime::RendererClassificationMethod ClassBreaksRenderer::classificationMethod() const

    The classification method that was used to generate class breaks.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    QString ClassBreaksRenderer::defaultLabel() const

    Returns the label used for the default symbol.

    See also setDefaultLabel.

    Esri::ArcGISRuntime::Symbol *ClassBreaksRenderer::defaultSymbol() const

    Returns the default symbol for values that don't fall within any of the class breaks.

    See also setDefaultSymbol.

    QString ClassBreaksRenderer::fieldName() const

    Returns the name of the field that the class breaks apply to.

    See also setFieldName().

    double ClassBreaksRenderer::minValue() const

    Returns 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 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.

    See also setMinValue().

    QString ClassBreaksRenderer::normalizationField() const

    Returns the renderer's normalization field.

    This field will be used to normalize the data when the normalizationType is set to RendererNormalizationType::ByField.

    See also setNormalizationField.

    double ClassBreaksRenderer::normalizationTotal() const

    Returns the renderer's normalization total.

    This field is the normalization total when normalizationType is set to RendererNormalizationType::ByPercentOfTotal. This means that the minimum and maximum values in each class break are defined as percentages of this total.

    See also setNormalizationTotal.

    Esri::ArcGISRuntime::RendererNormalizationType ClassBreaksRenderer::normalizationType() const

    Returns the renderer's normalization type.

    If this property is not RendererNormalizationType::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 should be normalized before comparing with the class breaks.

    The default value is RendererNormalizationType::None.

    RendererNormalizationType::None if an error occurs.

    See also setNormalizationType.

    [since Esri::ArcGISRuntime 100.2] void ClassBreaksRenderer::setBackgroundFillSymbol(Esri::ArcGISRuntime::Symbol *backgroundFillSymbol)

    Sets the renderer's background fill symbol to backgroundFillSymbol.

    The symbol should be of type SimpleFillSymbol. This symbol will only be applied if all of the following conditions apply:

    • The geometry being rendered is of type Polygon.
    • The polygon is symbolised using a ClassBreak with a point symbol at its centroid.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    See also backgroundFillSymbol.

    void ClassBreaksRenderer::setDefaultLabel(const QString &label)

    Sets the default label.

    The default label is used if the graphic or feature's attribute value does not fall into any of the class breaks.

    See also defaultLabel().

    void ClassBreaksRenderer::setDefaultSymbol(Esri::ArcGISRuntime::Symbol *symbol)

    Sets the default symbol.

    The default symbol is used if the graphic or feature's attribute value does not fall into any of the class breaks.

    See also defaultSymbol().

    void ClassBreaksRenderer::setFieldName(const QString &fieldName)

    Sets the attribute fieldName used by the renderer to match values.

    See also fieldName().

    void ClassBreaksRenderer::setMinValue(double minValue)

    Sets the minValue for this class breaks renderer.

    See also minValue().

    void ClassBreaksRenderer::setNormalizationField(const QString &field)

    Sets the normalization field for this class breaks renderer.

    The normalizationField is applicable when the normalizationType is by field, as opposed to percent of total or log. The data will be normalized by the value contained in the specified field.

    See also normalizationField() and normalizationType.

    void ClassBreaksRenderer::setNormalizationTotal(double total)

    Sets the normalization total for this class breaks renderer.

    The normalizationTotal is applicable when the normalizationType is percent of total, as opposed to by field or log. Use normalizationTotal to obtain or set the total value.

    See also normalizationTotal() and normalizationType.

    void ClassBreaksRenderer::setNormalizationType(Esri::ArcGISRuntime::RendererNormalizationType type)

    The normalization type for this class breaks renderer.

    Set the normalizationType to normalize the data instead of using the raw attribute value.

    For example, consider a "cities" layer that contained a total crimes attribute. If you did not normalize the data, the map would symbolize the cities with the highest amount of crimes. However, this could be misleading, as the cities with a higher population would likely have more crimes, simply due to the having more people. You could instead normalize the data by a field called population, so you could visualizes the amount of crimes per person.

    The normalizationType is used to determine how the data is normalized. When normalization type is by field, use the normalizationField to determine or set the field used to normalize the data. When normalization type is percent of total, use normalizationTotal to determine or set the total value.

    See also normalizationType().

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.