You can add multiple ranges to a single gauge. Each range denotes a region that can help the user identify the state of the gauge's value. Every range has a Minimum and Maximum represented by Min and Max properties. These properties specify the range's position on the Gauge. Other properties such as Color can also be used to customize the appearance of the ranges appearing on the gauge.
The following code example demonstrates how to add ranges to a C1Gauge and customize some of the other properties to enhance their visual appeal.
Create new instances of type GaugeRange, set their properties and add the newly created ranges to the any of the gauges.
C# |
Copy Code |
---|---|
//Create Ranges GaugeRange low = new GaugeRange(); GaugeRange med = new GaugeRange(); GaugeRange high = new GaugeRange(); //Customize Ranges low.Min = 0; low.Max = 30; low.Color = Color.Red.ToArgb(); med.Min = 30; med.Max = 70; med.Color = Color.Yellow.ToArgb(); high.Min = 70; high.Max = 100; high.Color = Color.ForestGreen.ToArgb(); //Add Ranges to the Gauge linearGauge.ShowRanges = true; linearGauge.Ranges.Add(low); linearGauge.Ranges.Add(med); linearGauge.Ranges.Add(high); |