ShapeLayer Class
Definition
A shape layer that renders GeoJSON data as geographic shapes.
public class ShapeLayer
Constructors
| Name | Description |
|---|---|
| ShapeLayer | Initializes 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
| Name | Description |
|---|---|
| ClearSelection | Clears the current selection. |
| GetFeatureData | Resolves the backing data item or fallback property map for a feature. |
| GetFeaturesAt | Returns the features hit by the specified chart-space point. |
| GetLayerBounds | 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. |
| GetPointData | Gets the data item at the specified screen point. |
| IsItemSelected | Checks whether the specified item is selected. |
| OnPointerExited | Handles pointer exited events. Override this method to handle interactions (e.g. clearing hover effects). |
| OnPointerMoved | Handles pointer moved events. Override this method to handle interactions (e.g. hover effects). |
| OnPointerPressed | Handles pointer pressed events. Override this method to handle interactions (e.g. selection). |
| Render | Renders this layer to the drawing context. |
| TrySelectItem | Attempts to select the specified item. |
| Bind (8 overloads) | Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject. |
| CheckAccess | Returns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject. |
| ClearValue (4 overloads) | Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject. |
| CoerceValue | Coerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject. |
| Equals | Compares two objects using reference equality. Inherited from AvaloniaObject. |
| GetBaseValue | Inherited from AvaloniaObject. |
| GetHashCode | Gets the hash code for the object. Inherited from AvaloniaObject. |
| GetValue (3 overloads) | Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject. |
| IsAnimating | Checks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject. |
| IsSet | Checks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject. |
| 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. |
| VerifyAccess | Checks 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
| Name | Description |
|---|---|
| ColorMappings | Gets or sets the collection of color mappings for shapes. |
| GeoJson | Gets or sets the GeoJSON string data. |
| GeoJsonIdPath | Gets or sets the property name in GeoJSON to use as a unique identifier. |
| HighBrush | Gets or sets the brush for the highest data values. |
| HoverBrush | Gets or sets the brush applied when hovering over a region. |
| IsSelectionEnabled | Gets or sets whether selection is enabled for map regions. |
| ItemsSource | Gets or sets the data collection to bind to map regions. |
| LabelForeground | Gets or sets the foreground brush for data labels. |
| LabelPath | Gets or sets the property path for data label text. |
| Legend | Gets or sets the legend associated with this layer. |
| LowBrush | Gets or sets the brush for the lowest data values. |
| MaxValue | Gets or sets the maximum value for color normalization. |
| MinValue | Gets or sets the minimum value for color normalization. |
| RegionPath | Gets or sets the property path in Avalonia.Controls.Charts.ShapeLayer.ItemsSource that matches GeoJSON identifiers. |
| SelectedItem | Gets or sets the currently selected data item. |
| SelectedItems | Gets or sets the collection of selected data items. |
| SelectionBrush | Gets or sets the brush used for selected regions. |
| SelectionMode | Gets or sets the selection mode. |
| SelectionStroke | Gets or sets the stroke brush used to outline selected regions. |
| SelectionStrokeThickness | Gets or sets the stroke thickness for selected regions. |
| ShowLabels | Gets or sets whether to display data labels on regions. |
| Source | Gets or sets the URI source for GeoJSON data. |
| Stroke | Gets or sets the brush for shape outlines. |
| StrokeThickness | Gets or sets the thickness of shape outlines. |
| ValuePath | Gets or sets the property path in Avalonia.Controls.Charts.ShapeLayer.ItemsSource for region values. |
| IsVisible | Gets or sets whether this layer is visible. Inherited from MapLayer. |
| Opacity | Gets or sets the opacity of this layer. Inherited from MapLayer. |
| TooltipTemplate | Gets or sets the data template used for tooltips. Inherited from MapLayer. |
| Dispatcher | Returns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject. |
| Item | Inherited from AvaloniaObject. |
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
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
| Name | Description |
|---|---|
| SelectionChanged | Occurs when selection changes. |
| SelectionChanging | Occurs before selection changes. |
| Invalidated | Event raised when the layer needs to be redrawn. Inherited from MapLayer. |
| PropertyChanged | Raised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject. |
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