syncfusion / ej2-angular-ui-components

Syncfusion Angular UI components library offer more than 50+ cross-browser, responsive, and lightweight angular UI controls for building modern web applications.
https://www.syncfusion.com/angular-ui-components
Other
274 stars 113 forks source link

Data label cut off in axis #199

Closed hasan-enosis closed 2 years ago

hasan-enosis commented 2 years ago

We have tried to generate an Area graph with data label. But we see that, data label is cut off in axis. We have attached a link to produce this issue.

Please let us know how to render the data label inside the area.

Bhuvanesh-V commented 2 years ago

Hi Hasan,

Greetings from Syncfusion.

We have analyzed your query. We suggest you to use chart loaded event to change the last data label position to render the data label inside the chart area. We have created a sample using a loaded event. Please check with the below snippet and sample.

Code snippet:

public loaded(args: ILoadedEventArgs): void {
           let textGroup = document.getElementById('chart-container').querySelectorAll('[id*="TextGroup"]');
            var textElement: any = textGroup[i].childNodes[j];
            if (textElement && j == textGroup[i].childNodes.length - 1) 
            {
              textElement.setAttribute('x', parseFloat(textElement.getAttribute('x')) - textElement.getBoundingClientRect().width / 2);
             }
 }

Screenshot:

image

Sample: https://stackblitz.com/edit/angular-syncfusion-pie-chart-wffupd

Kindly revert us if you have any concerns.

Regards, Bhuvanesh V.