Search results

Title and SubTitle in ASP.NET MVC Bullet Chart control

A title can be given to a bullet chart using the title property to show information about the data plotted.

razor
title.cs
@Html.EJS().BulletChart("container")
                        .Title("Sales Rate")
                        .TargetField("target")
                        .ValueField("value")
                        .Ranges(rn =>
                        {
                            rn.End(35).Add();
                            rn.End(50).Add();
                            rn.End(100).Add();
                        })
                        .Minimum(0).Maximum(100).Interval(20)
                        .DataSource(ViewBag.dataSource)
                        .Render()
public IActionResult Index()
        {
            List<DefaultBulletData> bulletData = new List<DefaultBulletData>
            {
                new DefaultBulletData { value = 55, target = 75}     
            };
            ViewBag.dataSource = bulletData;
            return View();
        }
        public class DefaultBulletData
        {           
            public double value;
            public double target;
        }

SubTitle

A subtitle can also be given to a bullet chart using the subtitle property to show additional information about the data plotted.

razor
sub-title.cs
@Html.EJS().BulletChart("container")
                        .Title("Sales Rate in dollars")
                        .Subtitle("(in dollars $)")
                        .LabelFormat("${value}")
                        .TargetField("target")
                        .ValueField("value")
                        .Ranges(rn =>
                        {
                            rn.End(35).Add();
                            rn.End(50).Add();
                            rn.End(100).Add();
                        })
                        .Minimum(0).Maximum(100).Interval(20)
                        .DataSource(ViewBag.dataSource)
                        .Render()
public IActionResult Index()
        {
            List<DefaultBulletData> bulletData = new List<DefaultBulletData>
            {
                new DefaultBulletData { value = 55, target = 75}     
            };
            ViewBag.dataSource = bulletData;
            return View();
        }
        public class DefaultBulletData
        {           
            public double value;
            public double target;
        }

Title and SubTitle Position

You can place the title and subtitle in different positions. By using the titlePosition property of the bullet chart, you can place the title and subtitles in different positions like left, right, top, and bottom.

Position as Left

By setting the titlePosition to Left, you can display the title and subtitle at the left side of the chart.

razor
left.cs
@Html.EJS().BulletChart("container")
                        .Title("Sales Rate in dollars")
                        .Subtitle("(in dollars $)")
                        .LabelFormat("${value}")
                        .TargetField("target")
                        .ValueField("value")
                        .TitlePosition(Syncfusion.EJ2.Charts.TextPosition.Left)
                        .Ranges(rn =>
                        {
                            rn.End(35).Add();
                            rn.End(50).Add();
                            rn.End(100).Add();
                        })
                        .Minimum(0).Maximum(100).Interval(20)
                        .DataSource(ViewBag.dataSource)
                        .Render()
public IActionResult Index()
        {
            List<DefaultBulletData> bulletData = new List<DefaultBulletData>
            {
                new DefaultBulletData { value = 55, target = 75}     
            };
            ViewBag.dataSource = bulletData;
            return View();
        }
        public class DefaultBulletData
        {           
            public double value;
            public double target;
        }

Position as Right

By setting the titlePosition to Right, you can display the title and subtitle at the right side of the chart.

razor
right.cs
@Html.EJS().BulletChart("container")
                        .Title("Sales Rate in dollars")
                        .Subtitle("(in dollars $)")
                        .LabelFormat("${value}")
                        .TargetField("target")
                        .ValueField("value")
                        .TitlePosition(Syncfusion.EJ2.Charts.TextPosition.Right)
                        .Ranges(rn =>
                        {
                            rn.End(35).Add();
                            rn.End(50).Add();
                            rn.End(100).Add();
                        })
                        .Minimum(0).Maximum(100).Interval(20)
                        .DataSource(ViewBag.dataSource)
                        .Render()
public IActionResult Index()
        {
            List<DefaultBulletData> bulletData = new List<DefaultBulletData>
            {
                new DefaultBulletData { value = 55, target = 75}     
            };
            ViewBag.dataSource = bulletData;
            return View();
        }
        public class DefaultBulletData
        {           
            public double value;
            public double target;
        }

Position as Top

By setting the titlePosition to Top, you can display the title and subtitle at the top of the chart. The default title and subtitle positions of the bullet chart is Top.

razor
top.cs
@Html.EJS().BulletChart("container")
                        .Title("Sales Rate in dollars")
                        .Subtitle("(in dollars $)")
                        .LabelFormat("${value}")
                        .TargetField("target")
                        .ValueField("value")
                        .TitlePosition(Syncfusion.EJ2.Charts.TextPosition.Top)
                        .Ranges(rn =>
                        {
                            rn.End(35).Add();
                            rn.End(50).Add();
                            rn.End(100).Add();
                        })
                        .Minimum(0).Maximum(100).Interval(20)
                        .DataSource(ViewBag.dataSource)
                        .Render()
public IActionResult Index()
        {
            List<DefaultBulletData> bulletData = new List<DefaultBulletData>
            {
                new DefaultBulletData { value = 55, target = 75}     
            };
            ViewBag.dataSource = bulletData;
            return View();
        }
        public class DefaultBulletData
        {           
            public double value;
            public double target;
        }

Position as Bottom

By setting the titlePosition to Bottom, you can display the title and subtitle at the bottom of the chart.

razor
bottom.cs
@Html.EJS().BulletChart("container")
                        .Title("Sales Rate in dollars")
                        .Subtitle("(in dollars $)")
                        .LabelFormat("${value}")
                        .TargetField("target")
                        .ValueField("value")
                        .TitlePosition(Syncfusion.EJ2.Charts.TextPosition.Bottom)
                        .Ranges(rn =>
                        {
                            rn.End(35).Add();
                            rn.End(50).Add();
                            rn.End(100).Add();
                        })
                        .Minimum(0).Maximum(100).Interval(20)
                        .DataSource(ViewBag.dataSource)
                        .Render()
public IActionResult Index()
        {
            List<DefaultBulletData> bulletData = new List<DefaultBulletData>
            {
                new DefaultBulletData { value = 55, target = 75}     
            };
            ViewBag.dataSource = bulletData;
            return View();
        }
        public class DefaultBulletData
        {           
            public double value;
            public double target;
        }

Title Customization

You can customize the bullet chart title’s fontStyle, size, color, fontWeight, and fontFamily using the titleStyle property.

razor
title-custom.cs
@Html.EJS().BulletChart("container")
                        .Title("Sales Rate in dollars")
                        .Subtitle("(in dollars $)")
                        .LabelFormat("${value}")
                        .TargetField("target")
                        .ValueField("value")
                        .TitleStyle(ts =>
                        {
                            ts.Size("22px").Color("red").FontFamily("cursive").FontWeight("Bold).Add();
                        })
                        .Ranges(rn =>
                        {
                            rn.End(35).Add();
                            rn.End(50).Add();
                            rn.End(100).Add();
                        })
                        .Minimum(0).Maximum(100).Interval(20)
                        .DataSource(ViewBag.dataSource)
                        .Render()
public IActionResult Index()
        {
            List<DefaultBulletData> bulletData = new List<DefaultBulletData>
            {
                new DefaultBulletData { value = 55, target = 75}     
            };
            ViewBag.dataSource = bulletData;
            return View();
        }
        public class DefaultBulletData
        {           
            public double value;
            public double target;
        }

SubTitle Customization

You can customize the bullet chart subtitle’s fontStyle, size, color, fontWeight, and fontFamily using the subtitleStyle property.

razor
sub-title-custom.cs
@Html.EJS().BulletChart("container")
                        .Title("Sales Rate in dollars")
                        .Subtitle("(in dollars $)")
                        .LabelFormat("${value}")
                        .TargetField("target")
                        .ValueField("value")
                        .SubTitleStyle(ts =>
                        {
                            ts.Size("22px").Color("red").FontFamily("cursive").FontWeight("Bold).Add();
                        })
                        .Ranges(rn =>
                        {
                            rn.End(35).Add();
                            rn.End(50).Add();
                            rn.End(100).Add();
                        })
                        .Minimum(0).Maximum(100).Interval(20)
                        .DataSource(ViewBag.dataSource)
                        .Render()
public IActionResult Index()
        {
            List<DefaultBulletData> bulletData = new List<DefaultBulletData>
            {
                new DefaultBulletData { value = 55, target = 75}     
            };
            ViewBag.dataSource = bulletData;
            return View();
        }
        public class DefaultBulletData
        {           
            public double value;
            public double target;
        }