Version 24.2 (latest)

Chart Title and Subtitle

Topic Overview

Purpose

The title and subtitle feature of the XamShapeChart control allows you to add information to the top section of the chart.

When adding a title or subtitle to the chart control, the content of the chart automatically resizes, allowing for the title and subtitle information.

Required Background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic provides conceptual information about the XamShapeChart control including its main features, minimum requirements, and user functionality.

This topic explains how to bind data to the XamShapeChart control.

In this topic

This topic contains the following sections:

Property Settings

You can customize the look and feel of the XamShapeChart control’s title and subtitle in many different ways, such as applying different font styles, margins, and alignment. This can be achieved by using the following properties:

Property Name Property Type Description

string

Title’s text content.

HorizontalAlignment

Title’s horizontal alignment.

FontFamily

Title’s font name.

double

Title’s font size

FontStyle

Title’s font style such as italic.

FontStretch

Title’s font stretch

FontWeight

Title’s font weight such as bold.

Brush

Title’s text color.

Thickness

Title’s margin.

string

Subtitle’s text content.

Brush

Subtitle’s text color.

FontFamily

Subtitle’s font name.

double

Subtitle’s text size.

FontStyle

Subtitle’s font style such as italic.

FontWeight

Subtitle’s font weight such as bold.

HorizontalAlignment

Subtitle’s horizontal alignment.

Thickness

Subtitle’s margin.

Code Snippet

The following code examples show how to customize the title and subtitle in the XamShapeChart control. The following code examples use the Sample Scatter Data resource.

In XAML

<Grid x:Name="layoutRoot">
    <ig:XamShapeChart ItemsSource="{Binding}"
                      Title="Scatter Data"
                      TitleForeground="Red"
                      TitleFontFamily="Verdana"
                      TitleFontSize="24"
                      Subtitle="One Hundred Random Points"
                      SubtitleForeground="Red"
                      SubtitleFontFamily="Verdana"
                      SubtitleFontSize="16" />

</Grid>

In C#

var data = new ScatterDataSource();

var chart = new XamShapeChart();
chart.ItemsSource = data;
chart.Title = "Scatter Data";
chart.TitleForeground = Brushes.Red;
chart.TitleFontFamily = new FontFamily("Verdana");
chart.TitleFontSize = 24;
chart.Subtitle = "One Hundred Random Points";
chart.SubtitleForeground = Brushes.Red;
chart.SubtitleFontFamily = new FontFamily("Verdana");
chart.SubtitleFontSize = 16;

layoutRoot.Children.Add(chart);

In Visual Basic

Dim data = New ScatterDataSource()

Dim chart = New XamShapeChart()
chart.ItemsSource = data
chart.Title = "Scatter Data"
chart.TitleForeground = Brushes.Red
chart.TitleFontFamily = New FontFamily("Verdana")
chart.TitleFontSize = 24
chart.Subtitle = "One Hundred Random Points"
chart.SubtitleForeground = Brushes.Red
chart.SubtitleFontFamily = New FontFamily("Verdana")
chart.SubtitleFontSize = 16

layoutRoot.Children.Add(chart)

The above code will result in a XamShapeChart that looks like the following:

shapechart title subtitle.png