Skip to main content
A newer version of this page is available. .

SparklineViewBase Class

The base class for sparkline views.

Namespace: DevExpress.Sparkline

Assembly: DevExpress.Sparkline.v18.1.Core.dll

Declaration

public abstract class SparklineViewBase :
    IXtraSupportShouldSerialize,
    ISparklineInfo

The following members accept/return SparklineViewBase objects:

Library Related API Members
Cross-Platform Class Library SparklineViewBase.CreateView(SparklineViewType)
WinForms Controls RepositoryItemSparklineEdit.View
Reporting XRSparkline.View

Remarks

Each sparkline view is represented by the SparklineViewBase class descendant. To assign a specific view for a sparkline, set the required view to the RepositoryItemSparklineEdit.View property.

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.

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 markerks.
            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 };
        }

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SparklineViewBase class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also