Search results

User Interaction

Tooltip

Linear gauge will display the details about the pointer value through tooltip, when the mouse is moved over the pointer. By default, tooltip will not be visible and you can enable the tooltip by setting enable property to true.

razor
tooltip.cs
@using Syncfusion.EJ2;
@Html.EJS().LinearGauge("linear").Load("gaugeLoad").Tooltip(new
{
    enable = true
}).Render()
<script>
    window.gaugeLoad = function (args) {
        var axis = args.gauge.axes[0];
        axis.pointers = [{
            value: 80
        }]
    }
</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.LinearGauge;


namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {

            return View();
        }
    }
}

Format the Tooltip

By default, tooltip will show the pointer value only. In addition to that, you can show more information in tooltip. For example, the format ${value} shows pointer value with currency symbol.

razor
tooltip-format.cs
@using Syncfusion.EJ2;
@Html.EJS().LinearGauge("linear").Load("gaugeLoad").Tooltip(new
{
    enable = true,
    format = "${value}"
}).Render()
<script>
    window.gaugeLoad = function (args) {
        var axis = args.gauge.axes[0];
        axis.pointers = [{
            value: 80
        }]
    }
</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.LinearGauge;


namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {

            return View();
        }
    }
}

Tooltip Template

Any HTML elements can be displayed in the tooltip by using the template property of the tooltip. You can use the {value} as placeholders in the HTML element to display the pointer values of the corresponding axis.

razor
tooltip-template.cs
@using Syncfusion.EJ2;
@Html.EJS().LinearGauge("linear").Load("gaugeLoad").Tooltip(new
{
    enable = true,
    template = "<div>Pointer: 80 </div>"
}).Render()
<script>
    window.gaugeLoad = function (args) {
        var axis = args.gauge.axes[0];
        axis.pointers = [{
            value: 80
        }]
    }
</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.LinearGauge;


namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {

            return View();
        }
    }
}

Customize the Appearance of Tooltip

The fill and border properties are used to customize the background color and border of the tooltip respectively. The textStyle property in the tooltip is used to customize the font of the tooltip text.

razor
tooltip-appearance.cs
@using Syncfusion.EJ2;
@Html.EJS().LinearGauge("linear").Load("gaugeLoad").Tooltip(new
{
    enable = true,
    fill = "#e5bcbc",
    border = new
    {
        color = "#d80000",
        width = 2
    }
}).Render()
<script>
    window.gaugeLoad = function (args) {
        var axis = args.gauge.axes[0];
        axis.pointers = [{
            value: 80
        }]
    }
</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.LinearGauge;


namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {

            return View();
        }
    }
}

Pointer Drag

You can drag and drop either marker or bar pointer over the desired axis value using enableDrag property in the pointer.

razor
pointer-drag.cs
@using Syncfusion.EJ2;
@Html.EJS().LinearGauge("linear").Load("gaugeLoad").Render()
<script>
    window.gaugeLoad = function (args) {
        var axis = args.gauge.axes[0];
        axis.pointers = [{
            value: 80,
            enableDrag : true
        }]
    }
</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.LinearGauge;


namespace EJ2_Core_Application.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {

            return View();
        }
    }
}