Articles in this section
Category / Section

How to wrap a title in the React Chart?

2 mins read

This article explains how to wrap a title in the React Chart.

Customize the title

To create a multi-line title, you can easily wrap the title by using the textOverflow property. By default, the chart title is in a wrapped condition.

The textOverflow property includes the following customization options:

None - Display the chart title with overlap if it exceeds.
Wrap - Display the chart title with a wrap if it exceeds.
Trim - Display the chart title with trimming if it exceeds.

In the following code example, the title is wrapped.

Index.js

import { createRoot } from 'react-dom/client';
import * as React from 'react';
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, ColumnSeries,
Category } from '@syncfusion/ej2-react-charts';

const Column = () => {
return (
   <chartcomponent id="charts" title="Investigating Chart Titles with Wrapping for Excessive Length" titlestyle="{{" textoverflow:="" 'wrap'="" }}="">
     <inject services="{[ColumnSeries," category]}="">
     <seriescollectiondirective>
       <seriesdirective datasource="{data}" xname="x" yname="y" type="Column" fill="#db874b">
     </seriesdirective></seriescollectiondirective>
   </inject></chartcomponent>
  );
};
export default Column;

const root = createRoot(document.getElementById('sample'));
root.render(<column>);

The following screenshot illustrate the output of the above code snippet.

Screenshot:

React chart title wrap

View Sample in Stackblitz

Conclusion

I hope you enjoyed learning how to wrap the title in the React Chart Component.

You can refer to our React Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our React Chart example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, support portal, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied