Chart

Chart class

Provides access to the chart shape properties.

To learn more, visit the Working with Charts documentation article.

public class Chart

Properties

Name Description
AxisX { get; } Provides access to properties of the X axis of the chart.
AxisY { get; } Provides access to properties of the Y axis of the chart.
AxisZ { get; } Provides access to properties of the Z axis of the chart.
Legend { get; } Provides access to the chart legend properties.
Series { get; } Provides access to series collection.
SourceFullName { get; set; } Gets the path and name of an xls/xlsx file this chart is linked to.
Title { get; } Provides access to the chart title properties.

Examples

Shows how to insert a chart and set a title.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a chart shape with a document builder and get its chart.
Shape chartShape = builder.InsertChart(ChartType.Bar, 400, 300);
Chart chart = chartShape.Chart;

// Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
ChartTitle title = chart.Title;
title.Text = "My Chart";

// Set the "Show" property to "true" to make the title visible. 
title.Show = true;

// Set the "Overlay" property to "true" Give other chart elements more room by allowing them to overlap the title
title.Overlay = true;

doc.Save(ArtifactsDir + "Charts.ChartTitle.docx");

See Also