Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
eDisplay
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Green Science
eDisplay
Commits
1c017e15
Commit
1c017e15
authored
5 years ago
by
Lillian Gray
Browse files
Options
Downloads
Patches
Plain Diff
Simplify data fetching #9
parent
96c7b7ca
Branches
main
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
index.html
+1
-1
1 addition, 1 deletion
index.html
js/main.js
+5
-9
5 additions, 9 deletions
js/main.js
with
6 additions
and
10 deletions
index.html
+
1
−
1
View file @
1c017e15
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<script
src=
"js/loader.js"
></script>
<script
src=
"js/loader.js"
></script>
<script>
<script>
google
.
charts
.
load
(
'
45.2
'
,
{
packages
:[
'
corechart
'
,
'
controls
'
]});
google
.
charts
.
load
(
'
45.2
'
,
{
packages
:[
'
corechart
'
,
'
controls
'
]});
google
.
charts
.
setOnLoadCallback
(
onAPILoad
);
google
.
charts
.
setOnLoadCallback
(
getData
);
</script>
</script>
</head>
</head>
<body>
<body>
...
...
This diff is collapsed.
Click to expand it.
js/main.js
+
5
−
9
View file @
1c017e15
...
@@ -28,19 +28,15 @@ var startDate
...
@@ -28,19 +28,15 @@ var startDate
var
URLComponents
=
document
.
URL
.
split
(
'
?
'
)
var
URLComponents
=
document
.
URL
.
split
(
'
?
'
)
/*called when GoogleAPI finishes loading in index.html
/*called when GoogleAPI finishes loading in index.html
calls getData and then passes the data into initializeLineChart when finished*/
fetches column data from config.json
function
onAPILoad
(){
fetches data for chart from text file generated by data_gen.py
getData
().
done
(
initializeLineChart
)
passes the data into initializeLineChart when finished*/
}
//fetches data for chart from text file generated by data_gen.py
function
getData
(){
function
getData
(){
$
.
getJSON
(
"
config.json
"
,
function
(
data
){
$
.
getJSON
(
"
config.json
"
,
function
(
data
){
buildings
=
data
.
building
buildings
=
data
.
building
})
})
return
$
.
ajax
({
$
.
getJSON
(
"
raw_line_chart.txt
"
,
function
(
data
){
url
:
"
raw_line_chart.txt
"
,
//location of data file
initializeLineChart
(
data
)
dataType
:
"
json
"
,
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment