B4J Question ABMaterial JQPlots charts resizing issue

walterf25

Expert
Licensed User
Longtime User
I am working on a project and I am using a JQPlot class I found on this thread while the class works great I noticed that the charts/plots don't get resized when the entire page gets resized.

I have placed each plot on a container, the container gets resized just fine but not the plots.
This is an image of the normal size page.
1736321370619.png


And here's an image when the page is resized
1736321618561.png


I'm not very good with javascript, but I tried the following code by asking chatgpt
Plot Resize:
    Dim ResizeJS As String = $"
        $(window).on('resize', function() {
            if ($.jqplot) {
                $('.jqplot-target').each(function() {
                    var chartId = $(this).attr('id');
                    console.log('chartId: ', chartId);
                    if (chartId) {
                        var plot = $('#'+'${chartId}').data('jqplot');
                        console.log('plot: ', plot);
                        if (plot) {
                            plot.replot({ resetAxes: true });
                        }
                    }
                });
            }
        });
    "$

It seems to do something but I see an error at the var plot = $('#'+'${chartId}').data('jqplot'); part, as I reiterate I'm not very familiar with js, maybe someone on here could help me figure this out, all I need is to be able for each plot to resize along with the container when the browser's page is resized.

Walter
 
Top