Search results

Axes

By default, gauge will be displayed with an axis. Each axis contains its own ranges, pointers and annotation.

Axis Customization

You can customize the width and color of an axis line by using lineStyle property. Background for an axis can be customized by using background property.

tagHelper
axes.cs
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular">
    <e-circulargauge-axes>
        <e-circulargauge-axis lineStyle="linestyle" background="rgba(0, 128, 128, 0.3)"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Angles and Direction

Circular gauge axis can sweep from 0 to 360 degrees. By default start angle of an axis is 200 degree and end angle is 160 degree and you can customize this option by using startAngle and endAngle property.

tagHelper
angles.cs
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis startAngle="270" endAngle="90" ></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

The direction property enables you to render the gauge axis either in ClockWise or in AntiClockWise direction.

tagHelper
direction.cs
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis direction="AntiClockWise"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Axis Radius

By default, radius of an axis is calculated based on the available size. You can customize this, by using radius property. It takes value either in percentage or in pixel.

In Pixel

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

tagHelper
radius-pixel.cs
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis radius="150"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

In Percentage

By setting value in percentage, gauge gets its dimension with respect to its available size. For example, when the radius is ‘50%’, gauge renders to half of the available size.

tagHelper
radius-percentage.cs
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis radius="50%"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Ticks

You can customize the height, color and width of major and minor ticks by using majorTicks and minorTicks property. By default, interval for majorTicks will be calculated automatically and also you can customize the interval for major and minor ticks using interval property.

tagHelper
ticks.cs
@{
    var majorticks = new
    {
        interval = 10,
        color = "red",
        height = 10,
        width = 3
    };
    var minorticks = new
    {
        interval = 5,
        color = "green",
        height = 5,
        width = 2

    };
}
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis majorTicks="majorticks" minorTicks="minorticks"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Tick Position

Both minor and major ticks can be moved by using offset and position property. The offset defines the distance between the axis and ticks. By default, offset value is 0. The position will place the ticks either inside or outside of the axis. By default, ticks will be placed inside the axis.

tagHelper
tick-position.cs
@{
    var majorticks = new
    {
        interval = 10,
        color = "red",
        height = 10,
        width = 3,
        position = "Inside",
        offset = 5

    };
    var minorticks = new
    {
        interval = 5,
        color = "green",
        height = 5,
        width = 2,
        position = "Inside",
        offset = 5

    };
}
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis majorTicks="majorticks" minorTicks="minorticks"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Labels

Labels of an axis can be customized by using font property in labelStyle options.

tagHelper
labels.cs
@{
    var labelstyle = new
    {
        font = new
        {
            color = "red",
            size = "20px",
            fontWeight = "Bold"

        }
    };
}
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis labelStyle="labelstyle"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Label Position

Labels can be moved by using offset or position property. The offset defines the distance between the labels and ticks. By default, offset value is 0. The position will place the labels either inside or outside of the axis. By default, labels will be placed inside the axis.

tagHelper
label-position.cs
@{
    var labelstyle = new
    {
        position="Outside",
        offset=5
    };
}
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular">
    <e-circulargauge-axes>
        <e-circulargauge-axis labelStyle="labelstyle"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Auto Angle

Labels can be swept along the axis angle by enabling autoAngle property.

tagHelper
auto-angles.cs
@{
    var labelstyle = new
    {
        autoAngle=true
    };
}
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular">
    <e-circulargauge-axes>
        <e-circulargauge-axis labelStyle="labelstyle"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Smart Labels

When an axis makes a complete circle, then the first and last label of the axis will get overlap with each other. In this scenario, you can either hide 1st or last label using hiddenLabel property. When hiddenLabel value is First, then the 1st label will be hidden and when the hiddenLabel value is ‘Last’, then the last label will be hidden.

tagHelper
smart-labels.cs
@{
    var majorticks = new
    {
        interval = 1,
        position = "Inside",
        height = 10

    };
    var minorticks = new
    {
        interval = 0.2,
        position = "Inside",
        height = 5

    };
    var labelstyle = new
    {
        position = "Inside",
        hiddenLabel = "First"
    };
}

@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis minimum="0" maximum="12" startAngle="0" endAngle="360" majorTicks="majorticks" minorTicks="minorticks" labelStyle="labelstyle"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Label Format

Axis labels can be formatted by using format property in labelStyle and its supports all globalize format.

tagHelper
label-format.cs
@{
    var labelstyle = new
    {
      format="p1"
    };
}
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis labelStyle="labelstyle"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

The following table describes the result of applying some commonly used label formats on numeric values.

Label Value Label Format property value Result Description
1000 n1 1000.0 The Number is rounded to 1 decimal place
1000 n2 1000.00 The Number is rounded to 2 decimal place
1000 n3 1000.000 The Number is rounded to 3 decimal place
0.01 p1 1.0% The Number is converted to percentage with 1 decimal place
0.01 p2 1.00% The Number is converted to percentage with 2 decimal place
0.01 p3 1.000% The Number is converted to percentage with 3 decimal place
1000 c1 $1,000.0 The Currency symbol is appended to number and number is rounded to 1 decimal place
1000 c2 $1,000.00 The Currency symbol is appended to number and number is rounded to 2 decimal place

Custom Label Format

Axis labels support custom label format using placeholder like {value}°C, in which the value represent the axis label e.g 20°C.

tagHelper
custom-label-format.cs
@{
    var labelstyle = new
    {
      format="{value}°C"
    };
}
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis labelStyle="labelstyle"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Minimum and Maximum

The minimum and maximum properties enables you to customize the start and end values of an axis.

tagHelper
minMax.cs
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" >
    <e-circulargauge-axes>
        <e-circulargauge-axis maximum="50" minimum="250"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;

namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

Multiple Axes

In addition to the default axis, you can add n number of axis to a gauge. Each axis will have its own ranges, pointers, annotations and customization options.

tagHelper
multiple-axes.cs
@{
    var majorticks = new
    {
        interval = 10,
        position = "Inside",
        height = 10
    };
    var minorticks = new
    {
        interval = 5,
        position = "Inside",
        height = 5
    };
    var majorticks_2 = new
    {

        interval = 10,
        position = "Inside",
        height = 10,
        color = "#27d5ff"
    };
    var minorticks_2 = new
    {
        interval = 5,
        position = "Inside",
        height = 5,
        color = "#27d5ff"

    };
}
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular" load="gaugeload">
    <e-circulargauge-axes>
        <e-circulargauge-axis majorTicks="majorticks" minorTicks="minorticks"></e-circulargauge-axis>
        <e-circulargauge-axis majorTicks="majorticks_2" minorTicks="minorticks_2"></e-circulargauge-axis>
    </e-circulargauge-axes>
</ejs-circulargauge>
<script>
    window.gaugeload = function (args) {
        var axis = args.gauge.axes[0];
        axis.pointers = [];
        args.gauge.axes[1].pointers = [];
    }
</script>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2_Core_Application.Models;
using Newtonsoft.Json;
using Syncfusion.EJ2.Charts;
using Syncfusion.EJ2.CircularGauge;


namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            List<CircularGaugeAxis> axes = new List<CircularGaugeAxis>();
            CircularGaugeAxis axis1 = new CircularGaugeAxis();
            axis1.MajorTicks = new
            {
                interval = 10,
                position = "Inside",
                height = 10
            };
            axis1.MinorTicks= new
            {
                interval = 5,
                position = "Inside",
                height = 5
            };
            axes.Add(axis1);
            CircularGaugeAxis axis2 = new CircularGaugeAxis();
            axis2.MajorTicks= new
            {

                interval = 10,
                position = "Inside",
                height = 10,
                color = "#27d5ff"
            };
            axis2.MinorTicks= new
            {
                interval = 5,
                position = "Inside",
                height = 5,
                color = "#27d5ff"

            };
            axes.Add(axis2);
            ViewBag.Axes = axes;
            return View();
        }
    }
}