Server Connect and Apex Charts

Hi Ben,
I was testing Apex charts and got it work nicely on one of my testing index pages. It’s straightforward as explained by Max_Saravia here How to change the font and grid color in Charts component
But, I have to put the server connect including the chartUpdate() in the main layout page otherwise when I move it to any specific content pages to load it there only, I’m getting errors and charts are not showing. So please how can I load Apex chart properly with the server connect on my content pages only?
Best regards

Hi Ashur, I have moved this topic into the public arena so that others can chime in and learn from the discussion. I hope that you do not mind. If this is not your intention, I will revert it back to the private message.

As a side note, normally I take no notice of private messages asking for assistance.

Back on topic, you have not given me much information to go on. The impression that I get is that you have charts appearing on several pages and that the data-source (server connect) is different for each chart. In that case, the data-source needs to be loaded when the page loads. If the site is a SPA, then the only way to load the data-source is by placing it in the layout page because there are no other pages being loaded.

If you want the data-source to be loaded per page, then you cannot use a SPA without adding a workaround (read: code). This will not be simple because the only trigger that is available is the change in the URL.

I hope that this helps. If not, please supply the information that is relevant to the topic.

When moving a data source from a layout to a content page, often you need to change the path data items are bound with

For example on a layout page you might have:


when moving this to a content page, it may need to become:

1 Like

Hi bpj,
Thank you so much. That’s exactly what I needed to fix not only showing the charts on the page, but also eliminating the errors that I was getting on developer tools of the browser.
Best regards.

1 Like

Hi Ben,
I really appreciate your help. And, putting the topic into the public arena actually helped solving the app issues as bpj explained above.