Everything You Need to Know About WinUI 3 Linear Gauge
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (175).NET Core  (29).NET MAUI  (208)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (220)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (101)Streamlit  (1)Succinctly series  (131)Syncfusion  (919)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (150)Chart  (132)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (633)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (508)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (11)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (597)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Everything You Need to Know About the WinUI 3 Linear Gauge

Everything You Need to Know About WinUI 3 Linear Gauge

The WinUI 3 Linear Gauge control is a multipurpose data visualization control that displays numerical values on a linear scale horizontally or vertically. It has a rich set of features, such as ranges and pointers, that are fully customizable and extendable. You can use it to create a value indicator, linear progress bar, thermometer, bullet chart, and more.

The WinUI Linear Gauge control’s main features:

Let’s check these features out and learn how to integrate the WinUI 3 Linear Gauge control into your application.

Linear axis

The Linear axis is a linear scale on which a set of values are plotted. It has three sub-elements:

  • Axis line: A linear line, we can customize its thickness, color, and edge corner styles. Its color can be either solid or a linear gradient.
  • Ticks: There are two types of ticks, major and minor, and we can easily customize their styles.
  • Labels: Lables allow you to add numeric content to depict the values in the scale. You can easily customize the label styles and value formats.
WinUI Linear Gauge Axis Elements Customization
WinUI Linear Gauge Axis Elements Customization

Linear range

A Linear range is a visual element that helps you quickly visualize where a range value falls on the axis track. It will denote the selected range of values using the start and end points in an axis. We can add any number of ranges with different styles to a Linear Gauge. You can also customize the range position, thickness, and color with a gradient.

Range Customization in WinUI Linear Gauge
Range Customization in WinUI Linear Gauge

Bar pointer

A bar pointer is an accenting line that can be placed on a Linear Gauge to mark the current value in the axis. The bar pointers always start from the minimum value of the axis and end on the specified value.  You can add any number of bar pointers inside the axis to indicate values. You can also customize the bar pointer’s thickness, color, corner styles, and position.

Bar Pointer Customization in WinUI Linear Gauge
Bar Pointer Customization in WinUI Linear Gauge

Marker pointer

Marker pointers are used to indicate specific values on the axis. There are two types of marker pointers, shape pointer and content pointer.

Shape pointer

The shape marker pointer has these predefined shapes:

  • Triangle
  • Inverted triangle
  • Circle
  • Diamond
  • Rectangle

We can customize the size, position, and color of the shape pointer.

Shape Marker Pointers in WinUI Linear Gauge
Shape Marker Pointers in WinUI Linear Gauge

Content pointer

If the predefined shapes in the shape marker pointer don’t suit your needs, then you can use the content marker pointer. It allows you to use any kind of content such as icons, text, or images as marker pointers, with a complete set of custom options.

Content Marker Pointer in WinUI Linear Gauge
Content Marker Pointer in WinUI Linear Gauge

Pointer animation

The WinUI 3 Linear Gauge control provides visual appeal when the pointer moves from one value to another. It also supports various pointer animations.

Pointer Animation in WinUI Linear Gauge
Pointer Animation in WinUI Linear Gauge

Pointer interaction

Drag a marker pointer from one value to another to change the value at run time.

Interacting with Pointer in WinUI Linear Gauge
Interacting with Pointer in WinUI Linear Gauge

Add the WinUI 3 Linear Gauge control to your application

We have seen the features of the WinUI 3 Linear Gauge control. Let’s learn how to create a simple WinUI 3 application with the Linear Gauge control to demonstrate its basic usage.

Step 1: Create a WinUI 3 application.

First, create a simple project using the instructions provided in the getting started with WinUI 3 apps and Build apps with the Windows App SDK documentation.

Step 2: Install the NuGet package.

Then, install the latest Syncfusion.Gauges.WinUI NuGet package in the application from NuGet or from the installed location, C:\Program Files (x86)\Syncfusion\Essential Studio\WinUI\xx.x.x.xx\NuGetPackages.

Note: The xx.x.x.xx denotes the version of the Syncfusion WinUI 3 – Windows App SDK Gauge package.

Step 3: Add the namespace and initialize the Linear Gauge control.

Now, import the Syncfusion.UI.Xaml.Gauges namespace in the XAML file and initialize the Linear Gauge control as shown in the following code example.

xmlns:gauge="using:Syncfusion.UI.Xaml.Gauges"
…
<gauge:SfLinearGauge />

Step 4: Add axis to the Linear Gauge.

You can set a linear axis for the gauge using the Axis property of the SfLinearGauge class. Then, specify the minimum and maximum values of the axis using the Minimum and Maximum properties.

Refer to the following code example.

<gauge:SfLinearGauge>
   <gauge:SfLinearGauge.Axis>
       <gauge:LinearAxis Minimum="0"
                Maximum="140" />
   </gauge:SfLinearGauge.Axis>
</gauge:SfLinearGauge>
Rendering Linear Gauge Axis
Rendering Linear Gauge Axis

Step 5: Add a range to the Linear Gauge.

The range contains a list of range elements. You can add any number of ranges inside the axis. Specify the start value, end value, and background color for a range using the StartValue, EndValue, and Background properties, respectively.

Refer to the following code example.

<gauge:SfLinearGauge>
     <gauge:SfLinearGauge.Axis>
            <gauge:LinearAxis Maximum="140"
                     Interval="10">
                 <gauge:LinearAxis.Ranges>
                      <gauge:LinearGaugeRange StartValue="0"
                                        EndValue="50"
                                        Background="Red" />
                      <gauge:LinearGaugeRange StartValue="50"
                                        EndValue="100"
                                        Background="Orange" />
                      <gauge:LinearGaugeRange StartValue="100"
                                        EndValue="140"
                                        Background="Green" />
                 </gauge:LinearAxis.Ranges>
           </gauge:LinearAxis>
    </gauge:SfLinearGauge.Axis>
</gauge:SfLinearGauge>
Redering Custom Linear Gauge Range
Redering Custom Linear Gauge Range

Step 6: Add a pointer to the Linear Gauge.

Pointers contain a variety of pointer elements, and you can add any kind of pointer – such as bar pointers, shape pointers, and content pointers – to the linear axis to indicate a value. The Value property is used to specify the value of the pointer.

Refer to the following code example.

<gauge:SfLinearGauge>
    <gauge:SfLinearGauge.Axis>
          <gauge:LinearAxis Maximum="140"
                     Interval="10">
              ...
              <gauge:LinearAxis.BarPointers>
                   <gauge:BarPointer Value="90" />
              </gauge:LinearAxis.BarPointers>

              <gauge:LinearAxis.MarkerPointers>
                 <gauge:ShapePointer Value="90"
                             VerticalAnchor="End"
                             OffsetPoint="0,-8" />

                 <gauge:ContentPointer Value="90"
                               VerticalAnchor="End"
                               OffsetPoint="0,-28">
                     <gauge:ContentPointer.Content>
                         <TextBlock Text="90%" />
                     </gauge:ContentPointer.Content>
                 </gauge:ContentPointer>

            </gauge:LinearAxis.MarkerPointers>
        </gauge:LinearAxis>
   </gauge:SfLinearGauge.Axis>
</gauge:SfLinearGauge>
Adding Pointer to WinUI Linear Gauge
Adding Pointer to WinUI Linear Gauge

GitHub reference

For more information, refer to our WinUI Linear Gauge Getting Started demo.

Conclusion

Thanks for reading! I hope you enjoyed learning about the Syncfusion WinUI 3 Linear Gauge control and its features. For more details, refer to our WinUI Linear Gauge user guide and GitHub demos. Additionally, you can download and check out our demo app in the Windows Store. Use this control to design your brightness, volume, and gradient controls.

If you aren’t a customer yet, you can try our 30-day free trial to check out these features.

If you need a specific feature in our WinUI Linear Gauge control, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Related blogs

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed