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 | Description |
---|---|
System.Windows.DependencyProperty |
ColorModelProperty
The DependencyProperty for ColorModel property.
Declaration
public static readonly DependencyProperty ColorModelProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
ColumnProperty
The DependencyProperty for
Declaration
public static readonly DependencyProperty ColumnProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
ColumnSpanProperty
The DependencyProperty for
Declaration
public static readonly DependencyProperty ColumnSpanProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
HeaderProperty
The DependencyProperty for Header property.
Declaration
public static readonly DependencyProperty HeaderProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
HorizontalHeaderAlignmentProperty
The DependencyProperty for HorizontalHeaderAlignment property.
Declaration
public static readonly DependencyProperty HorizontalHeaderAlignmentProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
LegendProperty
The DependencyProperty for Legend property.
Declaration
public static readonly DependencyProperty LegendProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
PaletteProperty
The DependencyProperty for Palette property.
Declaration
public static readonly DependencyProperty PaletteProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
Printing
Declaration
protected Printing Printing
Field Value
Type | Description |
---|---|
Printing |
RowProperty
The DependencyProperty for
Declaration
public static readonly DependencyProperty RowProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
RowSpanProperty
The DependencyProperty for
Declaration
public static readonly DependencyProperty RowSpanProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
SeriesSelectedIndexProperty
The DependencyProperty for SeriesSelectedIndex property.
Declaration
public static readonly DependencyProperty SeriesSelectedIndexProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
SideBySideSeriesPlacementProperty
The DependencyProperty for SideBySideSeriesPlacement property.
Declaration
public static readonly DependencyProperty SideBySideSeriesPlacementProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
VerticalHeaderAlignmentProperty
The DependencyProperty for VerticalHeaderAlignment property.
Declaration
public static readonly DependencyProperty VerticalHeaderAlignmentProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
VisibleSeriesProperty
The DependencyProperty for VisibleSeries property.
Declaration
public static readonly DependencyProperty VisibleSeriesProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
Properties
Axes
Gets the collection of horizontal and vertical axis.
Declaration
public ChartAxisCollection Axes { get; }
Property Value
Type | Description |
---|---|
ChartAxisCollection |
AxisThickness
Gets or sets thickness to the axis
Declaration
public Thickness AxisThickness { get; }
Property Value
Type | Description |
---|---|
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 Chart.
Declaration
public ChartColumnDefinitions ColumnDefinitions { get; set; }
Property Value
Type | Description |
---|---|
ChartColumnDefinitions |
Header
Gets or sets title for the chart.
Declaration
public object Header { get; set; }
Property Value
Type | Description |
---|---|
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 ChartPalette. 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 | Description |
---|---|
ChartRowDefinitions |
SelectedSegments
Declaration
protected virtual List<ChartSegment> SelectedSegments { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<ChartSegment> |
SeriesClipRect
Gets a bounding rectangle of chart excluding axis and chart header.
Declaration
public Rect SeriesClipRect { get; }
Property Value
Type | Description |
---|---|
System.Windows.Rect |
SeriesSelectedIndex
Gets or sets the index to select the series.
Declaration
public int SeriesSelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
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 | Description |
---|---|
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 visible series of chart area.
Declaration
public ChartVisibleSeriesCollection VisibleSeries { get; }
Property Value
Type | Description |
---|---|
ChartVisibleSeriesCollection |
Remarks
This property is intended to be used for custom
Methods
Clone()
Clone the entire chart control
Declaration
public DependencyObject Clone()
Returns
Type | Description |
---|---|
System.Windows.DependencyObject |
Deserialize()
Method used to deserialize the serialized file
Declaration
public object Deserialize()
Returns
Type | Description |
---|---|
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 |
Returns
Type | Description |
---|---|
System.Object |
Deserialize(String)
Method used to deserialize the serialized file
Declaration
public object Deserialize(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName |
Returns
Type | Description |
---|---|
System.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 |
Returns
Type | Description |
---|---|
System.Int32 |
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 int value from the given ChartAxis
Declaration
public static int GetRow(UIElement obj)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | obj |
Returns
Type | Description |
---|---|
System.Int32 |
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 |
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 |
OnSelectionChanging(ChartSelectionChangingEventArgs)
It's a preview event before SelectionChanged.
Declaration
protected virtual void OnSelectionChanging(ChartSelectionChangingEventArgs eventArgs)
Parameters
Type | Name | Description |
---|---|---|
ChartSelectionChangingEventArgs | eventArgs |
OnSeriesBoundsChanged(ChartSeriesBoundsEventArgs)
Declaration
protected virtual void OnSeriesBoundsChanged(ChartSeriesBoundsEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
ChartSeriesBoundsEventArgs | args |
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()
Declaration
public void Print()
Print(HorizontalAlignment, VerticalAlignment, Thickness, Boolean, Boolean)
Declaration
public void Print(HorizontalAlignment HorizontalAlignment, VerticalAlignment VerticalAlignment, Thickness PageMargin, bool PrintLandscape, bool ShrinkToFit)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.HorizontalAlignment | HorizontalAlignment | |
System.Windows.VerticalAlignment | VerticalAlignment | |
System.Windows.Thickness | PageMargin | |
System.Boolean | PrintLandscape | |
System.Boolean | ShrinkToFit |
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)
Declaration
public void Serialize(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream |
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 |
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 | |
System.Int32 | oldIndex |
SetColumn(UIElement, Int32)
Set column to ChartAxis
Declaration
public static void SetColumn(UIElement obj, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | obj | |
System.Int32 | value |
SetColumnSpan(UIElement, Int32)
Declaration
public static void SetColumnSpan(UIElement element, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | element | |
System.Int32 | value |
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 | |
System.Int32 | value |
SetRowSpan(UIElement, Int32)
Declaration
public static void SetRowSpan(UIElement element, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | element | |
System.Int32 | value |
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 | Description |
---|---|
OnPrintingEventHandler |
PropertyChanged
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type | Description |
---|---|
System.ComponentModel.PropertyChangedEventHandler |
SelectionChanged
Event correspond to series selection. It invokes once selection changed from a series.
Declaration
public event EventHandler<ChartSelectionChangedEventArgs> SelectionChanged
Event Type
Type | Description |
---|---|
System.EventHandler<ChartSelectionChangedEventArgs> |
Remarks
SelectionChanging
Event correspond to series selection. It invokes before selection changing from a series.
Declaration
public event EventHandler<ChartSelectionChangingEventArgs> SelectionChanging
Event Type
Type | Description |
---|---|
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 | Description |
---|---|
System.EventHandler<ChartSeriesBoundsEventArgs> |