[JS] function change(sender) //onChange Event triggered { window.val = parseInt(sender.value); if(val > 10) window.val = 10; var chart = $("#container").ejChart("instance"); chart.model.series = []; for (var i = 0; i < window.val; i++) { var points = []; for (var j = 0; j < 10; j++) { var random = parseInt(getRandomInt(20, 50)); points.push({ x: j, y: random }); } chart.model.series.push({ dataSource: points, xName: "x", yName: "y", type: "line" }); } chart.redraw(); } function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } |