• malicious
  • twitter
Hridayindia.in
; //alert("hello"); var data = convertData2(jsonData); var options = { // title: 'Project Progress', width: "100%", chartArea: { left: "20%", //top: "5%", height: "80%", width: "100%" }, isStacked: true, hAxis: { //title: 'Total Population', // minValue: 0, // scaleType: 'log', textPosition: 'none' }, vAxis: { // title: 'City' }, colors: ['#08B','#E68406','#05684F'], //tooltip: {isHtml: true}, bars: 'horizontal', legend: {position: 'top', maxLines: 3} }; var chart = new google.visualization.BarChart(document.getElementById('sbm_service')); chart.draw(data, options); } google.charts.setOnLoadCallback(drawMetroService); function convertData2(dataconvert){ var data = new google.visualization.DataTable(); data.addColumn('string','City'); data.addColumn('number',toTitleCase('city_hriday_plan'.replace(/\_/g,' '))); data.addColumn({type: 'string', role: 'tooltip'}); data.addColumn('number',convertLetter('readiness_of_dpr')); data.addColumn({type: 'string', role: 'tooltip'}); data.addColumn('number',toTitleCase('sanctioned_amount'.replace(/\_/g,' '))); data.addColumn({type: 'string', role: 'tooltip'}); $.each(dataconvert, function(idx, obj) { data.addRow([toTitleCase(idx), parseInt(obj.city_hriday_plan),toTitleCase('city_hriday_plan'.replace(/\_/g,' ')) + " "+ parseInt(obj.city_hriday_plan)+"%", parseInt(obj.readiness_of_dprs),convertLetter('readiness_of_dpr') + " "+ parseInt(obj.readiness_of_dprs)+"%", parseInt(obj.sanctioned_amount),toTitleCase('sanctioned_amount'.replace(/\_/g,' ')) + " "+ parseInt(obj.sanctioned_amount)+"%"]); }); return data; } function convertLetter(str) { var str_arr = str.split('_'); str_arr[0] =toTitleCase(str_arr[0]); str_arr[2] = str_arr[2].toUpperCase()+'s'; return str_arr.join(' '); } function toTitleCase(str) { return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); } function drawMetroService(typ) { var prev_state_m = ''; prev_state_m = $('#metro_service').css('display'); if(typ == 1){ $('#metro_service').show(); } var jsonData = [{"year":"2002","under_construction":"24.9","operational":"8.4"},{"year":"2004","under_construction":"39.1","operational":"26"},{"year":"2006","under_construction":"51.92","operational":"65.1"},{"year":"2008","under_construction":"128.54","operational":"68.19"},{"year":"2010","under_construction":"116.9","operational":"156.63"},{"year":"2012","under_construction":"216.88","operational":"196.94"},{"year":"2014","under_construction":"203.51","operational":"210.31"},{"year":"2016","under_construction":"165.63","operational":"263.6"}]; var data = new google.visualization.DataTable(jsonData); data.addColumn('string', 'Year'); data.addColumn('number', 'Under Construction'); data.addColumn('number', 'Operational'); $.each(jsonData, function(idx, obj) { // console.log(obj.year); data.addRow([obj.year, parseInt(obj.under_construction), parseInt(obj.operational)]); }); var options = { hAxis: { title: 'Year' }, width: '100%', chartArea: { left: "10%", // top: "3%", //height: "80%", width: "100%" }, vAxis: { title: 'Distance (in Kms)' }, colors: ['#E68406','#05684F'], legend: {position: 'top', maxLines: 2}, pointSize: 8, series: { 1: {curveType: 'function'} } }; var chart = new google.visualization.LineChart(document.getElementById('metro_service')); google.visualization.events.addListener(chart, 'ready', function() { // alert ($('#amrut_service2').css('display')+ " == "+typ); //alert (prev_state_m+ "==="); if(typ == '1'){ document.getElementById('metro_service').style.display = prev_state_m; }else { document.getElementById('metro_service').style.display = 'inline-block'; } // document.getElementById('amrut_service2').style.display = 'none'; }); chart.draw(data, options); } google.charts.setOnLoadCallback(drawBusesService); function drawBusesService(typ) { var prev_state_m2 = ''; prev_state_m2 = $('#buses_service').css('display'); if(typ == 2){ $('#buses_service').show(); } var jsonData = [{"year":"2009","sanction":"15485","procure":"0"},{"year":"2010","sanction":"15485","procure":"12634"},{"year":"2011","sanction":"15485","procure":"12634"},{"year":"2012","sanction":"15485","procure":"13311"},{"year":"2013","sanction":"22994","procure":"14079"},{"year":"2014","sanction":"22994","procure":"16000"},{"year":"2015","sanction":"22994","procure":"18186"},{"year":"2016","sanction":"22994","procure":"18353"}]; var data = new google.visualization.DataTable(jsonData); data.addColumn('string', 'Year'); data.addColumn('number', 'Sanctioned'); data.addColumn('number', 'Procured'); $.each(jsonData, function(idx, obj) { data.addRow([obj.year, parseInt(obj.sanction), parseInt(obj.procure)]); }); var options = { width: '100%', chartArea: { left: "10%", // top: "3%", //height: "80%", width: "100%" }, hAxis: { title: 'Year' }, vAxis: { title: 'No of Buses' }, colors: ['#E68406','#05684F'], legend: {position: 'top', maxLines: 2}, pointSize: 8, series: { 1: {curveType: 'function'} } }; var chart = new google.visualization.LineChart(document.getElementById('buses_service')); google.visualization.events.addListener(chart, 'ready', function () { if(typ == '2'){ document.getElementById('buses_service').style.display = prev_state_m2; }else { document.getElementById('buses_service').style.display = 'none'; } // document.getElementById('metrotab2').style.display = 'none'; }); chart.draw(data, options); } function convertAmrutData(dataconvert,typ){ var data = new google.visualization.DataTable(); if(typ == 1){ data.addColumn('string','Type'); data.addColumn('number','Number'); $.each(dataconvert, function(idx, obj) { var type = obj.Type; if((obj.Type).indexOf('DPR') !== -1){ type = (obj.Type).replace("DPR", "DPRs"); } data.addRow([getAmrutName((type).replace(/\-/g,' ')),parseInt(obj.Number)]); }); }else if(typ ==2){ data.addColumn('string','Type'); data.addColumn('number','Cost'); $.each(dataconvert, function(idx, obj) { var type = obj.Type; if((obj.Type).indexOf('DPR') !== -1){ type = (obj.Type).replace("DPR", "DPRs"); } data.addRow([getAmrutName((type).replace(/\-/g,' ')),parseInt(obj.Cost)]); }); } return data; } // google.charts.load('current', {'packages':['corechart']}); //google.charts.setOnLoadCallback(drawAmrut1); //google.charts.setOnLoadCallback(drawAmrut2); function getAmrutName(keyname){ switch(keyname) { case "DPR Not Approved": text = "DPR Under Approval"; break; default: text = keyname.replace(/\-/g,' ');; } return text; } $(window).resize(function(){ drawRightY(); // drawAmrut1(1); //drawAmrut2(2); drawMetroService(1); drawBusesService(2); }); Top