Class ChartBase
ChartBase is a base class for chart. Which represents a chart control with basic presentation characteristics.
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.WPF.dll
Syntax
public abstract class ChartBase : Control, ICloneable, INotifyPropertyChanged
Constructors
ChartBase()
Declaration
protected ChartBase()
Fields
AxisThicknessProperty
The DependencyProperty for AxisThickness property.
Declaration
public static readonly DependencyProperty AxisThicknessProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ChartResourceDictionaryProperty
The Dependency property for Syncfusion.UI.Xaml.Charts.ChartBase.ChartResourceDictionary
Declaration
public static readonly DependencyProperty ChartResourceDictionaryProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ColorModelProperty
The DependencyProperty for ColorModel property.
Declaration
public static readonly DependencyProperty ColorModelProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ColumnProperty
The DependencyProperty for
Declaration
public static readonly DependencyProperty ColumnProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ColumnSpanProperty
The DependencyProperty for
Declaration
public static readonly DependencyProperty ColumnSpanProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
HeaderProperty
The DependencyProperty for Header property.
Declaration
public static readonly DependencyProperty HeaderProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
HorizontalHeaderAlignmentProperty
The DependencyProperty for HorizontalHeaderAlignment property.
Declaration
public static readonly DependencyProperty HorizontalHeaderAlignmentProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
LegendProperty
The DependencyProperty for Legend property.
Declaration
public static readonly DependencyProperty LegendProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
PaletteProperty
The DependencyProperty for Palette property.
Declaration
public static readonly DependencyProperty PaletteProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Printing
Declaration
protected Printing Printing
Field Value
Type |
---|
Printing |
RowProperty
The DependencyProperty for
Declaration
public static readonly DependencyProperty RowProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
RowSpanProperty
The DependencyProperty for
Declaration
public static readonly DependencyProperty RowSpanProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SeriesSelectedIndexProperty
The DependencyProperty for SeriesSelectedIndex property.
Declaration
public static readonly DependencyProperty SeriesSelectedIndexProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
SideBySideSeriesPlacementProperty
The DependencyProperty for SideBySideSeriesPlacement property.
Declaration
public static readonly DependencyProperty SideBySideSeriesPlacementProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
VerticalHeaderAlignmentProperty
The DependencyProperty for VerticalHeaderAlignment property.
Declaration
public static readonly DependencyProperty VerticalHeaderAlignmentProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
VisibleSeriesProperty
The DependencyProperty for VisibleSeries property.
Declaration
public static readonly DependencyProperty VisibleSeriesProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Properties
Axes
Gets the collection of horizontal and vertical axis.
Declaration
public ChartAxisCollection Axes { get; }
Property Value
Type |
---|
ChartAxisCollection |
AxisThickness
Gets or sets thickness to the axis.
Declaration
public Thickness AxisThickness { get; }
Property Value
Type |
---|
System.Windows.Thickness |
ColorModel
Gets or sets the color schemes for all series in the chart.
Declaration
public ChartColorModel ColorModel { get; set; }
Property Value
Type | Description |
---|---|
ChartColorModel |
ColumnDefinitions
Gets or sets the collection of ChartColumnDefinition objects defined in the chart.
Declaration
public ChartColumnDefinitions ColumnDefinitions { get; set; }
Property Value
Type |
---|
ChartColumnDefinitions |
Header
Gets or sets title for the chart.
Declaration
public object Header { get; set; }
Property Value
Type |
---|
System.Object |
HorizontalHeaderAlignment
Gets or sets the horizontal alignment for the header.
Declaration
public HorizontalAlignment HorizontalHeaderAlignment { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.HorizontalAlignment | System.Windows.HorizontalAlignment |
Legend
Gets or sets a legend that helps to identify the series in the chart.
Declaration
public object Legend { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The legend. |
Palette
Gets or sets palette for chart. By default, it is Metro.
Declaration
public ChartColorPalette Palette { get; set; }
Property Value
Type | Description |
---|---|
ChartColorPalette |
RowDefinitions
Gets or sets the collection of ChartRowDefinition objects defined in chart.
Declaration
public ChartRowDefinitions RowDefinitions { get; set; }
Property Value
Type |
---|
ChartRowDefinitions |
SelectedSegments
Gets the selected segments in this series, when we enable the multiple selection.
Declaration
protected virtual List<ChartSegment> SelectedSegments { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<ChartSegment> | It returns list of ChartSegment. |
SeriesClipRect
Gets a bounds of chart area excluding axis and chart header.
Declaration
public Rect SeriesClipRect { get; }
Property Value
Type |
---|
System.Windows.Rect |
SeriesSelectedIndex
Gets or sets the index to select the series.
Declaration
public int SeriesSelectedIndex { get; set; }
Property Value
Type |
---|
System.Int32 |
SideBySideSeriesPlacement
Gets or sets the value that indicates whether the series can be placed side by side.
Declaration
public bool SideBySideSeriesPlacement { get; set; }
Property Value
Type |
---|
System.Boolean |
VerticalHeaderAlignment
Gets or sets the vertical alignment for the header.
Declaration
public VerticalAlignment VerticalHeaderAlignment { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.VerticalAlignment | System.Windows.VerticalAlignment |
VisibleSeries
Gets the collection of visible series in the chart.
Declaration
public ChartVisibleSeriesCollection VisibleSeries { get; }
Property Value
Type |
---|
ChartVisibleSeriesCollection |
Remarks
This property is intended to be used for custom
Methods
Clone()
Clone the entire chart control.
Declaration
public DependencyObject Clone()
Returns
Type |
---|
System.Windows.DependencyObject |
Deserialize()
Method used to deserialize the serialized file.
Declaration
public object Deserialize()
Returns
Type |
---|
System.Object |
Deserialize(Stream)
Method used to deserialize the serialized file.
Declaration
public object Deserialize(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Used to specify stream value. |
Returns
Type | Description |
---|---|
System.Object | The deserialized object from the stream. |
Deserialize(String)
Method used to deserialize the serialized file.
Declaration
public object Deserialize(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Used to specify file name. |
Returns
Type | Description |
---|---|
System.Object | The deserialized object. |
GetColumn(UIElement)
Get the column value from the given ChartAxis.
Declaration
public static int GetColumn(UIElement obj)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | obj | The UIElement. |
Returns
Type | Description |
---|---|
System.Int32 | Column value of given object. |
GetColumnSpan(UIElement)
Gets the value of the Syncfusion.UI.Xaml.Charts.ColumnSpan attached property from a given UIElement.
Declaration
public static int GetColumnSpan(UIElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | element | The element from which to read the property value. |
Returns
Type | Description |
---|---|
System.Int32 | The value of the Syncfusion.UI.Xaml.Charts.ColumnSpan attached property. |
GetCumulativeStackInfo(ChartSeriesBase, Boolean)
Returns the stacked value of the series.
Declaration
public List<double> GetCumulativeStackInfo(ChartSeriesBase series, bool reqNegStack)
Parameters
Type | Name | Description |
---|---|---|
ChartSeriesBase | series | ChartSeries |
System.Boolean | reqNegStack | RequiresNegativeStack |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Double> | StackedYValues collection. |
GetRow(UIElement)
Return row value from the given ChartAxis.
Declaration
public static int GetRow(UIElement obj)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | obj | The UIElement. |
Returns
Type | Description |
---|---|
System.Int32 | Row value of given object. |
GetRowSpan(UIElement)
Gets the value of the Syncfusion.UI.Xaml.Charts.RowSpan attached property from a given UIElement.
Declaration
public static int GetRowSpan(UIElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | element | The element from which to read the property value. |
Returns
Type | Description |
---|---|
System.Int32 | The value of the Syncfusion.UI.Xaml.Charts.RowSpan attached property. |
OnBoxSelectionChanged(ChartSelectionChangedEventArgs)
Called when selection changed in SfChart.
Declaration
protected virtual void OnBoxSelectionChanged(ChartSelectionChangedEventArgs eventArgs)
Parameters
Type | Name | Description |
---|---|---|
ChartSelectionChangedEventArgs | eventArgs | ChartSelectionChangedEventArgs. |
OnRootPanelSizeChanged(Size)
Called when root panel size changed.
Declaration
protected virtual void OnRootPanelSizeChanged(Size size)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | size | The size. |
OnSelectionChanged(ChartSelectionChangedEventArgs)
Called when selection changed in SfChart.
Declaration
protected virtual void OnSelectionChanged(ChartSelectionChangedEventArgs eventArgs)
Parameters
Type | Name | Description |
---|---|---|
ChartSelectionChangedEventArgs | eventArgs | ChartSelectionChangedEventArgs. |
OnSelectionChanging(ChartSelectionChangingEventArgs)
It's a preview event before SelectionChanged.
Declaration
protected virtual void OnSelectionChanging(ChartSelectionChangingEventArgs eventArgs)
Parameters
Type | Name | Description |
---|---|---|
ChartSelectionChangingEventArgs | eventArgs | ChartSelectionChangingEventArgs |
OnSeriesBoundsChanged(ChartSeriesBoundsEventArgs)
Event invokes when the plot area size changed.
Declaration
protected virtual void OnSeriesBoundsChanged(ChartSeriesBoundsEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
ChartSeriesBoundsEventArgs | args | Which indicates ChartSeriesBoundsEventArgs. |
PointToValue(ChartAxis, Point)
Converts screen point to chart value.
Declaration
public virtual double PointToValue(ChartAxis axis, Point point)
Parameters
Type | Name | Description |
---|---|---|
ChartAxis | axis | The axis value. |
System.Windows.Point | point | The point. |
Returns
Type | Description |
---|---|
System.Double | The double point to value. |
Print()
Method used to print the chart.
Declaration
public void Print()
Print(HorizontalAlignment, VerticalAlignment, Thickness, Boolean, Boolean)
Method used to print the chart.
Declaration
public void Print(HorizontalAlignment HorizontalAlignment, VerticalAlignment VerticalAlignment, Thickness PageMargin, bool PrintLandscape, bool ShrinkToFit)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.HorizontalAlignment | HorizontalAlignment | Used to specify horizontal alignment. |
System.Windows.VerticalAlignment | VerticalAlignment | Used to specify vertical alignment. |
System.Windows.Thickness | PageMargin | Used to specify page margin. |
System.Boolean | PrintLandscape | Used to specify whether print landscape mode or not. |
System.Boolean | ShrinkToFit | Used to specify shrinktofit or not. |
ResumeSeriesNotification()
Processes the data that is added to the data source after the SuspendSeriesNotification is called.
Declaration
public void ResumeSeriesNotification()
Save(Stream, BitmapEncoder)
Export the SfChart into image using the stream with provided bitmap encoder value.
Declaration
public void Save(Stream stream, BitmapEncoder imgEncoder)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
System.Windows.Media.Imaging.BitmapEncoder | imgEncoder |
Examples
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite);
{
chart.Save(stream, BitmapEncoder.BmpEncoderId);
}
Save(String)
Export the SfChart into image with the given filename to the mentioned location.
Declaration
public void Save(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName |
Examples
chart.Save("sfchart.jpg", //..KnownFolders.PicturesLibrary);
Serialize()
Method used to serialize the chart.
Declaration
public void Serialize()
Serialize(Stream)
Method used to generate a serialize the stream in default location.
Declaration
public void Serialize(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Used to specify stream value. |
Serialize(String)
Method used to generate a serialize file in default location.
Declaration
public void Serialize(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Used to specify file name. |
SeriesSelectedIndexChanged(Int32, Int32)
Method used to highlight selected index series.
Declaration
public virtual void SeriesSelectedIndexChanged(int newIndex, int oldIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | newIndex | Used to indicate current selected index. |
System.Int32 | oldIndex | Used to indicate previous selected index. |
SetColumn(UIElement, Int32)
Set column to ChartAxis.
Declaration
public static void SetColumn(UIElement obj, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | obj | The UIElement. |
System.Int32 | value | Column value of the object. |
SetColumnSpan(UIElement, Int32)
Sets the value of the Syncfusion.UI.Xaml.Charts.ColumnSpan attached property to a given UIElement.
Declaration
public static void SetColumnSpan(UIElement element, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | element | The element on which to set the Syncfusion.UI.Xaml.Charts.ColumnSpan attached property. |
System.Int32 | value | The property value to set. |
SetRow(UIElement, Int32)
Method implementation for set row value to ChartAxis.
Declaration
public static void SetRow(UIElement obj, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | obj | The UIElement. |
System.Int32 | value | Row value of the object. |
SetRowSpan(UIElement, Int32)
Sets the value of the Syncfusion.UI.Xaml.Charts.RowSpan attached property to a given UIElement.
Declaration
public static void SetRowSpan(UIElement element, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | element | The element on which to set the Syncfusion.UI.Xaml.Charts.RowSpan attached property. |
System.Int32 | value | The property value to set. |
SuspendSeriesNotification()
Suspends all the series from updating the data till ResumeSeriesNotification is called. It is specifically used when you need to append the collection of data.
Declaration
public void SuspendSeriesNotification()
ValueToPoint(ChartAxis, Double)
Converts the chart value to screen point.
Declaration
public virtual double ValueToPoint(ChartAxis axis, double value)
Parameters
Type | Name | Description |
---|---|---|
ChartAxis | axis | The Chart axis. |
System.Double | value | The value. |
Returns
Type | Description |
---|---|
System.Double | The double value to point. |
Events
OnPrinting
Declaration
public event OnPrintingEventHandler OnPrinting
Event Type
Type |
---|
OnPrintingEventHandler |
PropertyChanged
Event correspond to property value changed. It invokes when the ChartBase properties changed.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type |
---|
System.ComponentModel.PropertyChangedEventHandler |
SelectionChanged
Event correspond to series and segment selection. It invokes once selection changed from a series or segment.
Declaration
public event EventHandler<ChartSelectionChangedEventArgs> SelectionChanged
Event Type
Type |
---|
System.EventHandler<ChartSelectionChangedEventArgs> |
Remarks
SelectionChanging
Event correspond to series and segment selection. It invokes before selection changing from a series or segment.
Declaration
public event EventHandler<ChartSelectionChangingEventArgs> SelectionChanging
Event Type
Type |
---|
System.EventHandler<ChartSelectionChangingEventArgs> |
Remarks
SeriesBoundsChanged
Event correspond to plot area bound. It invokes when the plot area size changes.
Declaration
public event EventHandler<ChartSeriesBoundsEventArgs> SeriesBoundsChanged
Event Type
Type |
---|
System.EventHandler<ChartSeriesBoundsEventArgs> |