Kendo Chart Value axis will be changed on click event -


i have kendo chart multi value axis , kendo tree-view. want show value axis-es according checkbox selection. example check "km" checkbox, chart display km value axis.

is possible?

here chart code:

function createchart() {     $("#chart").kendochart({          legend: {             position: "top"         },         series: [{             type: "column",             data: [20, 40, 45, 30, 50],             stack: true,             name: "on battery",             color: "#003c72"         }, {             type: "column",             data: [20, 30, 35, 35, 40],             stack: true,             name: "on gas",             color: "#0399d4"         }, {             type: "area",             data: [30, 38, 40, 32, 42],             name: "mpg",             color: "#642381",             axis: "mpg"         }, {             type: "area",             data: [7.8, 6.2, 5.9, 7.4, 5.6],             name: "l/100 km",             color: "#e5388a",             axis: "l100km"         }],         valueaxes: [{             title: { text: "miles" },             min: 0,             max: 100         }, {             name: "km",             title: { text: "km" },             min: 0,             max: 161,             majorunit: 32         }, {             name: "mpg",             title: { text: "miles per gallon" },             color: "#642381"         }, {             name: "l100km",             title: { text: "liters per 100km" },             color: "#e5388a"         }],         categoryaxis: {             categories: ["mon", "tue", "wed", "thu", "fri"],              axiscrossingvalues: [0, 0, 10, 10]         }     }); }  $(document).ready(function() {     settimeout(function() {         createchart();          $("#example").bind("kendo:skinchange", function(e) {             createchart();         });     }, 400); }); 

my jsbin: http://jsbin.com/eyibar/4/edit

first need assign chart variable in on-change event event of tree view,without tree-view didn't recognize chart , it's value axis , name of valueaxes need check treeview node , push valueaxes.

$("#treview").on("change", function (e) {                 var chart = $("#chart").data("kendochart");                 var checkedseries = [];                 if ($("#treeview").find(":checked").length !== 0) {                     $("#treeview").find(":checked").each(function () {                         var nodetext = $(this).parent().parent().text();                         $.each(valueaxes, function (index, valueaxes) {                             if (valueaxes.name == nodetext) {                                 checkedseries.push(valueaxes);                                 checkedseries.visible = true;                             }                         });                     });                     createchart(checkedseries);                 }                 else {                     createchart(checkedseries);                 }             }); 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -