In This Article

XYChart Class

Represents a chart control that uses an X/Y coordinate system.

[StyleTypedProperty(Property = "AxisBaselineStyle", StyleTargetType = typeof(Shape))]
[StyleTypedProperty(Property = "LegendStyle", StyleTargetType = typeof(ItemsControl))]
[TemplatePart(Name = "PART_ChartPanel", Type = typeof(ChartPanel))]
public class XYChart : Control
Inheritance:
object Visual UIElement FrameworkElement Control object

Constructors

XYChart()

Initializes an instance of the class.

public XYChart()

Properties

AxisBaselineStyle

A Style which is applied to the Shape element used to render the baseline along the chart.

public Style? AxisBaselineStyle { get; set; }

Property Value

Style:

The default value is null.

GridLineMajorBrush

The grid line major brush.

public Brush? GridLineMajorBrush { get; set; }

Property Value

Brush

GridLineMajorVisibility

The grid line major visibility.

public GridLineVisibility GridLineMajorVisibility { get; set; }

Property Value

GridLineVisibility

GridLineMinorBrush

The grid line minor brush.

public Brush? GridLineMinorBrush { get; set; }

Property Value

Brush

GridLineMinorVisibility

The grid line minor visibility.

public GridLineVisibility GridLineMinorVisibility { get; set; }

Property Value

GridLineVisibility

GridStripeAlternatingBrush

The grid stripe alternating brush.

public Brush? GridStripeAlternatingBrush { get; set; }

Property Value

Brush

GridStripeBrush

The grid stripe brush.

public Brush? GridStripeBrush { get; set; }

Property Value

Brush

GridStripeVisibility

The grid stripe visibility.

public GridStripeVisibility GridStripeVisibility { get; set; }

Property Value

GridStripeVisibility

IsAxisBaselineVisible

Indicates whether a line is rendered at the baseline value.

public bool IsAxisBaselineVisible { get; set; }

Property Value

bool:

The default value is false.

IsLegendVisible

Indicates whether the legend is visible.

public bool IsLegendVisible { get; set; }

Property Value

bool:

The default value is false.

LabelCollisionMode

The label collision mode.

public LabelCollisionMode LabelCollisionMode { get; set; }

Property Value

LabelCollisionMode

LegendHorizontalPosition

The horizontal position of the legend. Inside positions will place the legend inside the chart itself. Outside positions will place the legend relative to the entire control, including axes and titles.

public LegendHorizontalPosition LegendHorizontalPosition { get; set; }

Property Value

LegendHorizontalPosition

LegendKeys

The collection of legend keys displayed in the legend.

public ObservableCollection<LegendKey> LegendKeys { get; }

Property Value

ObservableCollection<LegendKey>

LegendStyle

The Style applied to the legend. The Style must have a TargetType of ItemsControl.

public Style? LegendStyle { get; set; }

Property Value

Style

LegendVerticalPosition

The vertical position of the legend. Inside positions will place the legend inside the chart itself. Outside positions will place the legend relative to the entire control, including axes and titles.

public LegendVerticalPosition LegendVerticalPosition { get; set; }

Property Value

LegendVerticalPosition

PaddingPercentage

The percentage of the chart size used for padding. Valid values are 0.0d (0%) to 1.0d (100%).

public Thickness PaddingPercentage { get; set; }

Property Value

Thickness

Series

The collection of series displayed by this chart.

public XYSeriesCollection Series { get; }

Property Value

XYSeriesCollection

SeriesStyleSelector

Custom style-selection logic for a style that can be applied to each element in the associated series.

public ISeriesStyleSelector SeriesStyleSelector { get; set; }

Property Value

ISeriesStyleSelector:

The default value is null.

XAxes

The collection of X axes displayed by this chart.

public XYAxisCollection XAxes { get; }

Property Value

XYAxisCollection

YAxes

The collection of Y axes displayed by this chart.

public XYAxisCollection YAxes { get; }

Property Value

XYAxisCollection

Methods

ArrangeOverride(Size)

Called to arrange and size the content of a Control object.

protected override Size ArrangeOverride(Size finalSize)
Parameter Type Description
finalSize Size

Returns

Size:

The size of the control.

MeasureOverride(Size)

Called to remeasure a control.

protected override Size MeasureOverride(Size availableSize)
Parameter Type Description
availableSize Size

Returns

Size:

The size of the control, up to the maximum specified by constraint.

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnCreateAutomationPeer()

Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The type-specific AutomationPeer implementation.

OnMouseLeave(MouseEventArgs)

Invoked when an unhandled System.Windows.Input.Mouse.MouseLeave attached event is raised on this element. Implement this method to add class handling for this event.

protected override void OnMouseLeave(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

The MouseEventArgs that contains the event data.

OnMouseMove(MouseEventArgs)

Invoked when an unhandled System.Windows.Input.Mouse.MouseMove attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected override void OnMouseMove(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

The MouseEventArgs that contains the event data.

Refresh()

Updates the chart based on the current state.

public void Refresh()

Fields

AxisBaselineStyleProperty

Defines the AxisBaselineStyle property.

public static readonly DependencyProperty AxisBaselineStyleProperty

GridLineMajorBrushProperty

Defines the GridLineMajorBrush property.

public static readonly DependencyProperty GridLineMajorBrushProperty

GridLineMajorVisibilityProperty

Defines the GridLineMajorVisibility property.

public static readonly DependencyProperty GridLineMajorVisibilityProperty

GridLineMinorBrushProperty

Defines the GridLineMinorBrush property.

public static readonly DependencyProperty GridLineMinorBrushProperty

GridLineMinorVisibilityProperty

Defines the GridLineMinorVisibility property.

public static readonly DependencyProperty GridLineMinorVisibilityProperty

GridStripeAlternatingBrushProperty

Defines the GridStripeAlternatingBrush property.

public static readonly DependencyProperty GridStripeAlternatingBrushProperty

GridStripeBrushProperty

Defines the GridStripeBrush property.

public static readonly DependencyProperty GridStripeBrushProperty

GridStripeVisibilityProperty

Defines the GridStripeVisibility property.

public static readonly DependencyProperty GridStripeVisibilityProperty

IsAxisBaselineVisibleProperty

Defines the IsAxisBaselineVisible property.

public static readonly DependencyProperty IsAxisBaselineVisibleProperty

IsLegendVisibleProperty

Defines the IsLegendVisible property.

public static readonly DependencyProperty IsLegendVisibleProperty

LabelCollisionModeProperty

Defines the LabelCollisionMode property.

public static readonly DependencyProperty LabelCollisionModeProperty

LegendHorizontalPositionProperty

Defines the LegendHorizontalPosition property.

public static readonly DependencyProperty LegendHorizontalPositionProperty

LegendStyleProperty

Defines the LegendStyle property.

public static readonly DependencyProperty LegendStyleProperty

LegendVerticalPositionProperty

Defines the LegendVerticalPosition property.

public static readonly DependencyProperty LegendVerticalPositionProperty

PaddingPercentageProperty

Defines the PaddingPercentage property.

public static readonly DependencyProperty PaddingPercentageProperty

SeriesStyleSelectorProperty

Defines the SeriesStyleSelector property.

public static readonly DependencyProperty SeriesStyleSelectorProperty

Extension Methods