Good afternoon,
I have a yearly dashboard where I have set up a slightly complicated scenario using several MVC Core components.
When you select a year from the dropdown it forces each of the charts/grids to read the data based on the selected year. The 'Yearly Activity' tab is the default tab and works nicely. I have a few pie charts and a bar chart on one tab which are arranged using the TileLayout - this allows them to be resized and dragged. It looks like this:
On the second tab "Monthly Activity by Operator" there is a kendo grid which displays aggregated data based on the selected year. However, when I click on the second tab and change the year in the dropdown, then click back on the first tab, the bar and pie chart have updated correctly data-wise but have not resized correctly in layout - they appear zoomed in:
I've tried making them resize if I click on the 'Yearly Activity' tab:
function tabSelect(e) {
var tab = $(e.item).find("> .k-link").text();
if (tab == "Yearly Activity") {
kendo.resize($(".k-grid, .k-chart"));
}
}
I also have these functions, which are almost exactly as written in the demos:
$(document).ready(function () {
kendo.resize($(".k-grid, .k-chart"));
});
function onTileResize(e) {
if (e.container) {
// for widgets that do not auto resize
// https://docs.telerik.com/kendo-ui/styles-and-layout/using-kendo-in-responsive-web-pages
kendo.resize(e.container, true);
$(document).bind("kendo:skinChange", updateTheme);
}
}
function updateTheme() {
var charts = $(".k-chart");
$.each(charts, function (i, elem) {
var theme = kendoTheme;
if (/(default-|bootstrap-|material-|classic-)/.test(kendoTheme)) {
theme = "sass";
}
$(elem).getKendoChart().setOptions({ theme: theme });
});
}
$(window).on("resize", function () {
kendo.resize($(".k-card-body"));
});
How can I get the charts to resize themselves correctly, as if I was on the first tab when I changed the year?
Kind regards,
Richard