diff --git a/lab/bridgemapstyle.css b/bridgemapstyle.css similarity index 100% rename from lab/bridgemapstyle.css rename to bridgemapstyle.css diff --git a/lab/icons/bridge.png b/icons/bridge.png similarity index 100% rename from lab/icons/bridge.png rename to icons/bridge.png diff --git a/lab/icons/longest-bridge.png b/icons/longest-bridge.png similarity index 100% rename from lab/icons/longest-bridge.png rename to icons/longest-bridge.png diff --git a/lab/longest_bridges_map.html b/index.html similarity index 100% rename from lab/longest_bridges_map.html rename to index.html diff --git a/lab/bridge_data.json b/lab/bridge_data.json deleted file mode 100644 index a72b2a8..0000000 --- a/lab/bridge_data.json +++ /dev/null @@ -1,974 +0,0 @@ -{ - "data": [ - { - "name": "Akashi Kaiky\u014d Bridge", - "span": 1991, - "span_text": "1,991m", - "city": "Kobe", - "location": [ - 34.617028, - 135.021917 - ] - }, - { - "name": "Yangsigang Yangtze River Bridge", - "span": 1700, - "span_text": "1,700m", - "city": "Wuhan", - "location": [ - 30.50667, - 114.25667 - ] - }, - { - "name": "Nansha Bridge(East span)", - "span": 1688, - "span_text": "1,688m", - "city": "Dongguan", - "location": [ - 22.88475, - 113.565667 - ] - }, - { - "name": "Xihoumen Bridge", - "span": 1650, - "span_text": "1,650m", - "city": "Zhoushan", - "location": [ - 30.061778, - 121.916 - ] - }, - { - "name": "Great Belt Bridge", - "span": 1624, - "span_text": "1,624m", - "city": "Kors\u00f8r", - "location": [ - 55.34194, - 11.035917 - ] - }, - { - "name": "Osman Gazi Bridge", - "span": 1550, - "span_text": "1,550m", - "city": "Dilovas\u0131", - "location": [ - 40.75417, - 29.51528 - ] - }, - { - "name": "Yi Sun-sin Bridge", - "span": 1545, - "span_text": "1,545m", - "city": "Gwangyang", - "location": [ - 34.905944, - 127.705028 - ] - }, - { - "name": "Runyang Bridge", - "span": 1490, - "span_text": "1,490m", - "city": "Yangzhou", - "location": [ - 32.206833, - 119.363861 - ] - }, - { - "name": "Second Dongtinghu Bridge [zh]", - "span": 1480, - "span_text": "1,480m", - "city": "Yueyang", - "location": [ - 29.42472, - 113.12222 - ] - }, - { - "name": "Nanjing Fourth Yangtze Bridge", - "span": 1418, - "span_text": "1,418m", - "city": "Nanjing", - "location": [ - 32.17775, - 118.940139 - ] - }, - { - "name": "Humber Bridge", - "span": 1410, - "span_text": "1,410m", - "city": "Hessle", - "location": [ - 53.707972, - -0.450083 - ] - }, - { - "name": "Yavuz Sultan Selim Bridge", - "span": 1408, - "span_text": "1,408m", - "city": "\u0130stanbul", - "location": [ - 41.20861, - 29.11806 - ] - }, - { - "name": "Jiangyin Bridge", - "span": 1385, - "span_text": "1,385m", - "city": "Jiangyin", - "location": [ - 31.945306, - 120.26944 - ] - }, - { - "name": "Tsing Ma Bridge", - "span": 1377, - "span_text": "1,377m", - "city": "Tsing Yi", - "location": [ - 22.351333, - 114.073778 - ] - }, - { - "name": "Hardanger Bridge", - "span": 1310, - "span_text": "1,310m", - "city": "Ulvik", - "location": [ - 60.478583, - 6.829778 - ] - }, - { - "name": "Verrazzano-Narrows Bridge", - "span": 1298, - "span_text": "1,298m", - "city": "New York City", - "location": [ - 40.60639, - -74.045333 - ] - }, - { - "name": "Golden Gate Bridge", - "span": 1280, - "span_text": "1,280m", - "city": "San Francisco", - "location": [ - 37.819306, - -122.478861 - ] - }, - { - "name": "Yangluo Bridge", - "span": 1280, - "span_text": "1,280m", - "city": "Wuhan", - "location": [ - 30.636917, - 114.554944 - ] - }, - { - "name": "H\u00f6ga Kusten Bridge", - "span": 1210, - "span_text": "1,210m", - "city": "Utansj\u00f6", - "location": [ - 62.79806, - 17.9375 - ] - }, - { - "name": "Nansha Bridge(West span)", - "span": 1200, - "span_text": "1,200m", - "city": "Dongguan", - "location": [ - 22.883278, - 113.518889 - ] - }, - { - "name": "Longjiang River Bridge", - "span": 1196, - "span_text": "1,196m", - "city": "Wuhexiang", - "location": [ - 24.838806, - 98.672194 - ] - }, - { - "name": "Aizhai Bridge", - "span": 1176, - "span_text": "1,176m", - "city": "Jishou", - "location": [ - 28.331694, - 109.598111 - ] - }, - { - "name": "Mackinac Bridge", - "span": 1158, - "span_text": "1,158m", - "city": "Mackinaw City", - "location": [ - 45.81556, - -84.727944 - ] - }, - { - "name": "Ulsan Bridge [ko]", - "span": 1150, - "span_text": "1,150m", - "city": "Ulsan", - "location": [ - 35.51139, - 129.39111 - ] - }, - { - "name": "H\u00e5logaland Bridge", - "span": 1145, - "span_text": "1,145m", - "city": "Rombaken", - "location": [ - 68.45889, - 17.48222 - ] - }, - { - "name": "Qingshui River Bridge", - "span": 1130, - "span_text": "1,130m", - "city": "Kaiyang County", - "location": [ - 27.030417, - 107.189333 - ] - }, - { - "name": "Huangpu Bridge", - "span": 1108, - "span_text": "1,108m", - "city": "Guangzhou", - "location": [ - 23.071417, - 113.476083 - ] - }, - { - "name": "Minami Bisan-Seto Bridge", - "span": 1100, - "span_text": "1,100m", - "city": "Sakaide", - "location": [ - 34.36389, - 133.825194 - ] - }, - { - "name": "Xingkang Bridge\u5174\u5eb7\u5927\u6865", - "span": 1100, - "span_text": "1,100m", - "city": "Luding County", - "location": [ - 29.965389, - 102.214889 - ] - }, - { - "name": "Wufengshan Yangtze River Bridge\n\u4e94\u5cf0\u5c71\u957f\u6c5f\u5927\u6865", - "span": 1092, - "span_text": "1,092m", - "city": "Zhenjiang", - "location": [ - 32.2267389, - 119.6765 - ] - }, - { - "name": "Fatih Sultan Mehmet Bridge", - "span": 1090, - "span_text": "1,090m", - "city": "\u0130stanbul", - "location": [ - 41.09111, - 29.06111 - ] - }, - { - "name": "Baling River Bridge", - "span": 1088, - "span_text": "1,088m", - "city": "Guanling Buyei and Miao Autonomous County", - "location": [ - 25.96111, - 105.62944 - ] - }, - { - "name": "Taizhou Bridge", - "span": 1080, - "span_text": "1,080m", - "city": "Taizhou", - "location": [ - 32.246611, - 119.876694 - ] - }, - { - "name": "Ma'anshan Bridge", - "span": 1080, - "span_text": "1,080m", - "city": "Ma'anshan", - "location": [ - 31.610111, - 118.392056 - ] - }, - { - "name": "Bosphorus Bridge", - "span": 1074, - "span_text": "1,074m", - "city": "\u0130stanbul", - "location": [ - 41.045, - 29.03389 - ] - }, - { - "name": "George Washington Bridge", - "span": 1067, - "span_text": "1,067m", - "city": "New York City", - "location": [ - 40.851722, - -73.952722 - ] - }, - { - "name": "Fuma Yangtze River Bridge\u9a78\u9a6c\u957f\u6c5f\u5927\u6865", - "span": 1050, - "span_text": "1,050m", - "city": "Wanzhou", - "location": [ - 30.834667, - 108.469278 - ] - }, - { - "name": "Qipanzhou Yangtse River Bridge\u68cb\u76d8\u6d32\u957f\u6c5f\u5927\u6865", - "span": 1038, - "span_text": "1,038m", - "city": "Huangshi", - "location": [ - 30.1525778, - 115.2672972 - ] - }, - { - "name": "Third Kurushima-Kaiky\u014d Bridge", - "span": 1030, - "span_text": "1,030m", - "city": "Imabari", - "location": [ - 34.11525, - 132.984333 - ] - }, - { - "name": "Second Kurushima-Kaiky\u014d Bridge", - "span": 1020, - "span_text": "1,020m", - "city": "Umashima Island", - "location": [ - 34.12111, - 133.000194 - ] - }, - { - "name": "25 de Abril Bridge", - "span": 1013, - "span_text": "1,013m", - "city": "Lisbon", - "location": [ - 38.689861, - -9.177167 - ] - }, - { - "name": "Forth Road Bridge", - "span": 1006, - "span_text": "1,006m", - "city": "South Queensferry", - "location": [ - 56.0015, - -3.404194 - ] - }, - { - "name": "Yidu Yangtse River Bridge [zh]\u5b9c\u90fd\u957f\u6c5f\u516c\u8def\u5927\u6865", - "span": 1000, - "span_text": "1,000m", - "city": "Yidu", - "location": [ - 30.40917, - 111.51667 - ] - }, - { - "name": "Kita Bisan-Seto Bridge", - "span": 990, - "span_text": "990m", - "city": "Sakaide", - "location": [ - 34.378444, - 133.820333 - ] - }, - { - "name": "Severn Bridge", - "span": 988, - "span_text": "988m", - "city": "Bristol", - "location": [ - 51.610056, - -2.640667 - ] - }, - { - "name": "Yichang Bridge", - "span": 960, - "span_text": "960m", - "city": "Yichang", - "location": [ - 30.569583, - 111.391528 - ] - }, - { - "name": "Shimotsui-Seto Bridge", - "span": 940, - "span_text": "940m", - "city": "Kojima", - "location": [ - 34.431222, - 133.806444 - ] - }, - { - "name": "Xiushan Bridge", - "span": 926, - "span_text": "926m", - "city": "Daishan", - "location": [ - 30.21111, - 122.185361 - ] - }, - { - "name": "Xiling Bridge", - "span": 900, - "span_text": "900m", - "city": "Sandouping", - "location": [ - 30.828472, - 111.04667 - ] - }, - { - "name": "Si Du River Bridge", - "span": 900, - "span_text": "900m", - "city": "Yesanguan", - "location": [ - 30.621139, - 110.395306 - ] - }, - { - "name": "Second Namhae Bridge\uc81c2\ub0a8\ud574\ub300\uad50", - "span": 890, - "span_text": "890m", - "city": "Namhaedo", - "location": [ - 34.942889, - 127.866278 - ] - }, - { - "name": "Humen Pearl River Bridge", - "span": 888, - "span_text": "888m", - "city": "Dongguan", - "location": [ - 22.797083, - 113.615889 - ] - }, - { - "name": "Cuntan Yangtze River Bridge [zh]\u5bf8\u6ee9\u957f\u6c5f\u5927\u6865", - "span": 880, - "span_text": "880m", - "city": "Chongqing", - "location": [ - 29.620611, - 106.606056 - ] - }, - { - "name": "\u014cnaruto Bridge", - "span": 876, - "span_text": "876m", - "city": "Naruto", - "location": [ - 34.23875, - 134.650306 - ] - }, - { - "name": "Lishui River Bridge", - "span": 856, - "span_text": "856m", - "city": "Zhangjiajie", - "location": [ - 29.09861, - 110.24667 - ] - }, - { - "name": "Second Tacoma Narrows Bridge(westbound)", - "span": 853, - "span_text": "853m", - "city": "Tacoma", - "location": [ - 47.268222, - -122.550194 - ] - }, - { - "name": "Third Tacoma Narrows Bridge(eastbound)", - "span": 853, - "span_text": "853m", - "city": "Tacoma", - "location": [ - 47.267889, - -122.550778 - ] - }, - { - "name": "Ask\u00f8y Bridge", - "span": 850, - "span_text": "850m", - "city": "Bergen", - "location": [ - 60.395444, - 5.215222 - ] - }, - { - "name": "Yingwuzhou Bridge", - "span": 850, - "span_text": "850m", - "city": "Wuhan", - "location": [ - 30.534056, - 114.276889 - ] - }, - { - "name": "Jeokgeum Bridge [ko]", - "span": 850, - "span_text": "850m", - "city": "Ucheon", - "location": [ - 34.63139, - 127.50278 - ] - }, - { - "name": "Zhixi Yangtze River Bridge [zh] \u81f3\u559c\u957f\u6c5f\u5927\u6865\uff08\u5e99\u5634\u957f\u6c5f\u5927\u6865\uff09", - "span": 838, - "span_text": "838m", - "city": "Yichang", - "location": [ - 30.715611, - 111.262556 - ] - }, - { - "name": "Nanxi Bridge", - "span": 820, - "span_text": "820m", - "city": "Nanxi District", - "location": [ - 28.783694, - 104.945694 - ] - }, - { - "name": "Taihong Yangtze River Bridge [zh]\u592a\u6d2a\u957f\u6c5f\u5927\u6865", - "span": 808, - "span_text": "808m", - "city": "Chongqing", - "location": [ - 29.6632889, - 106.89333 - ] - }, - { - "name": "Qincaobei Bridge", - "span": 788, - "span_text": "788m", - "city": "Lidu", - "location": [ - 29.714306, - 107.281306 - ] - }, - { - "name": "Innoshima Bridge", - "span": 770, - "span_text": "770m", - "city": "Innoshima", - "location": [ - 34.357139, - 133.180417 - ] - }, - { - "name": "Jinshajiang Hutiaoxia Bridge\n\u91d1\u6c99\u6c5f\u5927\u6865\uff08\u9999\u4e3d\u9ad8\u901f\uff09", - "span": 766, - "span_text": "766m", - "city": "Hutiaoxiazhen", - "location": [ - 27.17417, - 100.08389 - ] - }, - { - "name": "Akinada Bridge", - "span": 750, - "span_text": "750m", - "city": "Kure", - "location": [ - 34.206222, - 132.679389 - ] - }, - { - "name": "Semey Bridge", - "span": 750, - "span_text": "750m", - "city": "Semey", - "location": [ - 50.40972, - 80.22444 - ] - }, - { - "name": "Yuecheng Xijiang Bridge\u60a6\u57ce\u897f\u6c5f\u5927\u6865", - "span": 738, - "span_text": "738m", - "city": "Yunfu", - "location": [ - 23.09361, - 112.21056 - ] - }, - { - "name": "Jinshajiang Jindong Bridge\u91d1\u4e1c\u5927\u6865", - "span": 730, - "span_text": "730m", - "city": "Huidong County", - "location": [ - 26.50925, - 103.040194 - ] - }, - { - "name": "New Carquinez Bridge", - "span": 728, - "span_text": "728m", - "city": "Vallejo", - "location": [ - 38.061028, - -122.226528 - ] - }, - { - "name": "Hakuch\u014d Bridge", - "span": 720, - "span_text": "720m", - "city": "Muroran", - "location": [ - 42.352889, - 140.950333 - ] - }, - { - "name": "Angostura Bridge", - "span": 712, - "span_text": "712m", - "city": "Ciudad Bol\u00edvar", - "location": [ - 8.144417, - -63.598111 - ] - }, - { - "name": "Kanmon Bridge", - "span": 712, - "span_text": "712m", - "city": "Kitakyushu", - "location": [ - 33.961722, - 130.958694 - ] - }, - { - "name": "San Francisco\u2013Oakland Bay Bridge(east half of west span)", - "span": 704, - "span_text": "704m", - "city": "San Francisco", - "location": [ - 37.803389, - -122.371917 - ] - }, - { - "name": "San Francisco\u2013Oakland Bay Bridge(west half of west span)", - "span": 704, - "span_text": "704m", - "city": "San Francisco", - "location": [ - 37.793167, - -122.38306 - ] - }, - { - "name": "Bronx\u2013Whitestone Bridge", - "span": 701, - "span_text": "701m", - "city": "New York City", - "location": [ - 40.801861, - -73.829778 - ] - }, - { - "name": "Maputo\u2013Katembe bridge", - "span": 680, - "span_text": "680m", - "city": "Maputo", - "location": [ - -25.973167, - 32.557417 - ] - }, - { - "name": "Stord Bridge", - "span": 677, - "span_text": "677m", - "city": "Stord", - "location": [ - 59.74806, - 5.402944 - ] - }, - { - "name": "Pierre Laporte Bridge", - "span": 668, - "span_text": "668m", - "city": "Quebec City", - "location": [ - 46.745222, - -71.290472 - ] - }, - { - "name": "Sunxihe Bridge\u7b0b\u6eaa\u6cb3\u5927\u6865", - "span": 660, - "span_text": "660m", - "city": "Bailinzhen", - "location": [ - 28.712417, - 106.462333 - ] - }, - { - "name": "Delaware Memorial Bridge(northbound)", - "span": 656, - "span_text": "656m", - "city": "New Castle", - "location": [ - 39.688972, - -75.51806 - ] - }, - { - "name": "Delaware Memorial Bridge(southbound)", - "span": 656, - "span_text": "656m", - "city": "New Castle", - "location": [ - 39.688389, - -75.518389 - ] - }, - { - "name": "Jinshajiang Hulukou Bridge", - "span": 656, - "span_text": "656m", - "city": "Hulukouzhen", - "location": [ - 26.971222, - 102.891722 - ] - }, - { - "name": "Second Saecheonnyeon Bridge [ko]\ucc9c\uc0ac\ub300\uad50", - "span": 650, - "span_text": "650m", - "city": "Mokpo", - "location": [ - 34.860361, - 126.2055 - ] - }, - { - "name": "Haicang Bridge", - "span": 648, - "span_text": "648m", - "city": "Xiamen", - "location": [ - 24.497278, - 118.068667 - ] - }, - { - "name": "Beipan River Hukun Expressway Bridge", - "span": 636, - "span_text": "636m", - "city": "Qinglong County", - "location": [ - 25.899472, - 105.32361 - ] - }, - { - "name": "Taoyuan Jinsha River Bridge\u5927\u6c38\u9ad8\u901f\u6d9b\u6e90\u91d1\u6c99\u6c5f\u5927\u6865", - "span": 636, - "span_text": "636m", - "city": "Yongsheng County", - "location": [ - 26.18389, - 100.59083 - ] - }, - { - "name": "Puli Bridge", - "span": 628, - "span_text": "628m", - "city": "Pulixiang", - "location": [ - 26.322389, - 104.58778 - ] - }, - { - "name": "Gjemnessund Bridge", - "span": 623, - "span_text": "623m", - "city": "Gjemnes", - "location": [ - 62.97139, - 7.77972 - ] - }, - { - "name": "Yuzui Yangtze Bridge", - "span": 616, - "span_text": "616m", - "city": "Yuzuizhen", - "location": [ - 29.611306, - 106.772556 - ] - }, - { - "name": "Walt Whitman Bridge", - "span": 610, - "span_text": "610m", - "city": "Philadelphia", - "location": [ - 39.905194, - -75.129472 - ] - }, - { - "name": "Tancarville Bridge", - "span": 608, - "span_text": "608m", - "city": "Tancarville", - "location": [ - 49.472667, - 0.464667 - ] - }, - { - "name": "New Little Belt Bridge", - "span": 600, - "span_text": "600m", - "city": "Middelfart", - "location": [ - 55.518639, - 9.749139 - ] - }, - { - "name": "First Kurushima-Kaiky\u014d Bridge", - "span": 600, - "span_text": "600m", - "city": "Umashima Island", - "location": [ - 34.125806, - 133.012528 - ] - }, - { - "name": "E'gongyan Rail Transit Bridge", - "span": 600, - "span_text": "600m", - "city": "Chongqing", - "location": [ - 29.522194, - 106.528222 - ] - }, - { - "name": "E'gongyan Bridge", - "span": 600, - "span_text": "600m", - "city": "Chongqing", - "location": [ - 29.523306, - 106.52825 - ] - } - ] -} diff --git a/lab/longest_bridges_chart.html b/lab/longest_bridges_chart.html deleted file mode 100644 index 974c674..0000000 --- a/lab/longest_bridges_chart.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - -

Some of the longest bridges and their lengths

- - - - - \ No newline at end of file diff --git a/lab/longest_bridges_chart.js b/lab/longest_bridges_chart.js deleted file mode 100644 index fafe8c0..0000000 --- a/lab/longest_bridges_chart.js +++ /dev/null @@ -1,71 +0,0 @@ -let canvas = document.querySelector('#bridge-chart'); -// a button that will be used to switch between the large dataset and the small one -let changeDataButton = document.querySelector('#change-data'); -let context = canvas.getContext('2d'); -// a boolean that will be used to toggle between showing the large data set and the small one -let showLargeBridgeData = false; - -// fetching the bridge data from the json file and storing it in the local variable 'largeBridgeData' -let largeBridgeData = []; -fetch('bridge_data.json') - .then(res => res.json()) - .then(data => { - largeBridgeData = data.data; - }).catch(error => {console.error("unable to fetch the bridge data: ", error)}); - - -let bridges = [ - {name: 'Verrazano-Narrows Bridge', cityState: 'New York, NY', span: 1298.4, location: [40.6066, -74.0447]}, - {name: 'Golden Gate Bridge', cityState: 'San Francisco and Marin, CA', span: 1280.2, location: [37.8199, -122.4783]}, - {name: 'Mackinac Bridge', cityState: 'Mackinaw and St Ignace, MI', span: 1158.0, location: [45.8174, -84.7278]}, - {name: 'George Washington Bridge', cityState: 'New York, NY and New Jersey, NJ', span: 1067.0, location: [40.8517, -73.9527]}, - {name: 'Tacoma Narrows Bridge', cityState: 'Tacoma and Kitsap, WA', span: 853.44, location: [47.2690, -122.5517]} -] - -// creates a new chart object and populates it with the given dataset and then returns it -// should call chart.destroy() on the already created chart if one was already created -let loadBridgeDataSet = (dataSet) => { - // creating the new chart - let bridgesChart = new Chart(context, { - type: 'bar', - data: { - datasets: [ - { - label: 'Length in Meters', - data: [], - backgroundColor: 'green' - } - ], - labels: [] - }, - options: { - scales: { - yAxes: [{ - ticks: { - beginAtZero: true - } - }] - } - } - }); - - // iterating over the dataset and adding the data to the chart - for (let i in dataSet) { - let bridge = dataSet[i]; - bridgesChart.data.labels.push(bridge.name); - bridgesChart.data.datasets[0].data.push(bridge.span); - } - bridgesChart.update(); - return bridgesChart; -} - -// creating the initial chart with the smaller dataset -let chart = loadBridgeDataSet(bridges) - -// adding an event listener to the button to toggle the small and large datasets whenever the button is pressed -changeDataButton.addEventListener('click', function () { - chart.destroy(); - showLargeBridgeData ? chart = loadBridgeDataSet(bridges) : chart = loadBridgeDataSet(largeBridgeData) - showLargeBridgeData = !showLargeBridgeData; -}) - diff --git a/lecture_code/draw_word.html b/lecture_code/draw_word.html deleted file mode 100644 index 8a5c4d5..0000000 --- a/lecture_code/draw_word.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Draw on a Picture - - - - -
- - - - - \ No newline at end of file diff --git a/lecture_code/draw_word.js b/lecture_code/draw_word.js deleted file mode 100644 index 3696173..0000000 --- a/lecture_code/draw_word.js +++ /dev/null @@ -1,20 +0,0 @@ -let canvas = document.querySelector('#canvas'); -let context = canvas.getContext('2d'); - -let input = document.querySelector('#image-text'); -input.disabled = true; - -let image = new Image(); -image.src = 'underwater.jpg'; - -image.addEventListener('load', function(){ - context.drawImage(image, 0, 0); - input.disabled = false; -}); - -input.addEventListener('input', function() { - let text = this.value; - context.font = '40px courier'; - context.drawImage(image, 0, 0); - context.fillText(text, 100, 30); -}) diff --git a/lecture_code/drawing.html b/lecture_code/drawing.html deleted file mode 100644 index 96095b1..0000000 --- a/lecture_code/drawing.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Drawing Program - - - - - - - \ No newline at end of file diff --git a/lecture_code/expenses.html b/lecture_code/expenses.html deleted file mode 100644 index d32fe75..0000000 --- a/lecture_code/expenses.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - -

Build a chart of your monthly expenses

- - - -
- - -
- -
- - -
- -
- -
- - - diff --git a/lecture_code/expenses_chart.js b/lecture_code/expenses_chart.js deleted file mode 100644 index 01acf0f..0000000 --- a/lecture_code/expenses_chart.js +++ /dev/null @@ -1,87 +0,0 @@ -/* Input elements */ -let expenseNameInput = document.querySelector('#expense-name') -let expenseAmountInput = document.querySelector('#expense-amount') -let addExpenseButton = document.querySelector('#add-expense') - -/* Get chart canvas and contex */ -let chartCanvas = document.querySelector('#expenses-doughnut-chart') -let ctx = chartCanvas.getContext('2d') - - -// creating the chart object -let expenseChart = new Chart(ctx, { - type: 'doughnut', - data: { - datasets: [ - { - data: [], - backgroundColor: [] - } - ], - labels: [] - }, - options: {} // fill in things here later. -}) - -// this array contains a list of all the colors that will be used in the chart -// the first color will be used for the first expense, and so on and so on -let chartColors = [ 'tomato', 'orange', 'dodgerblue', 'mediumseagreen', 'slateblue', 'violet' ] - - -// adds the expense to the chart -function addExpenseToChart(name, amount) { - // adding the expense to the chart - expenseChart.data.labels.push(name); - expenseChart.data.datasets[0].data.push(amount); - - let colorCount = expenseChart.data.datasets[0].backgroundColor.length - let color = chartColors[colorCount % chartColors.length] - - expenseChart.data.datasets[0].backgroundColor.push(color); - - expenseChart.update(); -} - -// adding functionality to the addExpenseButton -addExpenseButton.addEventListener('click', function() { - - let errors = [] - - let expenseName = expenseNameInput.value - let expenseAmount = expenseAmountInput.value - - // Validate both fields are filled in, and the amount is a positive number - if (expenseName.length == 0) { - errors.push('Enter a type of expense') - } - - if (expenseAmount.length == 0 || expenseAmountInput < 0) { - errors.push('Enter a positive amount for the expense') - } - - // If any errors, alert and return - do not procede to add to chart - if (errors.length > 0) { - alert( errors.join('\n') ) - return - } - - // calling function to update the chart - addExpenseToChart(expenseName, expenseAmount); - - // Clear inputs, ready for next expense name and amount. - expenseNameInput.value = '' - expenseAmountInput.value = '' - -}) - - -// adding an event listener to click the add to chart button anytime the enter button is clicked -window.addEventListener('keyup', function() { - if (event.keyCode === 13) { - let inputElements = [expenseNameInput, expenseAmountInput, addExpenseButton]; - if (inputElements.includes(document.activeElement)) { - addExpenseButton.click(); - expenseNameInput.focus(); - } - } -}) \ No newline at end of file diff --git a/lecture_code/hello_chart.html b/lecture_code/hello_chart.html deleted file mode 100644 index 8cf8350..0000000 --- a/lecture_code/hello_chart.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - -

Unscientific survey of soda preferences

- - - - \ No newline at end of file diff --git a/lecture_code/hello_chart.js b/lecture_code/hello_chart.js deleted file mode 100644 index 4d92607..0000000 --- a/lecture_code/hello_chart.js +++ /dev/null @@ -1,23 +0,0 @@ -let canvas = document.querySelector('#soda-chart'); -let context = canvas.getContext('2d'); - -let chart = new Chart(context, { - type: 'bar', - data: { - labels: ['Coke', 'Pepsi','Sprite', 'Either', 'Neither'], - datasets: [{ - label: 'Number of votes', - data: [18, 14, 10, 7, 10], - backgroundColor: ['red', 'blue', 'yellowgreen', 'green', 'yellow'] - }] - }, - options: { - scales: { - yAxes: [{ - ticks: { - beginAtZero: true - } - }] - } - } -}) \ No newline at end of file diff --git a/lecture_code/hello_map.html b/lecture_code/hello_map.html deleted file mode 100644 index 050388c..0000000 --- a/lecture_code/hello_map.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - -

Where are Minnesota State Colleges?

-
- - - diff --git a/lecture_code/maps.js b/lecture_code/maps.js deleted file mode 100644 index a8e810c..0000000 --- a/lecture_code/maps.js +++ /dev/null @@ -1,48 +0,0 @@ -let metroAreaCenterCoordinates = [44.96, -93.2]; -let zoomLevel = 9; // 1 = whole world 20 = city blocks - -// map function takes an id of a div to draw the map under -let map = L.map('college-map').setView(metroAreaCenterCoordinates, zoomLevel); - -// L refers to the leaflet object -L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - attribution: '© OpenStreetMap contributors' -}).addTo(map); - -campuses = [ - {"name": "Minneapolis College", "website": "https://minneapolis.edu", "coordinates": [44.9724, -93.2844] }, - {"name": "Saint Paul College", "website": "https://saintpaul.edu", "coordinates": [44.94839, -93.1099] }, - {"name": "Normandale Community College", "website": "https://normandale.edu", "coordinates": [44.8297, -93.3312] }, - {"name": "North Hennepin Community College", "website": "https://nhcc.edu", "coordinates": [45.1054232,-93.3767558] }, - {"name": "Century College", "website": "https://www.century.edu/", "coordinates": [45.0438494,-92.9862026] } -] - -// looping over the campuses array and adding popups for each of the campuses -for (let i in campuses) { - let campus = campuses[i]; - L.marker(campus.coordinates).bindPopup(`${campus.name}
Website`).addTo(map); -} - -// let mctcCoordinates = [44.9724, -93.2844]; -// let mctcMarker = L.marker(mctcCoordinates) -// .bindPopup('Minneapolis College
Website') -// .addTo(map); -// -// let stPaulCoordinates = [44.9483, -93.1099]; -// let stpMarker = L.marker(stPaulCoordinates) -// .bindPopup('Saint Paul College
Website') -// .addTo(map); -// -// let nmdCoordinates = [44.8297, -93.3312]; -// let nmdMarker = L.marker(nmdCoordinates) -// .bindPopup('Normandale Community College
Website') -// .addTo(map); - -// here we are adding the circle for the area that is the metro area -let metroAreaCircle = L.circle(metroAreaCenterCoordinates, { - color: 'green', - radius: 30000, - fillOpacity: 0.1 - }) - .bindPopup('Twin Cities Metro Area') - .addTo(map); diff --git a/lecture_code/mapstyle.css b/lecture_code/mapstyle.css deleted file mode 100644 index 5cd1a82..0000000 --- a/lecture_code/mapstyle.css +++ /dev/null @@ -1,5 +0,0 @@ -#college-map { - width: 600px; - height: 500px; - border: 1px green solid; -} \ No newline at end of file diff --git a/lecture_code/page_template.html b/lecture_code/page_template.html deleted file mode 100644 index bf863fb..0000000 --- a/lecture_code/page_template.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Title - - - - - - - - - \ No newline at end of file diff --git a/lecture_code/underwater.jpg b/lecture_code/underwater.jpg deleted file mode 100644 index 46d1ddf..0000000 Binary files a/lecture_code/underwater.jpg and /dev/null differ diff --git a/lab/longest_bridges_map.js b/longest_bridges_map.js similarity index 100% rename from lab/longest_bridges_map.js rename to longest_bridges_map.js