Skip to Content Accessibility Information

Department of Budget and Management

 

// <![CDATA[ function generateFacts(){ facts.style.border="2 px solid black"; factOneJSON = "https://data.maryland.gov/resource/ctry-cv5j.json"; /*MdTA Toll Transactions: Statewide Total by Month*/ factTwoJSON = "https://data.maryland.gov/resource/sg3d-y9su.json"; /*Lead Paint Inspectors*/ factThreeJSON = "https://data.maryland.gov/resource/664f-i2dc.json"; /*DGS Energy Competition*/ factFourJSON = "https://data.maryland.gov/resource/a4hf-2sfw.json?state=Maryland"; /*Choose Maryland – Compare States: Demograhics*/ factOne=""; factTwo=""; factThree=""; factFour=""; $.getJSON(factOneJSON,function(ajaxresult){ var newestMonth=ajaxresult[ajaxresult.length-1].date.substring(0,7); var totalTransactionsLastMonth = parseInt(0,10); var tollIter=0; while(tollIter<ajaxresult.length){ if(ajaxresult[tollIter].date.substring(0,7)===newestMonth){ totalTransactionsLastMonth += parseInt(ajaxresult[tollIter].total_transactions,10); } tollIter++; } var comparedToMonth = generateCompareMonth(newestMonth); var secondTollIter=0; var totalTransactionsComparedMonth = 0; while(secondTollIter<ajaxresult.length){ if(ajaxresult[secondTollIter].date.substring(0,7)===comparedToMonth){ totalTransactionsComparedMonth += parseInt(ajaxresult[secondTollIter].total_transactions,10); } secondTollIter++; } var percentChange = (100*(totalTransactionsLastMonth-totalTransactionsComparedMonth)/totalTransactionsComparedMonth).toFixed(2); if(percentChange==0) {factOne = "Maryland's toll road use "+"did not change significantly from ” +compareHumanString+” to “+humanString+”.”;} else if(percentChange>0) {factOne = “Maryland’s “+(‘toll road use increased ‘.fontcolor(‘green’))+ (percentChange+”%”).link(“https://data.maryland.gov/Transportation/Toll-Transactions/hrir-ejvj”)+” from ” +compareHumanString+” to “+humanString+”.”;} else if(percentChange<0) {factOne = "Maryland's "+('toll road use decreased '.fontcolor('red'))+((-1)*percentChange+"%").link("https://data.maryland.gov/Transportation/Toll-Transactions/hrir-ejvj")+" from " +compareHumanString+" to "+humanString+".";} else{factOne = "Error calculating toll road usage.“;} $.getJSON(factTwoJSON,function(ajaxresult){ factTwo=”Maryland has “+ajaxresult.length+” licensed and accredited lead paint inspectors. Click here for the full list.”; $.getJSON(factThreeJSON,function(ajaxresult){ var kwhChange = (ajaxresult[ajaxresult.length-1].total_change_kwh_2014*100).toFixed(1); /*Starts advancing through facts using the advanceFacts() function, at 5 second intervals*/ factThree = “Maryland “+(“state agencies decreased their energy use”.fontcolor(‘green’))+” (kWh) by “+((-1)*kwhChange+”%”).link(“https://data.maryland.gov/Energy-and-Environment/DGS-Energy-Competition-State-Agency-Energy-Consump/ptnj-mv6r”)+” from FY08 to FY14.”; $.getJSON(factFourJSON,function(ajaxresult){ var populationChange = parseInt(0,10); populationChange = (100*(ajaxresult[0].total_population_current – ajaxresult[0].total_population_previousyear1) / ajaxresult[0].total_population_previousyear1).toFixed(2); factFour = “Maryland’s population increased”.fontcolor(‘green’)+” by “+(populationChange+”%”).link(“https://data.maryland.gov/Demographic/Choose-Maryland-Compare-States-Demographics/8mc4-hxm7″)+” from 2010 to 2014.”; curMarker = 0; setInnerHTML(factOne,setInterval(advanceFacts,5000)); }); }); }); }); } // ]]>// // //