Skip to main content

ShapeLayer Class

Definition​

Assembly:Avalonia.Controls.Charts
Package:Avalonia.Controls.Charts

A shape layer that renders GeoJSON data as geographic shapes.

public class ShapeLayer

Inheritance: object -> AvaloniaObject -> MapLayer -> ShapeLayer

Constructors​

NameDescription
ShapeLayerInitializes a new instance of the Avalonia.Controls.Charts.ShapeLayer class.

ShapeLayer Constructor​

Initializes a new instance of the Avalonia.Controls.Charts.ShapeLayer class.

public ShapeLayer()

Methods​

NameDescription
Bind (8 overloads)Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject.
CheckAccessReturns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject.
ClearSelectionClears the current selection.
ClearValue (4 overloads)Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject.
CoerceValueCoerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject.
EqualsCompares two objects using reference equality. Inherited from AvaloniaObject.
GetBaseValueInherited from AvaloniaObject.
GetFeatureDataResolves the backing data item or fallback property map for a feature.
GetFeaturesAtReturns the features hit by the specified chart-space point.
GetHashCodeGets the hash code for the object. Inherited from AvaloniaObject.
GetLayerBoundsGets the geographic bounds (in 0-200, 0-100 viewport units) of the content in this layer. Used for auto-scaling the map to fit content.
GetPointDataGets the data item at the specified screen point.
GetValue (3 overloads)Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
IsAnimatingChecks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject.
IsItemSelectedChecks whether the specified item is selected.
IsSetChecks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject.
OnPointerExitedHandles pointer exited events. Override this method to handle interactions (e.g. clearing hover effects).
OnPointerMovedHandles pointer moved events. Override this method to handle interactions (e.g. hover effects).
OnPointerPressedHandles pointer pressed events. Override this method to handle interactions (e.g. selection).
RenderRenders this layer to the drawing context.
SetCurrentValue (2 overloads)Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject.
SetValue (3 overloads)Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
TrySelectItemAttempts to select the specified item.
VerifyAccessChecks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject.

ClearSelection Method​

Clears the current selection.

public void ClearSelection()

GetFeatureData Method​

Resolves the backing data item or fallback property map for a feature.

public object GetFeatureData(Avalonia.Controls.Charts.GeoJsonFeature feature)

Parameters​

feature Avalonia.Controls.Charts.GeoJsonFeature

The feature whose data should be resolved.

Returns​

object

The matching source item when available; otherwise a feature property dictionary or null.

GetFeaturesAt Method​

Returns the features hit by the specified chart-space point.

public System.Collections.Generic.IEnumerable<Avalonia.Controls.Charts.GeoJsonFeature> GetFeaturesAt(Avalonia.Point point, Avalonia.Rect chartArea)

Parameters​

point Avalonia.Point

The chart-space point to test.

chartArea Avalonia.Rect

The chart area used to transform screen coordinates into map coordinates.

Returns​

System.Collections.Generic.IEnumerable<Avalonia.Controls.Charts.GeoJsonFeature>

The features that contain the supplied point.

GetLayerBounds Method​

Gets the geographic bounds (in 0-200, 0-100 viewport units) of the content in this layer. Used for auto-scaling the map to fit content.

public Nullable<Avalonia.Rect> GetLayerBounds()

Returns​

Nullable<Avalonia.Rect>

GetPointData Method​

Gets the data item at the specified screen point.

public object GetPointData(Avalonia.Point point, Avalonia.Rect chartArea)

Parameters​

point Avalonia.Point

The screen point to test.

chartArea Avalonia.Rect

The chart area rectangle.

Returns​

object

The data item if hit; otherwise, null.

IsItemSelected Method​

Checks whether the specified item is selected.

public bool IsItemSelected(object item)

Parameters​

item object

The item to check.

Returns​

bool

True if the item is selected.

OnPointerExited Method​

Handles pointer exited events. Override this method to handle interactions (e.g. clearing hover effects).

public void OnPointerExited()

OnPointerMoved Method​

Handles pointer moved events. Override this method to handle interactions (e.g. hover effects).

public bool OnPointerMoved(Avalonia.Point point, Avalonia.Rect chartArea)

Parameters​

point Avalonia.Point

chartArea Avalonia.Rect

Returns​

bool

True if handled.

OnPointerPressed Method​

Handles pointer pressed events. Override this method to handle interactions (e.g. selection).

public bool OnPointerPressed(Avalonia.Point point, Avalonia.Rect chartArea)

Parameters​

point Avalonia.Point

chartArea Avalonia.Rect

Returns​

bool

True if handled.

Render Method​

Renders this layer to the drawing context.

public void Render(Avalonia.Media.DrawingContext context, Avalonia.Rect chartArea, double animationProgress)

Parameters​

context Avalonia.Media.DrawingContext

The drawing context.

chartArea Avalonia.Rect

The chart area rectangle.

animationProgress double

Animation progress from 0 to 1.

TrySelectItem Method​

Attempts to select the specified item.

public bool TrySelectItem(object item)

Parameters​

item object

The item to select.

Returns​

bool

True if the selection state changed.

Properties​

NameDescription
ColorMappingsGets or sets the collection of color mappings for shapes.
DispatcherReturns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject.
GeoJsonGets or sets the GeoJSON string data.
GeoJsonIdPathGets or sets the property name in GeoJSON to use as a unique identifier.
HighBrushGets or sets the brush for the highest data values.
HoverBrushGets or sets the brush applied when hovering over a region.
IsSelectionEnabledGets or sets whether selection is enabled for map regions.
IsVisibleGets or sets whether this layer is visible. Inherited from MapLayer.
ItemInherited from AvaloniaObject.
ItemsSourceGets or sets the data collection to bind to map regions.
LabelForegroundGets or sets the foreground brush for data labels.
LabelPathGets or sets the property path for data label text.
LegendGets or sets the legend associated with this layer.
LowBrushGets or sets the brush for the lowest data values.
MaxValueGets or sets the maximum value for color normalization.
MinValueGets or sets the minimum value for color normalization.
OpacityGets or sets the opacity of this layer. Inherited from MapLayer.
RegionPathGets or sets the property path in Avalonia.Controls.Charts.ShapeLayer.ItemsSource that matches GeoJSON identifiers.
SelectedItemGets or sets the currently selected data item.
SelectedItemsGets or sets the collection of selected data items.
SelectionBrushGets or sets the brush used for selected regions.
SelectionModeGets or sets the selection mode.
SelectionStrokeGets or sets the stroke brush used to outline selected regions.
SelectionStrokeThicknessGets or sets the stroke thickness for selected regions.
ShowLabelsGets or sets whether to display data labels on regions.
SourceGets or sets the URI source for GeoJSON data.
StrokeGets or sets the brush for shape outlines.
StrokeThicknessGets or sets the thickness of shape outlines.
TooltipTemplateGets or sets the data template used for tooltips. Inherited from MapLayer.
ValuePathGets or sets the property path in Avalonia.Controls.Charts.ShapeLayer.ItemsSource for region values.

ColorMappings Property​

Gets or sets the collection of color mappings for shapes.

public System.Collections.Generic.IList<Avalonia.Controls.Charts.ColorMapping> ColorMappings { get; set; }

GeoJson Property​

Gets or sets the GeoJSON string data.

public string GeoJson { get; set; }

GeoJsonIdPath Property​

Gets or sets the property name in GeoJSON to use as a unique identifier.

public string GeoJsonIdPath { get; set; }

HighBrush Property​

Gets or sets the brush for the highest data values.

public Avalonia.Media.IBrush HighBrush { get; set; }

HoverBrush Property​

Gets or sets the brush applied when hovering over a region.

public Avalonia.Media.IBrush HoverBrush { get; set; }

IsSelectionEnabled Property​

Gets or sets whether selection is enabled for map regions.

public bool IsSelectionEnabled { get; set; }

ItemsSource Property​

Gets or sets the data collection to bind to map regions.

public System.Collections.IEnumerable ItemsSource { get; set; }

LabelForeground Property​

Gets or sets the foreground brush for data labels.

public Avalonia.Media.IBrush LabelForeground { get; set; }

LabelPath Property​

Gets or sets the property path for data label text.

public string LabelPath { get; set; }

Legend Property​

Gets or sets the legend associated with this layer.

public Avalonia.Controls.Charts.MapLegend Legend { get; set; }

LowBrush Property​

Gets or sets the brush for the lowest data values.

public Avalonia.Media.IBrush LowBrush { get; set; }

MaxValue Property​

Gets or sets the maximum value for color normalization.

public double MaxValue { get; set; }

MinValue Property​

Gets or sets the minimum value for color normalization.

public double MinValue { get; set; }

RegionPath Property​

Gets or sets the property path in Avalonia.Controls.Charts.ShapeLayer.ItemsSource that matches GeoJSON identifiers.

public string RegionPath { get; set; }

SelectedItem Property​

Gets or sets the currently selected data item.

public object SelectedItem { get; set; }

SelectedItems Property​

Gets or sets the collection of selected data items.

public System.Collections.IList SelectedItems { get; set; }

SelectionBrush Property​

Gets or sets the brush used for selected regions.

public Avalonia.Media.IBrush SelectionBrush { get; set; }

SelectionMode Property​

Gets or sets the selection mode.

public Avalonia.Controls.Charts.ChartSelectionMode SelectionMode { get; set; }

SelectionStroke Property​

Gets or sets the stroke brush used to outline selected regions.

public Avalonia.Media.IBrush SelectionStroke { get; set; }

SelectionStrokeThickness Property​

Gets or sets the stroke thickness for selected regions.

public double SelectionStrokeThickness { get; set; }

ShowLabels Property​

Gets or sets whether to display data labels on regions.

public bool ShowLabels { get; set; }

Source Property​

Gets or sets the URI source for GeoJSON data.

public Uri Source { get; set; }

Stroke Property​

Gets or sets the brush for shape outlines.

public Avalonia.Media.IBrush Stroke { get; set; }

StrokeThickness Property​

Gets or sets the thickness of shape outlines.

public double StrokeThickness { get; set; }

ValuePath Property​

Gets or sets the property path in Avalonia.Controls.Charts.ShapeLayer.ItemsSource for region values.

public string ValuePath { get; set; }

Fields​

NameDescription
ColorMappingsPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.ColorMappings Avalonia property.
GeoJsonIdPathPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.GeoJsonIdPath Avalonia property.
GeoJsonPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.GeoJson Avalonia property.
HighBrushPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.HighBrush Avalonia property.
HoverBrushPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.HoverBrush Avalonia property.
IsSelectionEnabledPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.IsSelectionEnabled Avalonia property.
IsVisiblePropertyIdentifies the Avalonia.Controls.Charts.MapLayer.IsVisible Avalonia property. Inherited from MapLayer.
ItemsSourcePropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.ItemsSource Avalonia property.
LabelForegroundPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.LabelForeground Avalonia property.
LabelPathPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.LabelPath Avalonia property.
LegendPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.Legend Avalonia property.
LowBrushPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.LowBrush Avalonia property.
MaxValuePropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.MaxValue Avalonia property.
MinValuePropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.MinValue Avalonia property.
OpacityPropertyIdentifies the Avalonia.Controls.Charts.MapLayer.Opacity Avalonia property. Inherited from MapLayer.
RegionPathPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.RegionPath Avalonia property.
SelectedItemPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.SelectedItem Avalonia property.
SelectedItemsPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.SelectedItems Avalonia property.
SelectionBrushPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.SelectionBrush Avalonia property.
SelectionModePropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.SelectionMode Avalonia property.
SelectionStrokePropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.SelectionStroke Avalonia property.
SelectionStrokeThicknessPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.SelectionStrokeThickness Avalonia property.
ShowLabelsPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.ShowLabels Avalonia property.
SourcePropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.Source Avalonia property.
StrokePropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.Stroke Avalonia property.
StrokeThicknessPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.StrokeThickness Avalonia property.
TooltipTemplatePropertyIdentifies the Avalonia.Controls.Charts.MapLayer.TooltipTemplate Avalonia property. Inherited from MapLayer.
ValuePathPropertyIdentifies the Avalonia.Controls.Charts.ShapeLayer.ValuePath Avalonia property.

ColorMappingsProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.ColorMappings Avalonia property.

public Avalonia.StyledProperty<System.Collections.Generic.IList<Avalonia.Controls.Charts.ColorMapping>> ColorMappingsProperty

GeoJsonIdPathProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.GeoJsonIdPath Avalonia property.

public Avalonia.StyledProperty<string> GeoJsonIdPathProperty

GeoJsonProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.GeoJson Avalonia property.

public Avalonia.StyledProperty<string> GeoJsonProperty

HighBrushProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.HighBrush Avalonia property.

public Avalonia.StyledProperty<Avalonia.Media.IBrush> HighBrushProperty

HoverBrushProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.HoverBrush Avalonia property.

public Avalonia.StyledProperty<Avalonia.Media.IBrush> HoverBrushProperty

IsSelectionEnabledProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.IsSelectionEnabled Avalonia property.

public Avalonia.StyledProperty<bool> IsSelectionEnabledProperty

ItemsSourceProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.ItemsSource Avalonia property.

public Avalonia.StyledProperty<System.Collections.IEnumerable> ItemsSourceProperty

LabelForegroundProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.LabelForeground Avalonia property.

public Avalonia.StyledProperty<Avalonia.Media.IBrush> LabelForegroundProperty

LabelPathProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.LabelPath Avalonia property.

public Avalonia.StyledProperty<string> LabelPathProperty

LegendProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.Legend Avalonia property.

public Avalonia.StyledProperty<Avalonia.Controls.Charts.MapLegend> LegendProperty

LowBrushProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.LowBrush Avalonia property.

public Avalonia.StyledProperty<Avalonia.Media.IBrush> LowBrushProperty

MaxValueProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.MaxValue Avalonia property.

public Avalonia.StyledProperty<double> MaxValueProperty

MinValueProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.MinValue Avalonia property.

public Avalonia.StyledProperty<double> MinValueProperty

RegionPathProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.RegionPath Avalonia property.

public Avalonia.StyledProperty<string> RegionPathProperty

SelectedItemProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.SelectedItem Avalonia property.

public Avalonia.StyledProperty<object> SelectedItemProperty

SelectedItemsProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.SelectedItems Avalonia property.

public Avalonia.StyledProperty<System.Collections.IList> SelectedItemsProperty

SelectionBrushProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.SelectionBrush Avalonia property.

public Avalonia.StyledProperty<Avalonia.Media.IBrush> SelectionBrushProperty

SelectionModeProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.SelectionMode Avalonia property.

public Avalonia.StyledProperty<Avalonia.Controls.Charts.ChartSelectionMode> SelectionModeProperty

SelectionStrokeProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.SelectionStroke Avalonia property.

public Avalonia.StyledProperty<Avalonia.Media.IBrush> SelectionStrokeProperty

SelectionStrokeThicknessProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.SelectionStrokeThickness Avalonia property.

public Avalonia.StyledProperty<double> SelectionStrokeThicknessProperty

ShowLabelsProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.ShowLabels Avalonia property.

public Avalonia.StyledProperty<bool> ShowLabelsProperty

SourceProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.Source Avalonia property.

public Avalonia.StyledProperty<Uri> SourceProperty

StrokeProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.Stroke Avalonia property.

public Avalonia.StyledProperty<Avalonia.Media.IBrush> StrokeProperty

StrokeThicknessProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.StrokeThickness Avalonia property.

public Avalonia.StyledProperty<double> StrokeThicknessProperty

ValuePathProperty Field​

Identifies the Avalonia.Controls.Charts.ShapeLayer.ValuePath Avalonia property.

public Avalonia.StyledProperty<string> ValuePathProperty

Events​

NameDescription
InvalidatedEvent raised when the layer needs to be redrawn. Inherited from MapLayer.
PropertyChangedRaised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject.
SelectionChangedOccurs when selection changes.
SelectionChangingOccurs before selection changes.

SelectionChanged Event​

Occurs when selection changes.

public event EventHandler<Avalonia.Controls.Charts.ChartSelectionChangedEventArgs> SelectionChanged

SelectionChanging Event​

Occurs before selection changes.

public event EventHandler<Avalonia.Controls.Charts.ChartSelectionChangingEventArgs> SelectionChanging