I would like to know how Data come to jsreport . I saw the script file and understand
that how data displayed in the jsreport , however I don't know where actually data is rendering from. I need to change the country name like 'France ' into China . I tried to change it but after changed I lost graph's visual data because of condition in that beforeRender function. So please, anyone help me .
function beforeRender(req, res, done) {
req.data.country = req.data.country || 'France';
req.data.orders = [];
getData(req, function (err) {
if (err) {
return done(err);
}
req.data.ordersCount = req.data.orders.length;
req.data.customers.forEach(function (c) {
c.ordersCount = req.data.orders.filter(function (o) {
return o.CustomerID === c.CustomerID;
}).length;
});
var ordersByQuarter = {};
req.data.orders.forEach(function (o) {
o.OrderDate = new Date(o.OrderDate);
var key = o.OrderDate.getFullYear() + '/' + (o.OrderDate.getMonth() + 1);
ordersByQuarter[key] = ordersByQuarter[key] || { value: 0, orderDate: o.OrderDate };
ordersByQuarter[key].value++;
});
req.data.accumulatedOrders = ordersByQuarter
done();
})}
After changed country name