Hi,
This looks like a Plotly resize/reflow issue rather than a problem with your chart data.
Since it renders correctly on the first load and only overflows after navigating back, the underlying Plotly chart is likely not recalculating its dimensions when the page is recreated.
As a quick test, try manually resizing the browser window after returning to the page. If the chart immediately fits the container again, that confirms it's a missing resize/reflow event.
A workaround is to trigger a Plotly resize after the page becomes visible, for example in a JavaScript action:
document.querySelectorAll(".js-plotly-plot").forEach(chart => {
if (chart.offsetParent !== null && typeof Plotly !== "undefined") {
Plotly.Plots.resize(chart);
}
});
window.dispatchEvent(new Event("resize"));
This forces the chart to recalculate its dimensions and fit back into its parent container.
Could you also confirm whether the chart is inside a Data View, Tab Container, or Snippet? That can help narrow down whether it's a visibility/reflow issue.
Kindly mark this as the accepted answer if it helps.
Hello Krishnakummar,
The chart fits the container when I resize the browser but the code you suggested doesn't work to fix the issue.
The cart is inside some containers.
Issue was fixed by adding an event (Mendix Marketplace - Events) that runs a nanoflow with the following code:
window.dispatchEvent(new Event("resize"));Hi João,
Since manually resizing the browser fixes the chart layout but the previous JavaScript resize workaround did not, I would first correct the chart's dimensions and its parent container configuration.
Please try this configuration:
Open the affected page in Studio Pro 10.24.22 and select the line chart.
In the chart's Dimensions settings, set Width Unit = Percentage and Width = 100.
Set Height Unit = Pixels and specify an appropriate fixed height, for example 300 px. Avoid using Percentage of Parent unless the parent container has an explicit height.
Inspect every parent container of the chart. Ensure that the chart is not inside a container with a fixed width, an unexpected minimum width, or horizontal overflow. If the chart is inside a tab or another initially hidden container, test moving it temporarily into a normal, visible container.
Navigate away from the page and return. If the issue disappears when the chart is outside the nested containers, reintroduce the containers one at a time to identify which one causes the sizing problem.
These settings follow the official Mendix Charts documentation, which explains that percentage width is relative to the parent and that percentage-of-parent height requires an explicitly sized parent.
Reference: https://docs.mendix.com/appstore/widgets/charts/
If the problem still occurs with a visible, correctly sized parent container, test the latest Charts version compatible with your Studio Pro version in a separate branch. If the issue persists, report it through the Charts Marketplace support channel with the page structure and reproduction steps, as the previous resize workaround has already failed.
Hope this helps! If you find this answer helpful, please mark it as the accepted answer.