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 a new instance of the XYChart class.

public XYChart()

Properties

AxisBaselineStyle

Gets or sets a Style, which is applied to the Shape element used to render the baseline along the chart. This is a dependency property.

public Style AxisBaselineStyle { get; set; }

Property Value

Style:

A Style, which is applied to the Shape element used to render the baseline along the chart. The default value is null.

GridLineMajorBrush

Gets or sets the grid line major brush.

public Brush GridLineMajorBrush { get; set; }

Property Value

Brush:

The grid line major brush.

GridLineMajorVisibility

Gets or sets the grid line major visibility.

public GridLineVisibility GridLineMajorVisibility { get; set; }

Property Value

GridLineVisibility:

The grid line major visibility.

GridLineMinorBrush

Gets or sets the grid line minor brush.

public Brush GridLineMinorBrush { get; set; }

Property Value

Brush:

The grid line minor brush.

GridLineMinorVisibility

Gets or sets the grid line minor visibility.

public GridLineVisibility GridLineMinorVisibility { get; set; }

Property Value

GridLineVisibility:

The grid line minor visibility.

GridStripeAlternatingBrush

Gets or sets the grid stripe alternating brush.

public Brush GridStripeAlternatingBrush { get; set; }

Property Value

Brush:

The grid stripe alternating brush.

GridStripeBrush

Gets or sets the grid stripe brush.

public Brush GridStripeBrush { get; set; }

Property Value

Brush:

The grid stripe brush.

GridStripeVisibility

Gets or sets the grid stripe visibility.

public GridStripeVisibility GridStripeVisibility { get; set; }

Property Value

GridStripeVisibility:

The grid stripe visibility.

IsAxisBaselineVisible

Gets or sets a value indicating whether a line is rendered at the baseline value. This is a dependency property.

public bool IsAxisBaselineVisible { get; set; }

Property Value

bool:

true if a line is rendered at the baseline value; otherwise, false. The default value is false.

IsLegendVisible

Gets or sets a value indicating whether the legend is visible. This is a dependency property.

public bool IsLegendVisible { get; set; }

Property Value

bool:

true if the legend is visible; otherwise, false. The default value is false.

LabelCollisionMode

Gets or sets the label collision mode.

public LabelCollisionMode LabelCollisionMode { get; set; }

Property Value

LabelCollisionMode:

The label collision mode.

LegendHorizontalPosition

Gets or sets 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:

The horizontal position of the legend.

LegendKeys

Gets the collection of legend keys displayed in the legend.

public ObservableCollection<LegendKey> LegendKeys { get; }

Property Value

ObservableCollection<LegendKey>:

The collection of legend keys.

LegendStyle

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

public Style LegendStyle { get; set; }

Property Value

Style:

The style to apply to the legend.

LegendVerticalPosition

Gets or sets 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:

The vertical position of the legend.

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

Gets the collection of series displayed by this chart.

public XYSeriesCollection Series { get; }

Property Value

XYSeriesCollection:

The collection of series displayed by this chart.

SeriesStyleSelector

Gets or sets custom style-selection logic for a style that can be applied to each element in the associated series. This is a dependency property.

public ISeriesStyleSelector SeriesStyleSelector { get; set; }

Property Value

ISeriesStyleSelector:

A SeriesStyleSelector object that contains logic that chooses the style to use for each element in the associated series. The default value is null.

XAxes

Gets the collection of X axes displayed by this chart.

public XYAxisCollection XAxes { get; }

Property Value

XYAxisCollection

YAxes

Gets the collection of Y axes displayed by this chart.

public XYAxisCollection YAxes { get; }

Property Value

XYAxisCollection

Methods

ArrangeOverride(Size)

Provides the behavior for the Arrange pass of Silverlight layout. Classes can override this method to define their own Arrange pass behavior.

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

The final area within the parent that this object should use to arrange itself and its children.

Returns

Size:

The actual size that is used after the element is arranged in layout.

MeasureOverride(Size)

Provides the behavior for the Measure pass of layout. Classes can override this method to define their own Measure pass behavior.

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

The available size that this object can give to child objects. Infinity (PositiveInfinity) can be specified as a value to indicate that the object will size to whatever content is available.

Returns

Size:

The size that this object determines it needs during layout, based on its calculations of the allocated sizes for child objects; or based on other considerations, such as a fixed container size.

OnApplyTemplate()

Invoked whenever application code or internal processes call ApplyTemplate.

public override void OnApplyTemplate()

OnCreateAutomationPeer()

When implemented in a derived class, returns class-specific AutomationPeer implementations for the UI Automation infrastructure.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The class-specific AutomationPeer subclass to return.

OnMouseLeave(MouseEventArgs)

Called before the mouse pointer exits the control.

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

Event data for the event.

OnMouseMove(MouseEventArgs)

Called before the mouse pointer is moved.

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

Event data for the event.

Refresh()

Updates the chart based on the current state.

public void Refresh()

Fields

AxisBaselineStyleProperty

Identifies the AxisBaselineStyle dependency property. This field is read-only.

public static readonly DependencyProperty AxisBaselineStyleProperty

GridLineMajorBrushProperty

Identifies the GridLineMinorBrush dependency property. This field is read-only.

public static readonly DependencyProperty GridLineMajorBrushProperty

GridLineMajorVisibilityProperty

Identifies the GridLineMajorVisibility dependency property. This field is read-only.

public static readonly DependencyProperty GridLineMajorVisibilityProperty

GridLineMinorBrushProperty

Identifies the GridLineMinorBrush dependency property. This field is read-only.

public static readonly DependencyProperty GridLineMinorBrushProperty

GridLineMinorVisibilityProperty

Identifies the GridLineMinorVisibility dependency property. This field is read-only.

public static readonly DependencyProperty GridLineMinorVisibilityProperty

GridStripeAlternatingBrushProperty

Identifies the GridStripeAlternatingBrush dependency property. This field is read-only.

public static readonly DependencyProperty GridStripeAlternatingBrushProperty

GridStripeBrushProperty

Identifies the GridStripeBrush dependency property. This field is read-only.

public static readonly DependencyProperty GridStripeBrushProperty

GridStripeVisibilityProperty

Identifies the GridStripeVisibility dependency property. This field is read-only.

public static readonly DependencyProperty GridStripeVisibilityProperty

IsAxisBaselineVisibleProperty

Identifies the IsAxisBaselineVisible dependency property. This field is read-only.

public static readonly DependencyProperty IsAxisBaselineVisibleProperty

IsLegendVisibleProperty

Identifies the IsLegendVisible dependency property. This field is read-only.

public static readonly DependencyProperty IsLegendVisibleProperty

LabelCollisionModeProperty

Identifies the LabelCollisionMode dependency property. This field is read-only.

public static readonly DependencyProperty LabelCollisionModeProperty

LegendHorizontalPositionProperty

Identifies the LegendHorizontalPosition dependency property. This field is read-only.

public static readonly DependencyProperty LegendHorizontalPositionProperty

LegendStyleProperty

Identifies the LegendStyle dependency property. This field is read-only.

public static readonly DependencyProperty LegendStyleProperty

LegendVerticalPositionProperty

Identifies the LegendVerticalPosition dependency property. This field is read-only.

public static readonly DependencyProperty LegendVerticalPositionProperty

PaddingPercentageProperty

Identifies the PaddingPercentage dependency property. This field is read-only.

public static readonly DependencyProperty PaddingPercentageProperty

SeriesStyleSelectorProperty

Identifies the SeriesStyleSelector dependency property. This field is read-only.

public static readonly DependencyProperty SeriesStyleSelectorProperty