Search results

User Interaction in ASP.NET Core Linear Gauge

27 Jul 2021 / 2 minutes to read

Tooltip

Linear Gauge displays the details about a pointer value through e-lineargauge-tooltip, when the mouse hovers over the pointer. To enable the tooltip, set Enable property as ”true“.

tagHelper
Copied to clipboard
@using Syncfusion.EJ2.LinearGauge

<ejs-lineargauge id="gauge">
    <e-lineargauge-tooltip Enable="true"></e-lineargauge-tooltip>
    <e-lineargauge-axes>
        <e-lineargauge-axis>
            <e-lineargauge-pointers>
                <e-lineargauge-pointer Value="80"></e-lineargauge-pointer>
            </e-lineargauge-pointers>
        </e-lineargauge-axis>
    </e-lineargauge-axes>
</ejs-lineargauge>

Linear Gauge with tooltip for pointer value

Tooltip format

Tooltip in the Linear Gauge control can be formatted using the Format property in e-lineargauge-tooltip. It is used to render the tooltip in certain format or to add a user-defined unit in the tooltip. By default, the tooltip shows the pointer value only. In addition to that, more information can be added in the tooltip. For example, the format ”{value}km” shows pointer value with kilometer unit in the tooltip.

tagHelper
Copied to clipboard
using Syncfusion.EJ2.LinearGauge

<ejs-lineargauge id="gauge">
    <e-lineargauge-tooltip Enable="true" Format="{value}km"></e-lineargauge-tooltip>
    <e-lineargauge-axes>
        <e-lineargauge-axis>
            <e-lineargauge-pointers>
                <e-lineargauge-pointer Value="80"></e-lineargauge-pointer>
            </e-lineargauge-pointers>
        </e-lineargauge-axis>
    </e-lineargauge-axes>
</ejs-lineargauge>

Linear Gauge with tooltip format for pointer value

Tooltip Template

The HTML element can be rendered in the tooltip of the Linear Gauge using the Template property in e-lineargauge-tooltip. The ”${value}” can be used as placeholders in the HTML element to display the pointer values of the corresponding axis.

tagHelper
Copied to clipboard
@using Syncfusion.EJ2.LinearGauge

<ejs-lineargauge id="gauge">
    <e-lineargauge-tooltip Enable="true" Template="<div>Pointer: 80 </div>"></e-lineargauge-tooltip>
    <e-lineargauge-axes>
        <e-lineargauge-axis>
            <e-lineargauge-pointers>
                <e-lineargauge-pointer Value="80"></e-lineargauge-pointer>
            </e-lineargauge-pointers>
        </e-lineargauge-axis>
    </e-lineargauge-axes>
</ejs-lineargauge>

Linear Gauge with tooltip template for pointer value

Customize the appearance of the tooltip

The tooltip can be customized using the following properties in e-lineargauge-tooltip.

  • Fill - To fill the color for tooltip.
  • EnableAnimtion - To enable or disable the tooltip animation.
  • Border - To set the color and width for the border of the tooltip.
  • TextStyle - To customize the style of the text in tooltip.
  • ShowAtMousePosition - To show the tooltip at the mouse position.
tagHelper
Copied to clipboard
@using Syncfusion.EJ2.LinearGauge

<ejs-lineargauge id="gauge">
    <e-lineargauge-tooltip Enable="true" Fill="#e5bcbc">
        <e-tooltipsettings-border Width="2" Color="#d80000"></e-tooltipsettings-border>
    </e-lineargauge-tooltip>
    <e-lineargauge-axes>
        <e-lineargauge-axis>
            <e-lineargauge-pointers>
                <e-lineargauge-pointer Value="80"></e-lineargauge-pointer>
            </e-lineargauge-pointers>
        </e-lineargauge-axis>
    </e-lineargauge-axes>
</ejs-lineargauge>

Linear Gauge with tooltip customization

Positioning the tooltip

The tooltip is positioned at the ”End” of the pointer. To change the position of the tooltip at the start, or center of the pointer, set the Position property to ”Start” or ”Center“.

tagHelper
Copied to clipboard
@using Syncfusion.EJ2.LinearGauge

<ejs-lineargauge id="gauge">
    <e-lineargauge-tooltip Enable="true" Position="Center">
    </e-lineargauge-tooltip>
    <e-lineargauge-axes>
        <e-lineargauge-axis>
            <e-lineargauge-pointers>
                <e-lineargauge-pointer Value="50" Type="Bar" Color="blue"></e-lineargauge-pointer>
            </e-lineargauge-pointers>
        </e-lineargauge-axis>
    </e-lineargauge-axes>
</ejs-lineargauge>

Linear Gauge with tooltip position

Pointer Drag

To drag either marker or bar pointer to the desired axis value, set the EnableDrag property as ”true” in e-lineargauge-pointer.

tagHelper
Copied to clipboard
@using Syncfusion.EJ2.LinearGauge

<ejs-lineargauge id="gauge">
    <e-lineargauge-axes>
        <e-lineargauge-axis>
            <e-lineargauge-pointers>
                <e-lineargauge-pointer EnableDrag="true" Value="80"></e-lineargauge-pointer>
            </e-lineargauge-pointers>
        </e-lineargauge-axis>
    </e-lineargauge-axes>
</ejs-lineargauge>

Linear Gauge with pointer drag