Back to Devexpress

SparklineEdit.Properties Property

windowsforms-devexpress-dot-xtraeditors-dot-sparklineedit.md

latest4.5 KB
Original Source

SparklineEdit.Properties Property

Provides access to the editor-specific properties of the SparklineEdit control.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Properties")]
[SmartTagSearchNestedProperties]
public RepositoryItemSparklineEdit Properties { get; }
vb
<DXCategory("Properties")>
<SmartTagSearchNestedProperties>
Public ReadOnly Property Properties As RepositoryItemSparklineEdit

Property Value

TypeDescription
RepositoryItemSparklineEdit

A RepositoryItemSparklineEdit object.

|

Remarks

See RepositoryItemSparklineEdit to learn more.

Example

This example demonstrates how to create a sparkline control, fill it with data, choose the way to represent this data, and customize the sparkline appearance.

To do this, you should create a SparklineEdit object and assign the datasource object to its BaseEdit.EditValue property. Then, you need to set the appropriate view instance to the SparklineEdit.Properties.View property and customize view properties to meet your requirements.

Note that in this sample, the AreaSparklineView class is used to display area sparklines. To display other sparklines types, use the BarSparklineView, LineSparklineView or WinLossSparklineView classes instead.

csharp
using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.Sparkline;
using DevExpress.XtraEditors;

private SparklineEdit CreateSparkline() {
    // Create a Sparkline editor and set its dock style.
    SparklineEdit sparkline = new SparklineEdit();
    sparkline.Dock = DockStyle.Fill;

    sparkline.EditValue = CreateData();

    // Create an Area view and assign it to the sparkline.
    AreaSparklineView view = new AreaSparklineView();
    sparkline.Properties.View = view;

    // Customize area appearance.
    view.Color = Color.Aqua;
    view.AreaOpacity = 50;

    // Show markers.
    view.HighlightStartPoint = true;
    view.HighlightEndPoint = true;
    view.HighlightMaxPoint = true;
    view.HighlightMinPoint = true;
    view.HighlightNegativePoints = true;
    view.SetSizeForAllMarkers(10);

    return sparkline;
}

private double[] CreateData() {
    return new double[] { 2, 4, 5, 1, -1, -2, -1, 2, 4, 5, 6, 3, 5, 4, 8, -1, 6 };
}
vb
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.Sparkline
Imports DevExpress.XtraEditors

Private Function CreateSparkline() As SparklineEdit
    ' Create a Sparkline editor and set its dock style.
    Dim sparkline As New SparklineEdit()
    sparkline.Dock = DockStyle.Fill

    sparkline.EditValue = CreateData()

    ' Create an Area view and assign it to the sparkline.
    Dim view As New AreaSparklineView()
    sparkline.Properties.View = view

    ' Customize area appearance.
    view.Color = Color.Aqua
    view.AreaOpacity = 50

    ' Show markers.
    view.HighlightStartPoint = True
    view.HighlightEndPoint = True
    view.HighlightMaxPoint = True
    view.HighlightMinPoint = True
    view.HighlightNegativePoints = True
    view.SetSizeForAllMarkers(10)

    Return sparkline
End Function

Private Function CreateData() As Double()
    Return New Double() { 2, 4, 5, 1, -1, -2, -1, 2, 4, 5, 6, 3, 5, 4, 8, -1, 6 }
End Function

See Also

SparklineEdit Class

SparklineEdit Members

DevExpress.XtraEditors Namespace