Line Chart x axis labels which are date time, rendering fine when running
in local but not working in production build(deployed in netlify). Above image is running in Dev. Below image is the one running in production mode, after resizing browser working fine.
Code:
Hi Rajesh,
Greetings from Syncfusion.
We request you to share the chart width in production and development environment, so that it will be helpful to validate your scenario further. We have used chart loaded event to obtain the chart width. Please check with the below snippet.
onChartLoad(args) { let chart = document.getElementById('charts'); console.log(chart.ej2_instances[0].availableSize.width); } |
Sample : https://stackblitz.com/edit/react-xvz696
Please let us know if you have any concerns.
Regards,
Durga G
Hi Rajesh,
As per your attached screenshot, it seems to be you are rendering controls inside dashboard layout panels. Usually the reported problem occurs when controls are rendered before panel is created, so we request you to re-render the control using chart refresh method inside layout created event.
We have prepared sample based on your requirement. Please check with below snippet and sample.
Code Snippet :
<DashboardLayoutComponent created={this.afterCreation.bind(this)}> </DashboardLayoutComponent> afterCreation(args){ let chart1 = document.getElementById('chart1').ej2_instances[0]; chart1.refresh(); } |
Sample : https://stackblitz.com/edit/react-jjcpt8-trdcy3
Kindly revert us if you have any concerns.
Regards,
Durga G
Tried the suggested solution but still not working, event getting fired verified using debugging. Please find code below.
Hi Rajesh,
We request you to specify the static height and width for chart container and ensure in local and production environment and update us the details if you are still facing problem.
UG : https://ej2.syncfusion.com/react/documentation/chart/chart-dimensions/
Kindly get back to us if you need any further assistance.
Regards,
Durga G
Hi,
we did add height and width to chart as well as container,
Hi Rajesh,
By default, chart doesn’t required any CSS reference. However we request you to resize the chart in loaded event using chartResize method after few seconds.
onChartLoad(args) { if (shouldChartRefresh) { setTimeout(() => { shouldChartRefresh = false; chart.ej2_instances[0].chartResize(); }, 1000); } } |
Sample : https://stackblitz.com/edit/react-xvz696-98v1mt
If you are still facing problem, please revert us.
Regards,
Durga G.
Hi,
This is working , could i know the cause for this issue which is only replicating in production.
Also since we have 3-6 charts in a page , we have to maintain Boolean flag as state for each chart which is hard thing, is there any equivalent event for the dashboard layout component ?