waterfall

Asynchronous Loop of jQuery Deferreds (promises)

荒凉一梦 提交于 2019-11-28 05:25:38
I am trying to create what I think is referred to as a "Waterfall". I want to sequentially process an array of async functions (jQuery promises). Here's a contrived example: function doTask(taskNum){ var dfd = $.Deferred(), time = Math.floor(Math.random()*3000); setTimeout(function(){ console.log(taskNum); dfd.resolve(); },time) return dfd.promise(); } var tasks = [1,2,3]; for (var i = 0; i < tasks.length; i++){ doTask(tasks[i]); } console.log("all done"); I would like it to complete the task in the order they are executed (present in the array). So, in this example I want it to do task 1 and

Annotation Google Chart API

北慕城南 提交于 2019-11-28 02:20:15
i'm trying to use Google Chart API for building an Waterfall chart. I noticed that Candlestick/Waterfall charts are not supporting the annotations. See this jsfiddle sample google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Category'); data.addColumn('number', 'MinimumLevel'); data.addColumn('number', 'MinimumLevel1'); data.addColumn('number', 'MaximumLevel'); data.addColumn('number', 'MaximumLevel1'); data.addColumn({type: 'number', role:

Asynchronous Loop of jQuery Deferreds (promises)

拥有回忆 提交于 2019-11-27 00:56:00
问题 I am trying to create what I think is referred to as a "Waterfall". I want to sequentially process an array of async functions (jQuery promises). Here's a contrived example: function doTask(taskNum){ var dfd = $.Deferred(), time = Math.floor(Math.random()*3000); setTimeout(function(){ console.log(taskNum); dfd.resolve(); },time) return dfd.promise(); } var tasks = [1,2,3]; for (var i = 0; i < tasks.length; i++){ doTask(tasks[i]); } console.log("all done"); I would like it to complete the task