Search results

User Interaction in ASP.NET MVC 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.

razor
tooltip.cs
@using Syncfusion.EJ2;
@Html.EJS().CircularGauge("circular2").Axes(axes =>axes
.Pointers(pointer => pointer.Value(70).Add()).Add()).Tooltip(tooltip =>tooltip.Enable(true)).Render()
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.

razor
template.cs
@using Syncfusion.EJ2;
@Html.EJS().CircularGauge("circular2").Axes(axes =>axes
.Pointers(pointer => pointer.Value(70).Add()).Add()).Tooltip(tooltip =>tooltip.Enable(true).Template("#template")).Render()

<script id='template' type="text/x-template">
    <div id='templateWrap'>
        <div class='des' style="float: right; padding-left:10px; line-height:30px;">
            <span>Pointer value : 70</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.

razor
range-annotation-tooltip.cs
@using Syncfusion.EJ2;
@Html.EJS().CircularGauge("container").Tooltip(Tl => Tl.Enable(true).Type(new string[] { "pointer", "Range", "Annotation"})
.RangeSettings(Rs => Rs.fill("red")).AnnotationSettings(As => As.template("<div>CircularGauge</div>").Add())).Axes(axes => axes
	 .Minimum(0).Maximum(120).Radius("90%").StartAngle(240).EndAngle(120).Annotations(annotation => annotation.Content("CircularGauge")
     .ZIndex("1").Angle(180).Add()).LabelStyle(ls => ls.UseRangeColor(true)
	 .Font(font => font.Color("#424242").Size("13px").FontFamily("Roboto")))
	 .Pointers(pt => pt.Value(70).Radius("60%").Color("#33BCBD").Cap(cp => cp.Radius(10).Border(br => br.Width(5).Color("#33BCBD")))
     .Animation(An => An.Enable(false)).Add())
	 .LineStyle(lin => lin.Width(0))
	 .Ranges(range =>
	 {
		 range.Start(0).End(50).Radius("102%").StartWidth(10).EndWidth(10).Color("#3A5DC8").Add();
		 range.Start(50).End(120).Radius("102%").StartWidth(10).EndWidth(10).Color("#33BCBD").Add();
	 })
	 .MajorTicks(mi => mi.Color("white").Offset(-5).Height(12)).MinorTicks(mj => mj.Width(0).Color("transparent")).Add()).Render()
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.

razor
pointer-drag.cs
@using Syncfusion.EJ2;
@Html.EJS().CircularGauge("circular2").EnablePointerDrag(true).Axes(axes =>axes
.Pointers(pointer => pointer.Value(70).Add()).Add()).Tooltip(tooltip =>tooltip.Enable(true).Template("#template")).Render()

<script id='template' type="text/x-template">
        <div id='templateWrap'>
            <div class='des' style="float: right; padding-left:10px; line-height:30px;">
                <span>Pointer value : 70</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();
        }
    }
}