Articles in this section
Category / Section

How to render text at the end of each line in an Angular Line Chart?

2 mins read

Description

This article shows how to render the text at the end of each line in the Angular Charts.

Solution

The data labels are text elements that provide additional information about individual data points. You can render a random text at the end of each line by using the text argument in the textRender event of the chart.

The textRender event is triggered for each data label in the Chart. You can change the text using the text argument if the point index is the same as the length of the data. Additionally, you can prevent the rendering of text by enabling the cancel argument in the textRender event.

Code Snippet

   public textRender(args: ITextRenderEventArgs): void {
       if(args.point.index == args.series.dataSource["length"] - 1)
           args.text = args.text + "th";
       else
           args.cancel = true;
   };

The following image illustrates the output of the above code.

image.png

View Sample in Stackblitz

Conclusion

I hope you enjoyed learning how to render the text at the end of the line chart in Angular Charts.

You can refer to our Angular Charts feature tour page to learn about its other features and documentation, and how to quickly get started for configuration specifications. You can also explore our Angular Charts example to understand how to create and visualize 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 comment 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