jquery - Kendo UI chart select feature gets reset -


select on kendo ui chart made user lost when browser (mobile device/computer) resized. can retain selection when browser resized?

to reproduce, please save below code html on system, open on browser, make selection on chart , resize browser. selection made lost.

<html> <head>   <meta charset="utf-8">   <title>retain kendo chart selection</title>    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.common.min.css">   <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.rtl.min.css">   <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.default.min.css">   <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.mobile.all.min.css">    <script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>   <script src="https://kendo.cdn.telerik.com/2017.2.621/js/angular.min.js">    </script>   <script src="https://kendo.cdn.telerik.com/2017.2.621/js/jszip.min.js">    </script>   <script src="https://kendo.cdn.telerik.com/2017.2.621/js/kendo.all.min.js"></script>    </head> <body>   <div id="chart"> </div> </body> <script>   $("#chart").kendochart({     series: [         { type: "line", data: [1, 2, 5,12,22,0,1,2,4,9] }],     seriesdefaults: {       type: "line"     },        categoryaxis: {       categories: [1,2,3,4,5,6,7,8,9,10],       select: {         from:3,         to:9       }     }   });    $(window).resize(function(){         kendo.resize($("#chart"));   });  </script>  </html> 

one solution found using setoptions mentioned below. uses setoptions inside chart event (selectend) itself.

<script>   $("#chart").kendochart({     series: [{ type: "line", data: [1, 2, 5,12,22,0,1,2,4,9] }],     seriesdefaults: {type: "line" },        categoryaxis: {       categories: [1,2,3,4,5,6,7,8,9,10],       select: {}           },     selectend: function(e){         this.setoptions({                 categoryaxis: {                     select: {                         from: e.from,                         to: e.to                     }                 }               });       }   });    $(window).resize(function(){        var chart = $("#chart").data("kendochart");     var = chart.options.categoryaxis.select.from;   var = chart.options.categoryaxis.select.to;    kendo.resize($("#chart"));   chart.setoptions({     categoryaxis: {         select: {             from: from,             to:         }     }   });             });  </script>  


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -