我创建了条形图,这些是重要的位:
var event = d3.touch(svg.node()) || d3.mouse(svg.node());
var dy = y.invert(d3.event.dy);
当用户在条形图段的y边界上拖动时,我尝试调整其大小(每个条形图的域范围为[0,100],如前所示),以便获得域值的增量变化: / p>
dy
但是我有两个问题,[0, 100]
令人惊讶地是两倍,并且没有给我一个与视觉拖动量成比例的值,该值等于int router.post('/', function (req, res) {
var medicineObjArray = [];
rp({
uri: 'http://www.mymainurl.com/index',
transform: function (body) {
return cheerio.load(body);
}
}).then(function ($) {
$('.remedy_list a').each((index, elem) => {
var text = $(elem).text();
var link = $(elem).attr('href');
if (text != '' && link != undefined) {
medicineObjArray.push({
pageName: text,
link: link
});
}
});
var promises = medicineObjArray.map(function(item, index){
rp(
{
uri : item.link,
method: 'GET',
transform: function(body){
return cheerio.load(body);
}
}
).then(function($) {
if ($('.content:contains("paralysis")').length > 0) {
var med = {
medicine: item.medicine,
link: item.link
};
return med;
} else {
return;
}
}).catch(function(err){
console.log('--------- ERROR getting the page data: ' + err);
});
});
return Promise.all(promises).then((data) => {
console.log('-- promised data: ' + data[0]); //is called even before the request is made to an individual link
console.log('-- promised data: ' + data[1]);
console.log('-- promised data: ' + data[2]);
});
}).catch(function (err) {
console.log('--------- ERROR Cheerio chocked');
});
});
域范围。