Caption in WPF Bullet Graph (SfBulletGraph)

18 Oct 20224 minutes to read

The Caption for a bullet graph is used to specify a unique label describing the value represented in the bullet graph.

<syncfusion:SfBulletGraph >        
              <syncfusion:SfBulletGraph.Caption>
                <StackPanel Margin="0,0,10,0">
                    <TextBlock Text="Revenue YTD" Foreground="Black"
                               FontSize="13" HorizontalAlignment="Center"/>
                    <TextBlock Text="$ in Thousands" Foreground="Black"
                               FontSize="13" HorizontalAlignment="Center"/>
                </StackPanel>
            </syncfusion:SfBulletGraph.Caption>
      </syncfusion:SfBulletGraph>
SfBulletGraph bulletgraph = new SfBulletGraph();
            TextBlock textBlock = new TextBlock() { Text = "Revenue YTD" };
            TextBlock textBlock1 = new TextBlock() { Text = "$ in Thousands" };
            StackPanel stackPanel = new StackPanel();
            stackPanel.Children.Add(textBlock);
            stackPanel.Children.Add(textBlock1);
            bulletgraph.Caption = stackPanel;
            grid.Children.Add(bulletgraph);

Caption_img1

Caption Position

The caption in the bullet graph can be placed in the start or end of the quantitative scale by choosing from one of the two options available in the CaptionPosition property. They are:

  1. Near (Default)
  2. Far

    <syncfusion:SfBulletGraph CaptionPosition="Far">
                <syncfusion:SfBulletGraph.Caption>
                    <StackPanel Margin="0,0,10,0">
                        <TextBlock Text="Revenue YTD" Foreground="Black"
                                   FontSize="13" HorizontalAlignment="Center"/>
                        <TextBlock Text="$ in Thousands" Foreground="Black"
                                   FontSize="13" HorizontalAlignment="Center"/>
                    </StackPanel>
                </syncfusion:SfBulletGraph.Caption>
            </syncfusion:SfBulletGraph>
    SfBulletGraph bulletgraph = new SfBulletGraph();
                bulletgraph.CaptionPosition = BulletGraphCaptionPosition.Far;
                TextBlock textBlock = new TextBlock() { Text = "Revenue YTD" };
                TextBlock textBlock1 = new TextBlock() { Text = "$ in Thousands" };
                StackPanel stackPanel = new StackPanel();
                stackPanel.Children.Add(textBlock);
                stackPanel.Children.Add(textBlock1);
                bulletgraph.Caption = stackPanel;
                grid.Children.Add(bulletgraph);

Caption_img2