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.
@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.
@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.
@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
fill
- Specifies fill color for tooltipborder
- Specifies tooltip border width and colortextStyle
- Specifies the tooltip text style, such as color, font family, font style and font weight@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();
}
}
}
You can drag and drop either marker or bar pointer over the desired axis value using enableDrag
property in the pointer
.
@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();
}
}
}