Skip to main content
Version: 4.2

KpiPanel

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.2.0.0)

Displays one formatted metric with an optional trend, icon, accent, and compact visual.

public class KpiPanel : Control

Assign display text to Value; the control never parses it as a number. Trend is formatted on the server using TrendFormat and the current culture. Positive trends use the success color and negative trends use the danger color independently of Tone. Sparkline updates reuse the existing client widget.

Example:

var card = new KpiPanel
{
Title = "ON-TIME DELIVERIES", Value = "96.1%", Caption = "vs. last 7 days",
Trend = 2.4m, Tone = KpiTone.Success, AccentPosition = KpiAccentPosition.Top,
Visual = KpiVisual.ProgressBar, ProgressValue = 96.1, Maximum = 100, Clickable = true
};
card.Click += (sender, e) => MessageBox.Show("Delivery details");
this.Controls.Add(card);

Constructors​

Instance member KpiPanel()​

Initializes an empty metric card with no visual, no accent, and card activation disabled.

Properties​

Instance member AccentPosition​

KpiAccentPosition: Gets or sets accent placement. The default is None. Left becomes the leading edge in right-to-left layout. (Default: None)

Instance member Caption​

String: Gets or sets optional plain-text detail below the metric. The default is an empty string. (Default: "")

Instance member ChartSeries​

ChartSeries: Gets or sets an observable ChartSeries used by the compact sparkline. (Default: null)

The series is shared and remains owned by the application. Line, area and bar series use their corresponding compact geometry; other series use a line of their Value samples. Null restores SparklineValues. Call Update after changing an external data source.

Example:

card.Visual = KpiVisual.Sparkline;
card.ChartSeries = revenueSeries;

Instance member Clickable​

Boolean: Gets or sets whether the card surface raises Click. The default is false. (Default: False)

Setting this property also sets TabStop and Focusable to the same value. An enabled clickable card supports pointer activation, Enter, and Space. The icon remains independently interactive.

Protected member DefaultSize​

Size: Gets the default card size of 270 by 160 pixels.

Instance member Focusable​

Boolean: Gets or sets whether the card can receive focus. The default is false. (Default: False)

Instance member Icon​

String: Gets or sets an icon image source or Wisej theme image key. Empty hides the icon button. (Default: "")

Instance member Maximum​

Double: Gets or sets the positive finite progress capacity. The default is 100. (Default: 100)

Throws:

Instance member NoSamplesText​

String: Gets or sets the localized override for the "No samples." text. (Default: null)

The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation.

Instance member ProgressValue​

Double: Gets or sets the nonnegative absolute progress amount. The default is zero. (Default: 0)

Values above Maximum are retained, but the visible bar or gauge is capped at full capacity. This does not change Value.

Throws:

Instance member SamplesSummaryText​

String: Gets or sets the localized override for the "{0} samples. Latest value: {1}." text. (Default: null)

The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation. {0} is the sample count and {1} is the latest value. Used for the CLDR other category of the current UI culture. Literal braces can be written as {{ and }}.

Instance member SampleSummaryText​

String: Gets or sets the localized override for the "{0} sample. Latest value: {1}." text. (Default: null)

The default is null, which selects the built-in translation for the current UI culture. The getter returns the configured override. An empty string suppresses the text without changing the operation. {0} is the sample count and {1} is the latest value. Used for the CLDR one category of the current UI culture. Literal braces can be written as {{ and }}.

Instance member SparklineValues​

Double[]: Gets a copy of the finite sparkline samples, or replaces them. Null clears the samples.

Samples remain in supplied order and are not trimmed. Assign a new array to update the visual; editing the supplied array or returned copy does not change the control. Update sends new data to the existing client sparkline without recreating the card.

Throws:

Example:

card.Visual = KpiVisual.Sparkline;
card.SparklineValues = new double[] { 65, 72, 68, 59, 49.2 };
card.Value = "49.2%";

Instance member TabStop​

Boolean: Gets or sets card tab navigation participation. The default is false. (Default: False)

Instance member Title​

String: Gets or sets the plain-text metric title. The default is an empty string. (Default: "")

Instance member Tone​

KpiTone: Gets or sets the semantic accent and visual color. The default is Primary. (Default: Primary)

Instance member Trend​

Nullable<Decimal>: Gets or sets a signed trend, or null to hide the trend. The default is null. (Default: null)

The value is independent of Value and ProgressValue. An upward or downward marker indicates its sign; zero uses a neutral marker. Whether an increase is desirable is application-specific.

Instance member TrendFormat​

String: Gets or sets the .NET numeric format for Trend. The default is "0.##". (Default: "0.##")

Formats the signed decimal using the current culture. This is a numeric format, not a composite format. Use positive and negative custom sections when the direction marker should replace a minus sign.

Throws:

Example:

card.Trend = -2.4m;
card.TrendFormat = "0.0;0.0;0"; // Downward marker followed by 2.4.

Instance member Value​

String: Gets or sets the already formatted metric text. The default is an empty string. (Default: "")

Example:

card.Value = (0.492).ToString("P1", System.Globalization.CultureInfo.CurrentCulture);

Instance member Visual​

KpiVisual: Gets or sets the compact visual below the metric. The default is None. (Default: None)

Changing modes retains both SparklineValues and ProgressValue so the application can switch back. Gauge uses ProgressValue and Maximum with the card’s Tone; Value remains independently formatted.

Methods​

Protected member Dispose(disposing)​

Releases observation of an application-owned chart series.

ParameterTypeDescription
disposingBooleanWhether managed resources are being released.

Protected member OnIconClick(e)​

Raises IconClick.

ParameterTypeDescription
eEventArgsEvent data.

Protected member OnValueChanged(e)​

Raises ValueChanged.

ParameterTypeDescription
eEventArgsEvent data.

Protected member OnWebEvent(e)​

Dispatches activation events and suppresses the standard tap event to avoid duplicate clicks.

ParameterTypeDescription
eWisejEventArgsClient event.

Protected member OnWebRender(config)​

Serializes metric properties and wires activation events independently of delegate subscriptions.

ParameterTypeDescription
configObjectClient configuration.

Instance member ResetSparklineValues()​

Restores the default empty sparkline sample array.

Events​

Instance member IconClick​

EventHandler Occurs when the visible icon is activated with the pointer or keyboard.

Icon activation is independent of Clickable and does not also raise Click. Disabled cards suppress both events.

Instance member ValueChanged​

EventHandler Occurs after the displayed Value changes. Assigning the same text does not raise the event.

Implements​

NameDescription
IUserDataProvides access to the UserData and Tag properties associated to the component implementing this interface.
IBindableComponentBindable components implement this interface.
IDropTargetControls that support drag & drop operations implement this interface.
IWisejComponentAll wisej components implement this interface.
IWisejControlAll wisej controls derived from the Control class must implement this interface.
IWisejSerializableAllows an object to serialize itself.