
**Inheritance:**
java.lang.Object
```
public class ChartTitle
```

Provides access to the chart title properties.

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

 **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.0, 300.0);
 Chart chart = chartShape.getChart();

 // Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
 ChartTitle title = chart.getTitle();
 title.setText("My Chart");
 title.getFont().setSize(15.0);
 title.getFont().setColor(Color.BLUE);

 // Set the "Show" property to "true" to make the title visible.
 title.setShow(true);

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

 doc.save(getArtifactsDir() + "Charts.ChartTitle.docx");
 
```


[Working with Charts]: https://docs.aspose.com/words/java/working-with-charts/
## Methods

| Method | Description |
| --- | --- |
| [getFont()](#getFont) | Provides access to the font formatting of the chart title. |
| [getFormat()](#getFormat) | Provides access to fill and line formatting of the chart title. |
| [getOrientation()](#getOrientation) | Gets the orientation of the chart title text. |
| [getOverlay()](#getOverlay) | Determines whether other chart elements shall be allowed to overlap title. |
| [getRotation()](#getRotation) | Gets the rotation of the chart title in degrees. |
| [getShow()](#getShow) | Determines whether the title shall be shown for this chart. |
| [getText()](#getText) | Gets the text of the chart title. |
| [setOrientation(int value)](#setOrientation-int) | Sets the orientation of the chart title text. |
| [setOverlay(boolean value)](#setOverlay-boolean) | Determines whether other chart elements shall be allowed to overlap title. |
| [setRotation(int value)](#setRotation-int) | Sets the rotation of the chart title in degrees. |
| [setShow(boolean value)](#setShow-boolean) | Determines whether the title shall be shown for this chart. |
| [setText(String value)](#setText-java.lang.String) | Sets the text of the chart title. |
### getFont() {#getFont}
```
public Font getFont()
```


Provides access to the font formatting of the chart title.

 **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.0, 300.0);
 Chart chart = chartShape.getChart();

 // Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
 ChartTitle title = chart.getTitle();
 title.setText("My Chart");
 title.getFont().setSize(15.0);
 title.getFont().setColor(Color.BLUE);

 // Set the "Show" property to "true" to make the title visible.
 title.setShow(true);

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

 doc.save(getArtifactsDir() + "Charts.ChartTitle.docx");
 
```

**Returns:**
[Font](../../com.aspose.words/font/) - The corresponding [Font](../../com.aspose.words/font/) value.
### getFormat() {#getFormat}
```
public ChartFormat getFormat()
```


Provides access to fill and line formatting of the chart title.

 **Examples:** 

Shows how to use chart formating.

```

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

 Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0);
 Chart chart = shape.getChart();

 // Delete series generated by default.
 ChartSeriesCollection series = chart.getSeries();
 series.clear();

 String[] categories = new String[] { "Category 1", "Category 2" };
 series.add("Series 1", categories, new double[] { 1.0, 2.0 });
 series.add("Series 2", categories, new double[] { 3.0, 4.0 });

 // Format chart background.
 chart.getFormat().getFill().solid(Color.darkGray);

 // Hide axis tick labels.
 chart.getAxisX().getTickLabels().setPosition(AxisTickLabelPosition.NONE);
 chart.getAxisY().getTickLabels().setPosition(AxisTickLabelPosition.NONE);

 // Format chart title.
 chart.getTitle().getFormat().getFill().solid(Color.yellow);

 // Format axis title.
 chart.getAxisX().getTitle().setShow(true);
 chart.getAxisX().getTitle().getFormat().getFill().solid(Color.yellow);

 // Format legend.
 chart.getLegend().getFormat().getFill().solid(Color.yellow);

 doc.save(getArtifactsDir() + "Charts.ChartFormat.docx");
 
```

**Returns:**
[ChartFormat](../../com.aspose.words/chartformat/) - The corresponding [ChartFormat](../../com.aspose.words/chartformat/) value.
### getOrientation() {#getOrientation}
```
public int getOrientation()
```


Gets the orientation of the chart title text.

 **Remarks:** 

The default value is [ShapeTextOrientation.HORIZONTAL](../../com.aspose.words/shapetextorientation/\#HORIZONTAL).

 **Examples:** 

Shows how to set orientation and rotation of chart and axis titles.

```

 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape chartShape = builder.insertChart(ChartType.COLUMN, 400.0, 300.0);
 Chart chart = chartShape.getChart();

 chart.getTitle().setText("Sample Chart");
 chart.getTitle().setOrientation(ShapeTextOrientation.HORIZONTAL);
 chart.getTitle().setRotation(90);

 // Before setting title properties, make sure that this title will be displayed.
 chart.getAxisX().getTitle().setShow(true);
 chart.getAxisX().getTitle().setText("X Axis");
 chart.getAxisX().getTitle().setOrientation(ShapeTextOrientation.HORIZONTAL);
 chart.getAxisX().getTitle().setRotation(-90);

 doc.save(getArtifactsDir() + "Charts.TitleOrientation.docx");
 
```

**Returns:**
int - The orientation of the chart title text. The returned value is one of [ShapeTextOrientation](../../com.aspose.words/shapetextorientation/) constants.
### getOverlay() {#getOverlay}
```
public boolean getOverlay()
```


Determines whether other chart elements shall be allowed to overlap title. By default overlay is  false .

 **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.0, 300.0);
 Chart chart = chartShape.getChart();

 // Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
 ChartTitle title = chart.getTitle();
 title.setText("My Chart");
 title.getFont().setSize(15.0);
 title.getFont().setColor(Color.BLUE);

 // Set the "Show" property to "true" to make the title visible.
 title.setShow(true);

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

 doc.save(getArtifactsDir() + "Charts.ChartTitle.docx");
 
```

**Returns:**
boolean - The corresponding  boolean  value.
### getRotation() {#getRotation}
```
public int getRotation()
```


Gets the rotation of the chart title in degrees.

 **Remarks:** 

The range of acceptable values is from -180 to 180 inclusive. The default value is 0.

 **Examples:** 

Shows how to set orientation and rotation of chart and axis titles.

```

 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape chartShape = builder.insertChart(ChartType.COLUMN, 400.0, 300.0);
 Chart chart = chartShape.getChart();

 chart.getTitle().setText("Sample Chart");
 chart.getTitle().setOrientation(ShapeTextOrientation.HORIZONTAL);
 chart.getTitle().setRotation(90);

 // Before setting title properties, make sure that this title will be displayed.
 chart.getAxisX().getTitle().setShow(true);
 chart.getAxisX().getTitle().setText("X Axis");
 chart.getAxisX().getTitle().setOrientation(ShapeTextOrientation.HORIZONTAL);
 chart.getAxisX().getTitle().setRotation(-90);

 doc.save(getArtifactsDir() + "Charts.TitleOrientation.docx");
 
```

**Returns:**
int - The rotation of the chart title in degrees.
### getShow() {#getShow}
```
public boolean getShow()
```


Determines whether the title shall be shown for this chart. Default value is  true .

 **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.0, 300.0);
 Chart chart = chartShape.getChart();

 // Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
 ChartTitle title = chart.getTitle();
 title.setText("My Chart");
 title.getFont().setSize(15.0);
 title.getFont().setColor(Color.BLUE);

 // Set the "Show" property to "true" to make the title visible.
 title.setShow(true);

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

 doc.save(getArtifactsDir() + "Charts.ChartTitle.docx");
 
```

**Returns:**
boolean - The corresponding  boolean  value.
### getText() {#getText}
```
public String getText()
```


Gets the text of the chart title. If  null  or empty value is specified, auto generated title will be shown.

 **Remarks:** 

Use [getShow()](../../com.aspose.words/charttitle/\#getShow) / [setShow(boolean)](../../com.aspose.words/charttitle/\#setShow-boolean) option if you need to hide the Title.

 **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.0, 300.0);
 Chart chart = chartShape.getChart();

 // Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
 ChartTitle title = chart.getTitle();
 title.setText("My Chart");
 title.getFont().setSize(15.0);
 title.getFont().setColor(Color.BLUE);

 // Set the "Show" property to "true" to make the title visible.
 title.setShow(true);

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

 doc.save(getArtifactsDir() + "Charts.ChartTitle.docx");
 
```

**Returns:**
java.lang.String - The text of the chart title.
### setOrientation(int value) {#setOrientation-int}
```
public void setOrientation(int value)
```


Sets the orientation of the chart title text.

 **Remarks:** 

The default value is [ShapeTextOrientation.HORIZONTAL](../../com.aspose.words/shapetextorientation/\#HORIZONTAL).

 **Examples:** 

Shows how to set orientation and rotation of chart and axis titles.

```

 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape chartShape = builder.insertChart(ChartType.COLUMN, 400.0, 300.0);
 Chart chart = chartShape.getChart();

 chart.getTitle().setText("Sample Chart");
 chart.getTitle().setOrientation(ShapeTextOrientation.HORIZONTAL);
 chart.getTitle().setRotation(90);

 // Before setting title properties, make sure that this title will be displayed.
 chart.getAxisX().getTitle().setShow(true);
 chart.getAxisX().getTitle().setText("X Axis");
 chart.getAxisX().getTitle().setOrientation(ShapeTextOrientation.HORIZONTAL);
 chart.getAxisX().getTitle().setRotation(-90);

 doc.save(getArtifactsDir() + "Charts.TitleOrientation.docx");
 
```

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | int | The orientation of the chart title text. The value must be one of [ShapeTextOrientation](../../com.aspose.words/shapetextorientation/) constants. |

### setOverlay(boolean value) {#setOverlay-boolean}
```
public void setOverlay(boolean value)
```


Determines whether other chart elements shall be allowed to overlap title. By default overlay is  false .

 **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.0, 300.0);
 Chart chart = chartShape.getChart();

 // Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
 ChartTitle title = chart.getTitle();
 title.setText("My Chart");
 title.getFont().setSize(15.0);
 title.getFont().setColor(Color.BLUE);

 // Set the "Show" property to "true" to make the title visible.
 title.setShow(true);

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

 doc.save(getArtifactsDir() + "Charts.ChartTitle.docx");
 
```

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | boolean | The corresponding  boolean  value. |

### setRotation(int value) {#setRotation-int}
```
public void setRotation(int value)
```


Sets the rotation of the chart title in degrees.

 **Remarks:** 

The range of acceptable values is from -180 to 180 inclusive. The default value is 0.

 **Examples:** 

Shows how to set orientation and rotation of chart and axis titles.

```

 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape chartShape = builder.insertChart(ChartType.COLUMN, 400.0, 300.0);
 Chart chart = chartShape.getChart();

 chart.getTitle().setText("Sample Chart");
 chart.getTitle().setOrientation(ShapeTextOrientation.HORIZONTAL);
 chart.getTitle().setRotation(90);

 // Before setting title properties, make sure that this title will be displayed.
 chart.getAxisX().getTitle().setShow(true);
 chart.getAxisX().getTitle().setText("X Axis");
 chart.getAxisX().getTitle().setOrientation(ShapeTextOrientation.HORIZONTAL);
 chart.getAxisX().getTitle().setRotation(-90);

 doc.save(getArtifactsDir() + "Charts.TitleOrientation.docx");
 
```

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | int | The rotation of the chart title in degrees. |

### setShow(boolean value) {#setShow-boolean}
```
public void setShow(boolean value)
```


Determines whether the title shall be shown for this chart. Default value is  true .

 **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.0, 300.0);
 Chart chart = chartShape.getChart();

 // Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
 ChartTitle title = chart.getTitle();
 title.setText("My Chart");
 title.getFont().setSize(15.0);
 title.getFont().setColor(Color.BLUE);

 // Set the "Show" property to "true" to make the title visible.
 title.setShow(true);

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

 doc.save(getArtifactsDir() + "Charts.ChartTitle.docx");
 
```

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | boolean | The corresponding  boolean  value. |

### setText(String value) {#setText-java.lang.String}
```
public void setText(String value)
```


Sets the text of the chart title. If  null  or empty value is specified, auto generated title will be shown.

 **Remarks:** 

Use [getShow()](../../com.aspose.words/charttitle/\#getShow) / [setShow(boolean)](../../com.aspose.words/charttitle/\#setShow-boolean) option if you need to hide the Title.

 **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.0, 300.0);
 Chart chart = chartShape.getChart();

 // Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
 ChartTitle title = chart.getTitle();
 title.setText("My Chart");
 title.getFont().setSize(15.0);
 title.getFont().setColor(Color.BLUE);

 // Set the "Show" property to "true" to make the title visible.
 title.setShow(true);

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

 doc.save(getArtifactsDir() + "Charts.ChartTitle.docx");
 
```

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | java.lang.String | The text of the chart title. |

