BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
Hi
I am trying to design a simple dashboard with panels containing different ChartComponents.
I followed the guide you have on youtube here : https://www.youtube.com/watch?v=pj5wrwHhJk8
This is my Dashboard component:
LineChart component:
Hi Torgeir,
Based on the shared details we can understand that you are tying to utilize Syncfusion Dashboard Layout component with charts and facing an issue while resizing the panel. We have prepared the sample aligning with your requirements and replicated the issue and it can be resolved by calling the Dashboard Layout component’s refresh method. Kindly refer the code changes below,
const onPanelResize = (args) => { if (args.element && args.element.querySelector('.e-panel-container .e-panel-content div div')) { let chartObj = (args.element.querySelector('.e-panel-container .e-panel-content div div')).ej2_instances[0]; chartObj.height = '95%'; chartObj.width = '100%'; chartObj.refresh(); } }; |
We have also attached the sample for your reference,
Sample: https://stackblitz.com/edit/react-w81anu-dzslvh?file=index.js
Kindly check out the shared details and get back to us if you need further assistance.
Regards,
Jafar
Thanks a bunch, worked perfect
Do you have an example in typescript how to resize the charts inside panels if the charts are imported functional components?
I am trying it like this
Hi Torgeir,
We can understand that you are expecting to resize the charts along with the Dashboard when being resized. We have achieved your requirement by using the Dashboard Layout component’s resize event. Kindly refer the code changes below.
const onPanelResize = (args) => { if (args.element && args.element.querySelector('.e-panel-container .e-panel-content .e-chart')) { let chartObj = (args.element.querySelector('.e-panel-container .e-panel-content .e-chart')).ej2_instances[0]; chartObj.height = '95%'; chartObj.width = '100%'; chartObj.refresh(); } }; |
We have attached the sample for your reference,
Sample: S9er8q (forked) - StackBlitz
Kindly check out the shared details and get back to us if you need further assistance.
Regards,
Jafar