Search Results for

    Show / Hide Table of Contents

    Class GradientTheme

    The GradientTheme class defines a gradient color thematic rendering of features based by a numeric attribute.

    Inheritance
    object
    Style
    GradientTheme
    Implements
    IThemeStyle
    IStyle
    Inherited Members
    Style.MinVisible
    Style.MaxVisible
    Style.Enabled
    Style.Opacity
    Style.Equals(object)
    Style.Equals(Style)
    Style.GetHashCode()
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Mapsui.Styles.Thematics
    Assembly: Mapsui.dll
    Syntax
    public class GradientTheme : Style, IThemeStyle, IStyle

    Constructors

    | Edit this page View Source

    GradientTheme(string, double, double, IStyle, IStyle)

    Initializes a new instance of the GradientTheme class

    Declaration
    public GradientTheme(string columnName, double minValue, double maxValue, IStyle minStyle, IStyle maxStyle)
    Parameters
    Type Name Description
    string columnName

    Name of column to extract the attribute

    double minValue

    Minimum value

    double maxValue

    Maximum value

    IStyle minStyle

    Color for minimum value

    IStyle maxStyle

    Color for maximum value

    Remarks

    The gradient theme interpolates linearly between two styles based on a numerical attribute in the data source. This is useful for scaling symbols, line widths, line and fill colors from numerical attributes.

    Colors are interpolated between two colors, but if you want to interpolate through more colors (fx. a rainbow), set the TextColorBlend, LineColorBlend and FillColorBlend properties to a custom ColorBlend.

    The following properties are scaled (properties not mentioned here are not interpolated):

    PropertyRemarks
    ColorRed, Green, Blue and Alpha values are linearly interpolated.
    PenThe color, width, color of pens are interpolated. MiterLimit,StartCap,EndCap,LineJoin,DashStyle,DashPattern,DashOffset,DashCap,CompoundArray, and Alignment are switched in the middle of the min/max values.
    BrushBrush color are interpolated. Other brushes are not supported.
    VectorStyleMaxVisible, MinVisible, Line, Outline, Fill and SymbolScale are scaled linearly. Symbol, EnableOutline and Enabled switch in the middle of the min/max values.
    LabelStyleFontSize, BackColor, ForeColor, MaxVisible, MinVisible, Offset are scaled linearly. All other properties use min-style.
    Creating a rainbow color blend showing colors from red, through yellow, green and blue depicting the population density of a country.
    //Create two vector styles to interpolate between
    Mapsui.Styles.VectorStyle min = new Mapsui.Styles.VectorStyle();
    Mapsui.Styles.VectorStyle max = new Mapsui.Styles.VectorStyle();
    min.Outline.Width = 1f; //Outline width of the minimum value
    max.Outline.Width = 3f; //Outline width of the maximum value
    //Create a theme interpolating population density between 0 and 400
    Mapsui.Rendering.Thematics.GradientTheme popdens = new Mapsui.Rendering.Thematics.GradientTheme("POPDENS", 0, 400, min, max);
    //Set the fill-style colors to be a rainbow blend from red to blue.
    popdens.FillColorBlend = Mapsui.Rendering.Thematics.ColorBlend.Rainbow5;
    myVectorLayer.Styles.Add(popdens);

    Properties

    | Edit this page View Source

    ColumnName

    Gets or sets the column name from where to get the attribute value

    Declaration
    public string ColumnName { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    FillColorBlend

    Gets or sets the ColorBlend used as Fill

    Declaration
    public ColorBlend? FillColorBlend { get; set; }
    Property Value
    Type Description
    ColorBlend
    | Edit this page View Source

    LineColorBlend

    Gets or sets the ColorBlend used on lines

    Declaration
    public ColorBlend? LineColorBlend { get; set; }
    Property Value
    Type Description
    ColorBlend
    | Edit this page View Source

    Max

    Gets or sets the maximum value of the gradient

    Declaration
    public double Max { get; set; }
    Property Value
    Type Description
    double
    | Edit this page View Source

    MaxStyle

    Gets or sets the style for the maximum value

    Declaration
    public IStyle MaxStyle { get; set; }
    Property Value
    Type Description
    IStyle
    | Edit this page View Source

    Min

    Gets or sets the minimum value of the gradient

    Declaration
    public double Min { get; set; }
    Property Value
    Type Description
    double
    | Edit this page View Source

    MinStyle

    Gets or sets the style for the minimum value

    Declaration
    public IStyle MinStyle { get; set; }
    Property Value
    Type Description
    IStyle
    | Edit this page View Source

    TextColorBlend

    Gets or sets the ColorBlend used on labels

    Declaration
    public ColorBlend? TextColorBlend { get; set; }
    Property Value
    Type Description
    ColorBlend

    Methods

    | Edit this page View Source

    GetStyle(IFeature)

    Returns the style based on a numeric DataColumn, where style properties are linearly interpolated between max and min values.

    Declaration
    public IStyle? GetStyle(IFeature row)
    Parameters
    Type Name Description
    IFeature row

    Feature

    Returns
    Type Description
    IStyle

    Style calculated by a linear interpolation between the min/max styles

    Implements

    IThemeStyle
    IStyle

    Extension Methods

    StyleExtensions.GetStylesToApply(IStyle?, double)
    StyleExtensions.ShouldBeApplied(IStyle?, double)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX