Search results

User Interaction in ASP.NET Core Circular Gauge control

Tooltip for pointers

Circular gauge will displays the pointer details through tooltip, when the mouse is moved over the pointer.

Enable Tooltip

By default, tooltip is not visible. Enable the tooltip by setting enable property to true.

tagHelper
tooltip.cs
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular">
        <e-circulargauge-tooltip enable="true"></e-circulargauge-tooltip>
        <e-circulargauge-axes>
            <e-circulargauge-axis>
                <e-circulargauge-pointers>
                    <e-circulargauge-pointer value="50"></e-circulargauge-pointer>
                </e-circulargauge-pointers>
            </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();
        }
    }
}

Template

Any HTML elements can be displayed in the tooltip by using the template property of the tooltip.

tagHelper
template.cs
@using Syncfusion.EJ2;
<div id="container">
    <ejs-circulargauge id="circular">
        <e-circulargauge-tooltip enable="true" template="#template-tooltip"></e-circulargauge-tooltip>
        <e-circulargauge-axes>
            <e-circulargauge-axis>
                <e-circulargauge-pointers>
                    <e-circulargauge-pointer value="50"></e-circulargauge-pointer>
                </e-circulargauge-pointers>
            </e-circulargauge-axis>
        </e-circulargauge-axes>
    </ejs-circulargauge>
</div>
<script id='template-tooltip' type="text/x-template">
    <div id='templateWrap'>
        <div class='des' style="float: right; padding-left:10px; line-height:30px;">
            <span>Pointer &nbsp;&nbsp;:&nbsp; ${Math.round(value)}</span>
        </div>
    </div>
</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;

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

Tooltip for ranges

Circular gauge displays the information about the ranges through tooltip when hovering the mouse over the ranges. You can enable this feature by setting the type property of tooltip to ‘Range’ in the array collection.

Tooltip customization for ranges

To customize the range tooltip, use the rangeSettings property in tooltip. The following options are available to customize the range tooltip:

  • fill - Specifies the range tooltip fill color.
  • textStyle - Specifies the range tooltip text style.
  • format - Specifies the range content format.
  • template - Specifies the custom template for tooltip.
  • enableAnimation - Animates as it moves from one point to another.
  • border - Specifies the tooltip border.
  • showMouseAtPosition - Displays the position of the tooltip on the cursor position.

Tooltip for annotations

Circular gauge displays the information about the annotations through tooltip when hovering the mouse over the annotation. You can enable this feature by setting the type property of tooltip to ‘Annotation’ in the array collection.

Tooltip customization for annotations

To customize the annotation tooltip, use the annotationSettings property in tooltip. The following options are available to customize the annotation tooltip:

  • fill - Specifies the annotation tooltip fill color.
  • textStyle - Specifies the annotation tooltip text style.
  • format - Specifies the annotation content format.
  • template - Specifies the tooltip content with custom template.
  • enableAnimation - Animates as it moves from one point to another.
  • border - Specifies the tooltip border.

The following code example shows the tooltip for the pointers, ranges and annotations.

tagHelper
range-annotation-tooltip.cs
@using Syncfusion.EJ2;
<ejs-circulargauge id="circular">
        <e-circulargauge-tooltip enable="true" enableAnimation="false" type='new string[]{"Pointer", "Range", "Annotation"}'>
            <e-tooltipsettings-annotationSettings format="Circulargauge">
            </e-tooltipsettings-annotationSettings>
            <e-tooltipsettings-rangeSettings fill="red">
            </e-tooltipsettings-rangeSettings>
        </e-circulargauge-tooltip>
        <e-circulargauge-axes>
            <e-circulargauge-axis startAngle="240" endAngle="120" minimum="0" maximum="120" radius="80%">
                <e-axis-linestyle width="0"></e-axis-linestyle>
                <e-axis-labelstyle useRangeColor="true">
                </e-axis-labelstyle>
                <e-axis-majorticks color="white" offset="-5" height="12"></e-axis-majorticks>
                <e-axis-minorticks color="transparent" width="0"></e-axis-minorticks>
                <e-circulargauge-annotations>
                    <e-circulargauge-annotation content="CircularGauge" zIndex="1" angle="180"></e-circulargauge-annotation>
                </e-circulargauge-annotations>
                <e-circulargauge-ranges>
                    <e-circulargauge-range start="0" end="50" startWidth="10" endWidth="10" radius="102%"></e-circulargauge-range>
                    <e-circulargauge-range start="50" end="120" startWidth="10" endWidth="10" radius="102%"></e-circulargauge-range>
                </e-circulargauge-ranges>
                <e-circulargauge-pointers>
                    <e-circulargauge-pointer value="50"></e-circulargauge-pointer>
                </e-circulargauge-pointers>
            </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();
        }
    }
}

Pointer Drag

Pointers can be dragged over the axis value. This can be achieved by clicking and dragging the pointer. To enable or disable the pointer drag, you can use enablePointerDrag property.

tagHelper
pointer-drag.cs
@using Syncfusion.EJ2;
<div id="container">
    <ejs-circulargauge id="circular" enablePointerDrag="true">
        <e-circulargauge-tooltip enable="true" template="#template-tooltip"></e-circulargauge-tooltip>
        <e-circulargauge-axes>
            <e-circulargauge-axis>
                <e-circulargauge-pointers>
                    <e-circulargauge-pointer value="50"></e-circulargauge-pointer>
                </e-circulargauge-pointers>
            </e-circulargauge-axis>
        </e-circulargauge-axes>
    </ejs-circulargauge>
</div>
<script id='template-tooltip' type="text/x-template">
    <div id='templateWrap'>
        <div class='des' style="float: right; padding-left:10px; line-height:30px;">
            <span>Pointer &nbsp;&nbsp;:&nbsp; ${Math.round(value)}</span>
        </div>
    </div>
</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;

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