Class RadChart
RadChart is a powerful data visualization control that allows you to display various 2D and 3D chart series types. The control can be easily customized via control templates, provides databinding support, display animations out-of-the-box, and supports one or multiple ChartAreas in order to display multiple categories of data at the same time.
Inheritance
Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Controls.Charting.dll
Syntax
[TelerikToolboxCategory("Data Visualization")]
public class RadChart : ContentControl, IInteractionManager, IInteractiveElement, IThemable, ILogicalItem
Constructors
RadChart()
Fields
AnimationSettingsProperty
Identifies the AnimationSettings dependency property.
Declaration
public static readonly DependencyProperty AnimationSettingsProperty
Field Value
System.Windows.DependencyProperty
|
AxisElementBrushProperty
Identifies the AxisElementBrush dependency property.
Declaration
public static readonly DependencyProperty AxisElementBrushProperty
Field Value
System.Windows.DependencyProperty
|
AxisForegroundProperty
Identifies the AxisForeground dependency property.
Declaration
public static readonly DependencyProperty AxisForegroundProperty
Field Value
System.Windows.DependencyProperty
|
DefaultViewProperty
Identifies the DefaultView dependency property.
Declaration
public static readonly DependencyProperty DefaultViewProperty
Field Value
System.Windows.DependencyProperty
|
FilterDescriptorsProperty
Identifies the FilterDescriptors dependency property.
Declaration
public static readonly DependencyProperty FilterDescriptorsProperty
Field Value
System.Windows.DependencyProperty
|
HierarchicalViewDescriptorsProperty
Identifies the HierarchicalViewDescriptors dependency property.
Declaration
public static readonly DependencyProperty HierarchicalViewDescriptorsProperty
Field Value
System.Windows.DependencyProperty
|
HierarchyManagerProperty
Identifies the HierarchyManager dependency property.
Declaration
public static readonly DependencyProperty HierarchyManagerProperty
Field Value
System.Windows.DependencyProperty
|
HoverActivationDelayProperty
Identifies the HoverActivationDelay dependency property.
Declaration
public static readonly DependencyProperty HoverActivationDelayProperty
Field Value
System.Windows.DependencyProperty
|
ItemsSourceProperty
Identifies the ItemsSource dependency property.
Declaration
public static readonly DependencyProperty ItemsSourceProperty
Field Value
System.Windows.DependencyProperty
|
LegendStyleProperty
Identifies the LegendStyle dependency property.
Declaration
public static readonly DependencyProperty LegendStyleProperty
Field Value
System.Windows.DependencyProperty
|
MinFullHeightProperty
Identifies the MinFullHeight dependency property.
Declaration
public static readonly DependencyProperty MinFullHeightProperty
Field Value
System.Windows.DependencyProperty
|
MinFullWidthProperty
Identifies the MinFullWidth dependency property.
Declaration
public static readonly DependencyProperty MinFullWidthProperty
Field Value
System.Windows.DependencyProperty
|
PaletteBrushesProperty
Identifies the PaletteBrushes dependency property.
Declaration
public static readonly DependencyProperty PaletteBrushesProperty
Field Value
System.Windows.DependencyProperty
|
PaletteBrushesRepeatProperty
Identifies the PaletteBrushesRepeat dependency property.
Declaration
public static readonly DependencyProperty PaletteBrushesRepeatProperty
Field Value
System.Windows.DependencyProperty
|
PaletteBrushesUseSolidColorsProperty
Identifies the PaletteBrushesUseSolidColors dependency property.
Declaration
public static readonly DependencyProperty PaletteBrushesUseSolidColorsProperty
Field Value
System.Windows.DependencyProperty
|
SamplingSettingsProperty
Identifies the SamplingSettings dependency property.
Declaration
public static readonly DependencyProperty SamplingSettingsProperty
Field Value
System.Windows.DependencyProperty
|
SeriesMappingsProperty
Identifies the SeriesMappings dependency property.
Declaration
public static readonly DependencyProperty SeriesMappingsProperty
Field Value
System.Windows.DependencyProperty
|
SortDescriptorsProperty
Identifies the SortDescriptors dependency property.
Declaration
public static readonly DependencyProperty SortDescriptorsProperty
Field Value
System.Windows.DependencyProperty
|
TimeBarProperty
Identifies the TimeBar dependency property.
Declaration
public static readonly DependencyProperty TimeBarProperty
Field Value
System.Windows.DependencyProperty
|
TitleStyleProperty
Identifies the TitleStyle dependency property.
Declaration
public static readonly DependencyProperty TitleStyleProperty
Field Value
System.Windows.DependencyProperty
|
UseDefaultLayoutProperty
Identifies the UseDefaultLayout dependency property.
Declaration
public static readonly DependencyProperty UseDefaultLayoutProperty
Field Value
System.Windows.DependencyProperty
|
Properties
AnimationSettings
Gets or sets the animation settings for the contained DataSeries.
Declaration
public AnimationSettings AnimationSettings { get; set; }
Property Value
AnimationSettings
The animation settings. |
AxisElementBrush
Gets or sets the a brush used for all axis line elements.
Declaration
public Brush AxisElementBrush { get; set; }
Property Value
System.Windows.Media.Brush
|
AxisForeground
Gets or sets the axis foreground.
Declaration
public Brush AxisForeground { get; set; }
Property Value
System.Windows.Media.Brush
|
CreateItemStyleDelegate
Gets or sets a delegate that allows you to generate a new user defined System.Windows.Style to be applied to a number of chart items.
The delegate accepts four parameters:
- First parameter is a System.Windows.Controls.Control instance that represents the chart item that is currently processed. This could be either a derivative of BaseChartItem, or a derivative of SelfDrawingSeries, or a SeriesItemLabel, or a ChartLegendItem.
- Second parameter is the System.Windows.Style that would be applied to the respective chart item by default. You can use it to set the Style.BasedOn property of the user defined style you are generating.
- Third parameter is the respective DataPoint associated with the chart item. Note that argument will be null if the chart item is a SelfDrawingSeries.
- Fourth parameter is the respective DataSeries associated with the chart item.
Declaration
public Func<Control, Style, DataPoint, DataSeries, Style> CreateItemStyleDelegate { get; set; }
Property Value
System.Func<System.Windows.Controls.Control, System.Windows.Style, DataPoint, DataSeries, System.Windows.Style>
|
DefaultSeriesDefinition
Gets or sets the default SeriesDefinition for a data bound chart.
Declaration
public ISeriesDefinition DefaultSeriesDefinition { get; set; }
Property Value
ISeriesDefinition
The default value is BarSeriesDefinition. |
DefaultView
Gets or sets the default view of RadChart.
Declaration
public ChartDefaultView DefaultView { get; set; }
Property Value
ChartDefaultView
|
Remarks
The default view contains a basic layout with a single chart area, legend, and title within a grid panel. You can still add additional elements (chart areas, legends, titles) as content of the RadChart control; alternatively you can modify the template as well.
FilterDescriptors
Gets the filter descriptors collection.
Declaration
public ChartFilterDescriptorCollection FilterDescriptors { get; }
Property Value
ChartFilterDescriptorCollection
|
HierarchicalViewDescriptors
Gets the sort descriptors collection.
Declaration
public ChartHierarchicalViewDescriptorCollection HierarchicalViewDescriptors { get; }
Property Value
ChartHierarchicalViewDescriptorCollection
|
HierarchyManager
Gets or sets an instance of HierarchyManager. This object is in charge of hierarchical operations in RadChart.
Declaration
public HierarchyManager HierarchyManager { get; set; }
Property Value
HierarchyManager
The HierarchyManager. |
HoverActivationDelay
Gets or sets the delay before the hover interactivity effect is activated.
Declaration
public Duration HoverActivationDelay { get; set; }
Property Value
System.Windows.Duration
|
Remarks
The default value is zero i.e. the hover effect is activated immediately.
ItemsSource
Gets or sets a collection used to generate the content of the RadChart control. This is a dependency property.
Declaration
public object ItemsSource { get; set; }
Property Value
System.Object
|
LegendStyle
Gets or sets the legend style.
Declaration
public Style LegendStyle { get; set; }
Property Value
System.Windows.Style
The legend style. |
MinFullHeight
Gets or sets the height under which the chart will be scaled down.
Declaration
public double MinFullHeight { get; set; }
Property Value
System.Double
The height. |
MinFullWidth
Gets or sets the width under which the chart will be scaled down.
Declaration
public double MinFullWidth { get; set; }
Property Value
System.Double
The width. |
PaletteBrushes
Gets or sets the brushes that are to be used with the Series.
Declaration
public BrushCollection PaletteBrushes { get; set; }
Property Value
BrushCollection
The series brushes. |
PaletteBrushesRepeat
Gets or sets value indicating whether the brushes added will be used in cyclic fashion.
Declaration
public bool PaletteBrushesRepeat { get; set; }
Property Value
System.Boolean
The series brushes. |
PaletteBrushesUseSolidColors
Gets or sets value indicating whether the brushes in the palette should use solid colors.
Declaration
public bool PaletteBrushesUseSolidColors { get; set; }
Property Value
System.Boolean
The series brushes. |
SamplingSettings
Gets the sampling settings. The sampling settings are used to allow data sampling in RadChart - grouping several adjacent datapoints into a single point.
Declaration
public SamplingSettings SamplingSettings { get; set; }
Property Value
SamplingSettings
The sampling settings. |
SeriesMappings
Gets or sets the collection of mappings that defines the relations between the data passed to the chart and the chart series fields (YValue, XValue, etc.) that should be bound to the passed data.
Declaration
public SeriesMappingCollection SeriesMappings { get; set; }
Property Value
SeriesMappingCollection
|
Remarks
You need to add a separate mapping item for each chart series that you would like to display in the chart control.
SortDescriptors
Gets the hierarchical view descriptors collection.
Declaration
public ChartSortDescriptorCollection SortDescriptors { get; }
Property Value
ChartSortDescriptorCollection
|
StyleBuilder
This property supports the RadChart infrastructure and is not intended to be used directly from your code.
Declaration
[Obsolete("This property is obsolete and will be removed as currently it is NO-OP.")]
public StyleBuilderData StyleBuilder { get; set; }
Property Value
StyleBuilderData
|
TimeBar
Gets or sets the TimeBar.
Declaration
public IRangeSelector<DateTime> TimeBar { get; set; }
Property Value
IRangeSelector<System.DateTime>
|
TitleStyle
Gets or sets the title style.
Declaration
public Style TitleStyle { get; set; }
Property Value
System.Windows.Style
The title style. |
UseDefaultLayout
Gets or sets a value indicating whether the default layout of the charting control should be used.
Declaration
public bool UseDefaultLayout { get; set; }
Property Value
System.Boolean
The default value is true. |
Remarks
You should set this property to false if you would like to customize the layout of the control entirely through the Content property of the control. Alternatively you can overwrite the control template and change the default layout there, or use a combination of the default layout (from the template) and layout specified in the Content property of the control.
Methods
ExportToExcelML(Stream)
Exports an image of the given element to the Excel file.
Declaration
public void ExportToExcelML(Stream stream)
Parameters
System.IO.Stream
stream
Stream. |
ExportToExcelML(String)
Exports an image of the given element to the Excel file.
Declaration
public void ExportToExcelML(string fileName)
Parameters
System.String
fileName
Name of the Excel file. |
ExportToImage(Stream)
Exports an image of the given element to stream using PngBitmapEncoder.
Declaration
public void ExportToImage(Stream stream)
Parameters
System.IO.Stream
stream
Stream to write image to. |
ExportToImage(Stream, Double, Double, BitmapEncoder)
Exports an image of the given element to stream using the specified bitmap encoder.
Declaration
public void ExportToImage(Stream stream, double dpiHorizontal, double dpiVertical, BitmapEncoder encoder)
Parameters
System.IO.Stream
stream
Stream to write image to. |
System.Double
dpiHorizontal
The horizontal dpi setting. |
System.Double
dpiVertical
The vertical dpi setting. |
System.Windows.Media.Imaging.BitmapEncoder
encoder
Bitmap encoder. |
ExportToImage(Stream, BitmapEncoder)
Exports an image of the given element to stream using the specified bitmap encoder.
Declaration
public void ExportToImage(Stream stream, BitmapEncoder encoder)
Parameters
System.IO.Stream
stream
Stream to write image to. |
System.Windows.Media.Imaging.BitmapEncoder
encoder
Bitmap encoder. |
ExportToImage(String)
Exports an image of the given element to file using PngBitmapEncoder.
Declaration
public void ExportToImage(string fileName)
Parameters
System.String
fileName
Name of the file to write image to. |
ExportToImage(String, Double, Double, BitmapEncoder)
Exports an image of the given element to file using the specified bitmap encoder.
Declaration
public void ExportToImage(string fileName, double dpiHorizontal, double dpiVertical, BitmapEncoder encoder)
Parameters
System.String
fileName
Name of the file to write image to. |
System.Double
dpiHorizontal
The horizontal dpi setting. |
System.Double
dpiVertical
The vertical dpi setting. |
System.Windows.Media.Imaging.BitmapEncoder
encoder
Bitmap encoder. |
ExportToImage(String, BitmapEncoder)
Exports an image of the given element to file using the specified bitmap encoder.
Declaration
public void ExportToImage(string fileName, BitmapEncoder encoder)
Parameters
System.String
fileName
Name of the file to write image to. |
System.Windows.Media.Imaging.BitmapEncoder
encoder
Bitmap encoder. |
ExportToXps(Stream)
Exports an image of the given element to the Xps file.
Declaration
public void ExportToXps(Stream stream)
Parameters
System.IO.Stream
stream
Stream. |
ExportToXps(String)
Exports an image of the given element to the Xps file.
Declaration
public void ExportToXps(string fileName)
Parameters
System.String
fileName
Name of the Xps file. |
MeasureOverride(Size)
Called to measure a control.
Declaration
protected override Size MeasureOverride(Size availableSize)
Parameters
System.Windows.Size
availableSize
The maximum size that the method can return. |
Returns
System.Windows.Size
The size of the control, up to the maximum specified by |
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call System.Windows.FrameworkElement.ApplyTemplate.
Declaration
public override void OnApplyTemplate()
OnDataBinding(ChartDataBindingEventArgs)
Called before the chart is data bound.
Declaration
protected virtual void OnDataBinding(ChartDataBindingEventArgs e)
Parameters
ChartDataBindingEventArgs
e
|
OnDataBound(ChartDataBoundEventArgs)
Called when the chart is data bound.
Declaration
protected virtual void OnDataBound(ChartDataBoundEventArgs e)
Parameters
ChartDataBoundEventArgs
e
|
OnInitialized(EventArgs)
Raises the System.Windows.FrameworkElement.Initialized event. This method is invoked whenever System.Windows.FrameworkElement.IsInitialized is set to true internally.
Declaration
protected override void OnInitialized(EventArgs e)
Parameters
System.EventArgs
e
The System.Windows.RoutedEventArgs that contains the event data. |
OnItemDataBound(ChartItemDataBoundEventArgs)
Occurs when a DataPoint is created through databinding.
Declaration
protected virtual void OnItemDataBound(ChartItemDataBoundEventArgs e)
Parameters
ChartItemDataBoundEventArgs
e
|
Rebind()
Rebinds this RadChart instance.
Declaration
public void Rebind()
ResetTheme()
Resets the theme.
Declaration
public void ResetTheme()
Save()
Saves the chart to a stream using PngBitmapEncoder.
Declaration
public Stream Save()
Returns
System.IO.Stream
A Stream object containing the chart. |
Save(Double, Double)
Saves the chart to a stream using PngBitmapEncoder.
Declaration
public Stream Save(double dpiHorizontal, double dpiVertical)
Parameters
System.Double
dpiHorizontal
The horizontal dpi setting. |
System.Double
dpiVertical
The vertical dpi setting. |
Returns
System.IO.Stream
A Stream object containing the chart. |
Save(Double, Double, BitmapEncoder)
Saves the chart to a stream using the specified bitmap encoder.
Declaration
public Stream Save(double dpiHorizontal, double dpiVertical, BitmapEncoder encoder)
Parameters
System.Double
dpiHorizontal
The horizontal dpi setting. |
System.Double
dpiVertical
The vertical dpi setting. |
System.Windows.Media.Imaging.BitmapEncoder
encoder
An instance of BitmapEncoder. Use this parameter to define the output image type. |
Returns
System.IO.Stream
A Stream object containing the chart. |
Save(String)
Saves the chart to a file using PngBitmapEncoder.
Declaration
public void Save(string fileName)
Parameters
System.String
fileName
Name of the file to write image to. |
Save(String, Double, Double)
Saves the chart to a file using PngBitmapEncoder.
Declaration
public void Save(string fileName, double dpiHorizontal, double dpiVertical)
Parameters
System.String
fileName
Name of the file to write image to. |
System.Double
dpiHorizontal
The horizontal dpi setting. |
System.Double
dpiVertical
The vertical dpi setting. |
Save(String, Double, Double, BitmapEncoder)
Saves the chart to a file using the specified bitmap encoder.
Declaration
public void Save(string fileName, double dpiHorizontal, double dpiVertical, BitmapEncoder encoder)
Parameters
System.String
fileName
Name of the file to write image to. |
System.Double
dpiHorizontal
The horizontal dpi setting. |
System.Double
dpiVertical
The vertical dpi setting. |
System.Windows.Media.Imaging.BitmapEncoder
encoder
Bitmap encoder. |
UpdateLogicalChildren()
This method supports the RadChart infrastructure and is not intended to be used directly from your code.
Declaration
public void UpdateLogicalChildren()
Remarks
Call this method only in case you are using the control with non-default layout and you are changing it dynamically (i.e. add/remove ChartArea instances on the fly).
Events
DataBinding
Occurs before the chart is data bound.
Declaration
public event EventHandler<ChartDataBindingEventArgs> DataBinding
Event Type
System.EventHandler<ChartDataBindingEventArgs>
|
DataBound
Occurs when the chart is data bound.
Declaration
public event EventHandler<ChartDataBoundEventArgs> DataBound
Event Type
System.EventHandler<ChartDataBoundEventArgs>
|
ItemDataBound
Occurs when a DataPoint is created through databinding.
Declaration
public event EventHandler<ChartItemDataBoundEventArgs> ItemDataBound
Event Type
System.EventHandler<ChartItemDataBoundEventArgs>
|