I need to generate a Json file that will feed a graphic. I need to load the following information. I have a form that receives date (dd / mm / yyyy).
My chart shows the number of visits per year x month.
I make the following conference in my bank:
visitYearGraphic.year = moment(visit.date).format('YYYY');
visitYearGraphic.month = moment(visit.date).format('MM');
visitYearGraphics.push(visitYearGraphic);
var ano13 = 0;
var ano15 = 0;
var ano15 = 0;
_.each(visitYearGraphics, function (visitYearGraphic) {
if(visitYearGraphic.year=="2015" && visitYearGraphic.month=="01"){
armazeno qtde de registros
}
... e assim para os demais meses de 2015
});
But I wanted a method with a clean code to create this function. Because the above way, it will get giant.