Infragistics Charts - How to customize title of Chart

In previous post How to create charts in ASP.Net using Infragistics controls I talked about very basics to get started. In this post I will discuss how to customize titles of chart. This is one of the important parts of your chart because each report or chart needs a title to convey to the user what this chart or report is all about. Infragistics Charts offer few ways to set titles for your chart.

Open the page where you have your chart control. Use Quick Design option in menu for chart control. You will see a dialog box as show below and neat bottom of tree you will see following four options.

  • Title Left
  • Title Top
  • Title Right
  • Title Bottom

As the names suggest IG offers you four places where you could set title(s) for your chart. If you click any of the options for title in the design tree, you will see all the properties that you can set. Configure how you want to display the title and you are good to go.

Programatically setting chart title properties

A lot of time you want to set the chart titles at run time based on some conditions. You can definitely do that from code. You can set the same properties in code as you set from designer. Chart object exposes TitleLeft, TitleTop, TitleRight and TitleBottom proeprties to accomplish that. Following code snippet shows how I tried to set up top title for my chart.

void SetChartTitles()
{
    WeeklyEarningsByRaceChart.TitleTop.Visible = true;
    WeeklyEarningsByRaceChart.TitleTop.Text = "Weekly Earnings By Race";
    WeeklyEarningsByRaceChart.TitleTop.Font = new Font("Verdana", 10f, FontStyle.Bold);
}
comments powered by Disqus

Search

Social

Weather

9.2 °C / 48.5 °F

weather conditions Clouds

Monthly Posts

Blog Tags