Appearance in Circular Gauge Control

19 Jun 202410 minutes to read

Gauge Title

Circular gauge can be given a title by using title property, to show the information about the gauge. Title can be customized by using titleStyle property in gauge.

@using Syncfusion.EJ2;

<ejs-circulargauge id="circular" title="Speedometer">
    <e-circulargauge-titlestyle color="red"></e-circulargauge-titlestyle>
</ejs-circulargauge>

Gauge Position

Gauge can be positioned anywhere in the container with the help of centerX and centerY property and it accepts values either in percentage or in pixels. The default value of the centerX and centerY property is 50%, which means gauge will get rendered to the centre of the container.

In Pixel

You can set the mid point of the gauge in pixel as demonstrated below,

@using Syncfusion.EJ2;

<ejs-circulargauge id="circular" centerX="20" centerY="50">
    <e-circulargauge-axes>
        <e-circulargauge-axis startAngle="0" endAngle="180">
            <e-axis-linestyle color="#F8F8F8" width="2"></e-axis-linestyle>
        </e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>

In Percentage

By setting the value in percentage, gauge gets its mid point with respect to its plot area. For example, when the centerX value as ‘0%’ and centerY value is ‘50%’, gauge will get positioned at the top left corner of the plot area.

@using Syncfusion.EJ2;

<ejs-circulargauge id="circular" centerX="10%" centerY="50%">
    <e-circulargauge-axes>
        <e-circulargauge-axis startAngle="0" endAngle="180">
            <e-axis-linestyle color="#F8F8F8" width="2"></e-axis-linestyle>
        </e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>

Area Customization

Customize the gauge background

Using background and border properties, you can change the background color and border of the circular gauge.

@using Syncfusion.EJ2;

<ejs-circulargauge id="circular" background="skyblue">
    <e-circulargauge-border color="#FF0000" width="2"></e-circulargauge-border>
        <e-circulargauge-axes>
            <e-circulargauge-axis radius="90%" maximum="120" startAngle="230" endAngle="130"></e-circulargauge-axis>
        </e-circulargauge-axes>
</ejs-circulargauge>

Gauge Margin

You can set margin for gauge from its container through margin property.

@using Syncfusion.EJ2;

<ejs-circulargauge id="circular" background="skyblue">
    <e-circulargauge-border color="#FF0000" width="2"></e-circulargauge-border>
    <e-circulargauge-margin left="40" right="40" bottom="40" top="40"></e-circulargauge-margin>
    <e-circulargauge-axes>
        <e-circulargauge-axis radius="90%" maximum="120" startAngle="230" endAngle="130"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>

Radius calculation based on angles

Render semi or quarter circular gauges by modifying the start and end angles. By enabling the radius based on angle option, the radius of circular gauge will be calculated based on the start and end angles to avoid excess white space.

@using Syncfusion.EJ2;

<ejs-circulargauge id="circular" background="skyblue" moveToCenter="true">
    <e-circulargauge-axes>
        <e-circulargauge-axis startAngle="270" endAngle="90"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>

NOTE

View Sample in GitHub.