Search results

Tooltip in ASP.NET Core Bullet Chart control

28 Jul 2021 / 1 minute to read

BulletChart will display details about the actual and target values through tooltip, when the mouse is moved over the target and feature bar.

Default Tooltip

By setting enableproperty to true. By default tooltip is visible in bullet-chart.

tagHelper
tool-tip.cs
Copied to clipboard
<ejs-bulletchart id="bulletgraph" height="400" title="Profit in %" minimum="0" maximum="20" interval="5" categoryField="category" valueField="value" targetField="comparativeMeasureValue" dataSource="ViewBag.dataSource">
        <e-bullet-range-collection>
            <e-bullet-range end="5"></e-bullet-range>
            <e-bullet-range end="15"></e-bullet-range>
            <e-bullet-range end="20"></e-bullet-range>
        </e-bullet-range-collection>
        <e-bulletchart-tooltipsettings enable="true"></e-bulletchart-tooltipsettings>
</ejs-bulletchart>
Copied to clipboard
public IActionResult Index()
        {
            List<DefaultBulletData> bulletData = new List<DefaultBulletData>
            {
                new DefaultBulletData { value = 5, comparativeMeasureValue = 7.5, category= "2001"},
                new DefaultBulletData { value = 7, comparativeMeasureValue = 5, category= "2002"},
                new DefaultBulletData { value = 10, comparativeMeasureValue = 6, category= "2003"},
                new DefaultBulletData { value = 5, comparativeMeasureValue = 8, category= "2004"},
                new DefaultBulletData { value = 12, comparativeMeasureValue = 5, category= "2005"},
                new DefaultBulletData { value = 8, comparativeMeasureValue = 6, category= "2006"}
            };
            ViewBag.dataSource = bulletData;
            return View();
        }
        public class DefaultBulletData
        {           
            public double value;
            public double comparativeMeasureValue;
            public string category;
        }

Tooltip Template

Any HTML elements can be displayed in the tooltip by using the template property of the tooltip. You can use the ${target} and ${value} as place holders in the HTML element to display the value and target values of the corresponding data point.

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.