Skip to main content

RadialGauge

Wisej.NET 4.2.0+

Two ring gauges and an arc gauge, each colored by the threshold its value has reached.

The RadialGauge shows one value against a range as a ring or an arc, with the formatted value and a short label in the middle. It is meant for readings that have a capacity, such as warehouse utilization, memory in use or the load on a loading dock, where the reader wants to know how full something is and whether that is a problem.

The gauge is read-only and not focusable; it complements the TrackBar, which is an input, and the classic ProgressBar, which reports the progress of a task. Its thresholds are the same MeterThreshold objects the MeterBar uses, so a ring on a dashboard and a bar in a detail view can share one definition of "warning" and "critical".

info

For a complete list of properties, methods, and events, see the API documentation.

Features​

Value and Range​

Value is plotted between Minimum (0 by default) and Maximum (100 by default). A value outside the range is kept and shown as text, and only the painted fill is clamped, so a dock booked at 110% reads "110%" over a full ring. Value is bindable.

Shape​

Shape selects a full Ring (the default) or a half-circle Arc. Each shape comes with default angles, and StartAngle and SweepAngle override them: the start is measured in degrees clockwise from three o'clock and the sweep runs from 1 to 360 degrees. A 270-degree sweep starting at 135 gives the classic speedometer shape. Thickness sets the stroke width in pixels and is reduced automatically on small gauges.

Thresholds and Tones​

Tone is the color used while no threshold applies: Neutral, Primary (the default), Success, Warning or Danger. Each MeterThreshold in Thresholds names an absolute value in the gauge's units (From) and the Tone that applies from there up; the highest threshold the value has reached wins. CurrentTone returns the tone in effect.

Value Text​

ValueFormat is a composite format with four arguments: {0} the value, {1} the minimum, {2} the maximum and {3} the fraction of the range. The default, "{3:P0}", shows a percentage. ValueText returns the formatted text in the current culture, ShowValue hides it, and Label adds a caption under it.

Events​

ValueChanged is raised after every change of Value. ThresholdCrossed follows it once for each threshold the change passed, in the order they were crossed, with a MeterThresholdEventArgs carrying the boundary (From), its Tone, the OldValue and NewValue, and IsIncreasing. Set Animated to sweep the fill to the new value; the animation is skipped for users who ask for reduced motion.

How To​

Show Utilization with Warning Levels​

this.gaugeMemory.Shape = RadialGaugeShape.Arc;
this.gaugeMemory.Label = "MEMORY";
this.gaugeMemory.Thresholds.Add(new MeterThreshold(75, MeterTone.Warning));
this.gaugeMemory.Thresholds.Add(new MeterThreshold(90, MeterTone.Danger));
this.gaugeMemory.Animated = true;
this.gaugeMemory.Value = server.MemoryUsedPercent;

Show Units Instead of a Percentage​

this.gaugeDock.Minimum = 0;
this.gaugeDock.Maximum = 48; // pallet slots
this.gaugeDock.Value = dock.BookedSlots;
this.gaugeDock.ValueFormat = "{0:N0} / {2:N0}";
this.gaugeDock.Label = "DOCK 3";

Alert When a Threshold Is Crossed​

private void gaugeDock_ThresholdCrossed(object sender, MeterThresholdEventArgs e)
{
if (e.IsIncreasing && e.Tone == MeterTone.Danger)
AlertBox.Show($"Dock 3 is above {e.From:N0} booked slots.", MessageBoxIcon.Warning);
}

Bind the Value to a Record​

this.gaugePickRate.DataBindings.Add("Value", this.warehouseBindingSource, "PickRatePercent");

Advanced​

JavaScript Widget​

ItemDescription
Class name"wisej.web.RadialGauge"
Theme appearance"radialgauge", see Themes. The "neutral", "primary", "success", "warning" and "danger" states set the gauge color for each tone.
Child components"chart" is the HTML host of the rendered SVG. See JavaScript.