Category / Section
How to resize PivotChart in PivotClient dynamically in ASP.NET MVC?
1 min read
This KB illustrates that how to resize PivotChart in PivotClient dynamically.
Solution
You can resize the Chart in PivotClient dynamically by using the following code example. You can use this code in .cshtml, .aspx, .html files.
Script
$(window).resize(function(eve) { setChartWidth(); }); var clientTarget = $('#PivotClient1').data("ejPivotClient"); function setChartWidth() { if ($("#PivotChart")!= null && $("#PivotChart") != undefined) clientTarget.chartObj = clientTarget.element.find("#PivotChart" + "Container").data("ejChart"); if(!ej.isNullOrUndefined(clientTarget.chartObj)){ clientTarget.chartObj.model.size.height = "" + (Chartheight) + "px"; //need to calculate chart height while resizing the chart clientTarget.chartObj.model.size.width = "" + (Chartwidth-1) + "px"; //need to calculate chart width while resizing the chart clientTarget.chartObj.redraw(); } }