ClassRadSparkline
Represents a sparkline control that provides a compact, inline chart visualization for displaying trends and patterns in data series.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
[TelerikToolboxCategory("Data Controls")]
public class RadSparkline : RadControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IAnalyticsProvider, IPrintable
Inheritance: objectMarshalByRefObjectComponentControlScrollableControlRadControlRadSparkline
Implements:
Inherited Members
Constructors
RadSparkline()
Initializes a new instance of the RadSparkline class with default settings.
Declaration
public RadSparkline()
Properties
Annotations
Gets the collection of annotations that can be added to the sparkline to provide additional visual information or markers.
Declaration
[Browsable(true)]
public SparkAnnotationCollection Annotations { get; }
Property Value
Area
Gets the current visible area of the sparkline that defines the rendering boundaries and viewport.
Declaration
[Browsable(false)]
public SparkArea Area { get; }
Property Value
Axes
Gets the collection of axes used by the sparkline for data positioning and scaling.
Declaration
[Browsable(true)]
public SparkAxisCollection Axes { get; }
Property Value
AxisDrawMode
Gets or sets how the horizontal axis is drawn relative to the data series in the sparkline.
Declaration
[Browsable(true)]
public AxisDrawMode AxisDrawMode { get; set; }
Property Value
Controllers
Gets the collection of controllers that manage user interaction and behavior for the sparkline view.
Declaration
[Browsable(false)]
public SparkViewControllerCollection Controllers { get; }
Property Value
DefaultSize
Gets the default size of the RadSparkline control.
Declaration
protected override Size DefaultSize { get; }
Property Value
Overrides
EmptyPointBehavior
Gets or sets how empty or null data points are handled in the sparkline visualization.
Declaration
[Browsable(true)]
public EmptyPointBehavior EmptyPointBehavior { get; set; }
Property Value
Series
Gets or sets the data series that will be displayed in the sparkline chart.
Declaration
[Browsable(true)]
public SparkSeries Series { get; set; }
Property Value
ShowAxis
Gets or sets whether the horizontal axis line is visible in the sparkline chart.
Declaration
[Browsable(true)]
public bool ShowAxis { get; set; }
Property Value
ShowFirstPointIndicator
Gets or sets whether a marker indicating the first data point in the series will be displayed on the sparkline.
Declaration
[Browsable(true)]
public bool ShowFirstPointIndicator { get; set; }
Property Value
ShowHighPointIndicator
Gets or sets whether a marker indicating the highest data point value will be displayed on the sparkline.
Declaration
[Browsable(true)]
public bool ShowHighPointIndicator { get; set; }
Property Value
ShowLastPointIndicator
Gets or sets whether a marker indicating the last data point in the series will be displayed on the sparkline.
Declaration
[Browsable(true)]
public bool ShowLastPointIndicator { get; set; }
Property Value
ShowLowPointIndicator
Gets or sets whether a marker indicating the lowest data point value will be displayed on the sparkline.
Declaration
[Browsable(true)]
public bool ShowLowPointIndicator { get; set; }
Property Value
ShowNegativePointIndicators
Gets or sets whether markers for negative data point values will be displayed on the sparkline.
Declaration
[Browsable(true)]
public bool ShowNegativePointIndicators { get; set; }
Property Value
ShowToolTip
Gets or sets a value indicating whether tooltips are displayed when hovering over data points in the sparkline.
Declaration
[Browsable(true)]
public bool ShowToolTip { get; set; }
Property Value
SparklineElement
Gets the main sparkline element that contains the visualization logic and rendering components.
Declaration
public RadSparklineElement SparklineElement { get; }
Property Value
Methods
BeginPrint(RadPrintDocument, PrintEventArgs)
Begins the print process for the sparkline and returns the number of pages to print.
Declaration
public int BeginPrint(RadPrintDocument sender, PrintEventArgs args)
Parameters
sender
The RadPrintDocument that initiated the print operation.
args
A PrintEventArgs that contains the event data.
Returns
The number of pages to print (always returns 1 for sparklines).
Implements
CreateChildItems(RadElement)
Creates the child elements for the sparkline control within the specified parent element.
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
parent
The parent element that will contain the child elements.
Overrides
CreateSparklineElement()
Creates and returns a new instance of the RadSparklineElement that will be used as the core element of the sparkline control.
Declaration
protected virtual RadSparklineElement CreateSparklineElement()
Returns
A new RadSparklineElement instance.
DeferRefresh()
Returns a disposable object that can be used to defer refresh operations until disposed, allowing for batch updates.
Declaration
public IDisposable DeferRefresh()
Returns
An IDisposable object that defers refresh operations.
Dispose(bool)
Releases the unmanaged resources used by the RadSparkline and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Overrides
EndPrint(RadPrintDocument, PrintEventArgs)
Ends the print process for the sparkline.
Declaration
public bool EndPrint(RadPrintDocument sender, PrintEventArgs args)
Parameters
sender
The RadPrintDocument that initiated the print operation.
args
A PrintEventArgs that contains the event data.
Returns
true if the print operation completed successfully; otherwise, false.
Implements
ExportToImage(Stream, Size)
Exports the sparkline to a stream as a PNG image with the specified size.
ExportToImage(string, Size)
Exports the sparkline to an image file using PNG format with the specified size.
ExportToImage(string, Size, ImageFormat)
Exports the sparkline to an image file using the specified format and size.
Declaration
public void ExportToImage(string filePath, Size size, ImageFormat imageFormat)
Parameters
filePath
The path where the exported image file will be saved.
size
The dimensions of the exported image.
imageFormat
The image format to use for the exported file.
GetSettingsDialog(RadPrintDocument)
Gets the settings dialog for configuring print options for the sparkline.
Declaration
public Form GetSettingsDialog(RadPrintDocument document)
Parameters
document
The RadPrintDocument associated with the print operation.
Returns
A Form containing the print settings dialog.
Implements
OnLoad(Size)
Performs initialization when the control is loaded with the specified desired size.
Declaration
protected override void OnLoad(Size desiredSize)
Parameters
desiredSize
The desired size for the control.
Overrides
OnThemeChanged()
Called when the control's theme is changed, ensuring the sparkline area is properly updated to reflect theme modifications.
Declaration
protected override void OnThemeChanged()
Overrides
Print()
Prints the sparkline directly to the default printer without showing any dialog.
Declaration
public virtual void Print()
Print(bool)
Prints the sparkline to the default printer, optionally showing printer settings dialog first.
Declaration
public virtual void Print(bool showPrinterSettings)
Parameters
showPrinterSettings
true to show the printer settings dialog before printing; false to print directly.
Print(bool, RadPrintDocument)
Prints the sparkline using the specified print document, optionally showing printer settings dialog first.
Declaration
public virtual void Print(bool showPrinterSettings, RadPrintDocument document)
Parameters
showPrinterSettings
true to show the printer settings dialog before printing; false to print directly.
document
The RadPrintDocument instance to use for controlling the print process.
PrintPage(int, RadPrintDocument, PrintPageEventArgs)
Prints the specified page of the sparkline to the print document.
Declaration
public bool PrintPage(int pageNumber, RadPrintDocument sender, PrintPageEventArgs args)
Parameters
pageNumber
The page number to print (always 1 for sparklines).
sender
The RadPrintDocument that initiated the print operation.
args
A PrintPageEventArgs that contains the event data and graphics context for printing.
Returns
false to indicate that there are no more pages to print; otherwise, true.
Implements
PrintPreview()
Shows a print preview dialog for the sparkline with default print settings.
Declaration
public virtual void PrintPreview()
PrintPreview(RadPrintDocument)
Shows a print preview dialog for the sparkline using the specified print document.
Declaration
public virtual void PrintPreview(RadPrintDocument document)
Parameters
document
The RadPrintDocument instance to use for controlling the print preview.
Refresh()
Forces a complete refresh of the sparkline control, including layout recalculation and visual updates.
Declaration
public override void Refresh()
Overrides
ResetBackColorThemeOverrides()
Resets theme value overrides for the background color property.
Declaration
protected override void ResetBackColorThemeOverrides()
Overrides
ResetForeColorThemeOverrides()
Resets theme value overrides for the foreground color property.
Declaration
protected override void ResetForeColorThemeOverrides()
Overrides
ResumeRefresh()
Resumes refresh operations for the sparkline after they have been suspended.
Declaration
public void ResumeRefresh()
ScaleControl(SizeF, BoundsSpecified)
Scales the control by the specified factor and adjusts the sparkline view margins accordingly.
Declaration
protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
Parameters
factor
The scaling factor to apply to the control.
specified
A bitwise combination of the BoundsSpecified values specifying which bounds to scale.
Overrides
SetBackColorThemeOverrides()
Sets theme value overrides for the background color property.
Declaration
protected override void SetBackColorThemeOverrides()
Overrides
SetForeColorThemeOverrides()
Sets theme value overrides for the foreground color property.
Declaration
protected override void SetForeColorThemeOverrides()
Overrides
SuspendRefresh()
Suspends refresh operations for the sparkline to improve performance during multiple property changes.
Declaration
public void SuspendRefresh()
Events
CreateRenderer
Occurs when the sparkline area requires a custom renderer for the first time, allowing users to provide their own rendering implementation.
Declaration
public event SparklineCreateRendererEventHandler CreateRenderer
Event Value
PaintSparkFill
Occurs when a sparkline fill area is about to be painted, allowing customization of the brush used for filling regions.
Declaration
public event PaintSparkFillEventHandler PaintSparkFill
Event Value
PaintSparkStroke
Occurs when a sparkline stroke is about to be painted, allowing customization of the pen used for drawing lines and borders.
Declaration
public event PaintSparkStrokeEventHandler PaintSparkStroke
Event Value