File indexing completed on 2024-12-22 05:34:40

0001 !(function (d3) {
0002 
0003             var parseTime = d3.timeParse("%Y%m");
0004                     
0005 
0006                 d3.json("/backend/index/getproductmonthly?project_id="+window.project_id, function(error, data) {                                            
0007                 if (error) throw error;
0008 
0009              
0010                 data = data.results;   
0011                 if(!data){
0012                      $("#topDownloadsPerMonthTabContainer_DetailMonthly").text('no data found!');
0013                     return;
0014                 }
0015 
0016                 data.forEach(function (d) {                   
0017                    d.year = parseTime(d.yearmonth);
0018                    d.amount = +d.amount;                      
0019                 });     
0020 
0021                 var title =project_id+'_monthly';               
0022                 var chartColumns ={
0023                     [title]: {column: 'amount'}                       
0024                 };
0025 
0026                             
0027                 var chart = makeLineChart(data, 'year',chartColumns , {xAxis: 'Month', yAxis: 'Amount'});
0028 
0029                 $('#topDownloadsPerMonthTabContainer_DetailMonthly').empty();
0030                 chart.bind("#topDownloadsPerMonthTabContainer_DetailMonthly");
0031                 chart.render();
0032 
0033             });
0034 
0035 
0036 })(d3);