Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Volker Coors
Visualization
Commits
734750db
Commit
734750db
authored
1 year ago
by
Rushikesh Padsala
Browse files
Options
Download
Email Patches
Plain Diff
Updated exercise 1 html
parent
4d67a691
Pipeline
#7525
passed with stages
in 8 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Exercise 1/index.html
+51
-77
Exercise 1/index.html
with
51 additions
and
77 deletions
+51
-77
Exercise 1/index.html
+
51
-
77
View file @
734750db
<html>
<html>
<head>
<head>
<title>
Building - Heat Demand
</title>
<title>
Building - Heat Demand
</title>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
...
@@ -12,25 +12,6 @@
...
@@ -12,25 +12,6 @@
<script
src=
"https://cdn.jsdelivr.net/npm/chart.js"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/chart.js"
></script>
<script
src=
"building_data.js"
></script>
<script
src=
"building_data.js"
></script>
<link
rel=
"stylesheet"
href=
"index.css"
>
<link
rel=
"stylesheet"
href=
"index.css"
>
<style>
body
{
display
:
flex
;
flex-direction
:
row
;
margin
:
0
;
padding
:
0
;
}
#map-container
{
flex
:
1
;
height
:
100vh
;
}
#chart-container
{
flex
:
1
;
padding
:
20px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
</style>
</head>
</head>
<body>
<body>
<div
id=
"map-container"
>
<div
id=
"map-container"
>
...
@@ -39,9 +20,7 @@
...
@@ -39,9 +20,7 @@
<div
id=
"chart-container"
>
<div
id=
"chart-container"
>
<canvas
id=
"yocChart"
></canvas>
<canvas
id=
"yocChart"
></canvas>
</div>
</div>
<script>
<script>
var
mymap
=
L
.
map
(
'
mapid
'
).
setView
([
48.79205
,
9.20758
],
16
);
var
mymap
=
L
.
map
(
'
mapid
'
).
setView
([
48.79205
,
9.20758
],
16
);
var
OpenStreetMap_DE
=
L
.
tileLayer
(
'
https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png
'
,
{
var
OpenStreetMap_DE
=
L
.
tileLayer
(
'
https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png
'
,
{
maxZoom
:
18
,
maxZoom
:
18
,
...
@@ -91,30 +70,28 @@
...
@@ -91,30 +70,28 @@
style
:
style
,
style
:
style
,
}).
addTo
(
mymap
);
}).
addTo
(
mymap
);
// Retrieve the building year of construction data from the GeoJSON
var
buildingYoc
=
building_data
.
features
.
map
(
function
(
feature
)
{
// Retrieve the building year of construction data from the GeoJSON
var
buildingYoc
=
building_data
.
features
.
map
(
function
(
feature
)
{
return
feature
.
properties
.
Year_of_co
;
return
feature
.
properties
.
Year_of_co
;
});
});
// Count the occurrences of each building age
// Count the occurrences of each building age
var
yocCounts
=
{};
var
yocCounts
=
{};
buildingYoc
.
forEach
(
function
(
Year_of_co
)
{
buildingYoc
.
forEach
(
function
(
Year_of_co
)
{
if
(
yocCounts
[
Year_of_co
])
{
if
(
yocCounts
[
Year_of_co
])
{
yocCounts
[
Year_of_co
]
++
;
yocCounts
[
Year_of_co
]
++
;
}
else
{
}
else
{
yocCounts
[
Year_of_co
]
=
1
;
yocCounts
[
Year_of_co
]
=
1
;
}
}
});
});
// Prepare the chart data
// Prepare the chart data
var
yocLabels
=
Object
.
keys
(
yocCounts
);
var
yocLabels
=
Object
.
keys
(
yocCounts
);
var
yocData
=
Object
.
values
(
yocCounts
);
var
yocData
=
Object
.
values
(
yocCounts
);
// Create the building year of construction distribution chart using Chart.js
// Create the building year of construction distribution chart using Chart.js
var
ctx
=
document
.
getElementById
(
'
yocChart
'
).
getContext
(
'
2d
'
);
var
ctx
=
document
.
getElementById
(
'
yocChart
'
).
getContext
(
'
2d
'
);
var
yocChart
=
new
Chart
(
ctx
,
{
var
yocChart
=
new
Chart
(
ctx
,
{
type
:
'
bar
'
,
type
:
'
bar
'
,
data
:
{
data
:
{
labels
:
yocLabels
,
labels
:
yocLabels
,
...
@@ -123,7 +100,6 @@ var yocChart = new Chart(ctx, {
...
@@ -123,7 +100,6 @@ var yocChart = new Chart(ctx, {
data
:
yocData
,
data
:
yocData
,
backgroundColor
:
'
rgba(75, 192, 192, 0.5)
'
,
backgroundColor
:
'
rgba(75, 192, 192, 0.5)
'
,
borderColor
:
'
rgba(75, 192, 192, 1)
'
,
borderColor
:
'
rgba(75, 192, 192, 1)
'
,
borderWidth
:
1
borderWidth
:
1
}]
}]
},
},
...
@@ -144,9 +120,7 @@ var yocChart = new Chart(ctx, {
...
@@ -144,9 +120,7 @@ var yocChart = new Chart(ctx, {
stepSize
:
15
stepSize
:
15
}
}
}
}
}
}
});
});
</script>
</script>
</body>
</body>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets