Class RadSparkline
Represents a sparkline control that provides a compact, inline chart visualization for displaying trends and patterns in data series.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
[TelerikToolboxCategory("Data Controls")]
public class RadSparkline : RadControl, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IPCHost, IAnalyticsProvider, IPrintable
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
public SparkAnnotationCollection Annotations { get; }
Property Value
SparkAnnotationCollection
|
Area
Gets the current visible area of the sparkline that defines the rendering boundaries and viewport.
Declaration
public SparkArea Area { get; }
Property Value
SparkArea
|
AutoSize
Gets or sets whether the sparkline control is automatically sized to fit its content.
Declaration
public override bool AutoSize { get; set; }
Property Value
System.Boolean
|
Overrides
Axes
Gets the collection of axes used by the sparkline for data positioning and scaling.
Declaration
public SparkAxisCollection Axes { get; }
Property Value
SparkAxisCollection
|
AxisDrawMode
Gets or sets how the horizontal axis is drawn relative to the data series in the sparkline.
Declaration
public AxisDrawMode AxisDrawMode { get; set; }
Property Value
AxisDrawMode
|
Controllers
Gets the collection of controllers that manage user interaction and behavior for the sparkline view.
Declaration
public SparkViewControllerCollection Controllers { get; }
Property Value
SparkViewControllerCollection
|
DefaultSize
Gets the default size of the RadSparkline control.
Declaration
protected override Size DefaultSize { get; }
Property Value
System.Drawing.Size
|
EmptyPointBehavior
Gets or sets how empty or null data points are handled in the sparkline visualization.
Declaration
public EmptyPointBehavior EmptyPointBehavior { get; set; }
Property Value
EmptyPointBehavior
|
Series
Gets or sets the data series that will be displayed in the sparkline chart.
Declaration
public SparkSeries Series { get; set; }
Property Value
SparkSeries
|
ShowAxis
Gets or sets whether the horizontal axis line is visible in the sparkline chart.
Declaration
public bool ShowAxis { get; set; }
Property Value
System.Boolean
|
ShowFirstPointIndicator
Gets or sets whether a marker indicating the first data point in the series will be displayed on the sparkline.
Declaration
public bool ShowFirstPointIndicator { get; set; }
Property Value
System.Boolean
|
ShowHighPointIndicator
Gets or sets whether a marker indicating the highest data point value will be displayed on the sparkline.
Declaration
public bool ShowHighPointIndicator { get; set; }
Property Value
System.Boolean
|
ShowLastPointIndicator
Gets or sets whether a marker indicating the last data point in the series will be displayed on the sparkline.
Declaration
public bool ShowLastPointIndicator { get; set; }
Property Value
System.Boolean
|
ShowLowPointIndicator
Gets or sets whether a marker indicating the lowest data point value will be displayed on the sparkline.
Declaration
public bool ShowLowPointIndicator { get; set; }
Property Value
System.Boolean
|
ShowNegativePointIndicators
Gets or sets whether markers for negative data point values will be displayed on the sparkline.
Declaration
public bool ShowNegativePointIndicators { get; set; }
Property Value
System.Boolean
|
ShowToolTip
Gets or sets a value indicating whether tooltips are displayed when hovering over data points in the sparkline.
Declaration
public bool ShowToolTip { get; set; }
Property Value
System.Boolean
|
SparklineElement
Gets the main sparkline element that contains the visualization logic and rendering components.
Declaration
public RadSparklineElement SparklineElement { get; }
Property Value
RadSparklineElement
|
View
Gets the SparkView instance associated with the sparkline element that manages the chart rendering and data display.
Declaration
public SparkView View { get; }
Property Value
SparkView
|
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
RadPrintDocument
sender
The RadPrintDocument that initiated the print operation. |
System.Drawing.Printing.PrintEventArgs
args
A PrintEventArgs that contains the event data. |
Returns
System.Int32
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
RadElement
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
RadSparklineElement
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
System.IDisposable
An IDisposable object that defers refresh operations. |
Dispose(Boolean)
Releases the unmanaged resources used by the RadSparkline and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
System.Boolean
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
RadPrintDocument
sender
The RadPrintDocument that initiated the print operation. |
System.Drawing.Printing.PrintEventArgs
args
A PrintEventArgs that contains the event data. |
Returns
System.Boolean
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.
Declaration
public void ExportToImage(Stream stream, Size size)
Parameters
System.IO.Stream
stream
The stream to write the exported image data to. |
System.Drawing.Size
size
The dimensions of the exported image. |
ExportToImage(String, Size)
Exports the sparkline to an image file using PNG format with the specified size.
Declaration
public void ExportToImage(string filePath, Size size)
Parameters
System.String
filePath
The path where the exported image file will be saved. |
System.Drawing.Size
size
The dimensions of the exported image. |
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
System.String
filePath
The path where the exported image file will be saved. |
System.Drawing.Size
size
The dimensions of the exported image. |
System.Drawing.Imaging.ImageFormat
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
RadPrintDocument
document
The RadPrintDocument associated with the print operation. |
Returns
System.Windows.Forms.Form
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
System.Drawing.Size
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(Boolean)
Prints the sparkline to the default printer, optionally showing printer settings dialog first.
Declaration
public virtual void Print(bool showPrinterSettings)
Parameters
System.Boolean
showPrinterSettings
true to show the printer settings dialog before printing; false to print directly. |
Print(Boolean, 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
System.Boolean
showPrinterSettings
true to show the printer settings dialog before printing; false to print directly. |
RadPrintDocument
document
The RadPrintDocument instance to use for controlling the print process. |
PrintPage(Int32, RadPrintDocument, PrintPageEventArgs)
Prints the specified page of the sparkline to the print document.
Declaration
public bool PrintPage(int pageNumber, RadPrintDocument sender, PrintPageEventArgs args)
Parameters
System.Int32
pageNumber
The page number to print (always 1 for sparklines). |
RadPrintDocument
sender
The RadPrintDocument that initiated the print operation. |
System.Drawing.Printing.PrintPageEventArgs
args
A PrintPageEventArgs that contains the event data and graphics context for printing. |
Returns
System.Boolean
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
RadPrintDocument
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
System.Drawing.SizeF
factor
The scaling factor to apply to the control. |
System.Windows.Forms.BoundsSpecified
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 Type
SparklineCreateRendererEventHandler
|
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 Type
PaintSparkFillEventHandler
|
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 Type
PaintSparkStrokeEventHandler
|