Skip to main content
All docs
V26.1
  • Chart.Title Property

    Gets or sets the chart title.

    Namespace: DevExpress.Docs.Presentation

    Assembly: DevExpress.Docs.Presentation.v26.1.dll

    Declaration

    public ChartTitle Title { get; set; }

    Property Value

    Type Description
    ChartTitle

    The chart title.

    Remarks

    The following code snippet creates a chart with a title, adds a series, and specifies the series data:

    using DevExpress.Docs.Office;
    using DevExpress.Docs.Presentation;
    using System.Drawing;
    
    namespace PresentationApiSample;
    
    public class Program {
        public static async Task Main(string[] _) {
    
            // Create a presentation.
            Presentation presentation = new Presentation();
    
            // Reset the slide collection.
            presentation.Slides.Clear();
    
            // Add a blank slide.
            Slide slide = new Slide(SlideLayoutType.Blank);
            presentation.Slides.Add(slide);
    
            // Insert a chart that fills the slide.
            Chart chart = new Chart();
            chart.Width = presentation.SlideSize.Width;
            chart.Height = presentation.SlideSize.Height;
            slide.Shapes.Add(chart);
    
            // Populate chart data.
            chart.Data[0, "A1"].NumericValue = 120;
            chart.Data[0, "A2"].NumericValue = 95;
            chart.Data[0, "A3"].NumericValue = 140;
            chart.Data[0, "B1"].TextValue = "Q1";
            chart.Data[0, "B2"].TextValue = "Q2";
            chart.Data[0, "B3"].TextValue = "Q3";
    
            // Bind series values and arguments to chart data ranges.
            BarSeries series = new BarSeries();
            series.Values = new ChartDataReference(sheetIndex: 0, fromCellReference: "A1", toCellReference: "A3");
            series.Arguments = new ChartDataReference(sheetIndex: 0, fromCellReference: "B1", toCellReference: "B3");
    
            // Add the series to the chart.
            chart.Series.Add(series);
    
            // Set chart title formatting.
            chart.Title = new ChartTitle(new TextArea { 
                Text = "Chart Title", 
                Level1ParagraphProperties = new TextParagraphProperties { 
                    TextProperties = new TextProperties { FontSize = 30, Fill = new SolidFill(Color.DarkBlue) }
                }
            });
        }
    }
    
    See Also