Dim resizeJs As String = $"
$(window).on('resize', function() {
if ($.jqplot) {
var chartId = '${internalID}'; // Specific chart ID
var chartContainer = $('#' + chartId); // The chart container
var plot = document.getElementById(chartId).plotInstance; // Retrieve plot instance
if (plot) {
// Dynamically set the container height to 90% of its parent's height
var parentHeight = chartContainer.parent().parent().parent().parent().height();
// console.log('parentHeight: ', parentHeight);
chartContainer.height(parentHeight * 0.9); // Set to 90% of parent height
// console.log('plot: ', plot.target);
// console.log('width: ', chartContainer.width());
// console.log('height: ', chartContainer.height());
if (chartContainer.width() > 0 && chartContainer.height() > 0) {
plot.replot({ resetAxes: true });
} else {
// console.log('plot: ', plot.target);
// console.log('width: ', chartContainer.width());
// console.log('height: ', chartContainer.height());
console.warn('Skipping replot: container has zero dimensions');
}
} else {
console.error('Plot instance not found for chart ID:', chartId);
}
}
});
"$
InternalPage.ws.Eval(resizeJs, Null)
InternalPage.ws.Flush