Added scripts to generate a single html file from CSVs;

./generate_page.sh csv1 csv2 > output.html
This commit is contained in:
Damien Gasparina 2016-02-23 21:42:15 +01:00
parent 73b8c6113c
commit f47ce0856c
3 changed files with 10654 additions and 6 deletions

43
generate_page.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh
##
## pregeneratehtml.sh
##
## Made by gaspar_d
## Login <d.gasparina@gmail.com>
##
## Started on Tue 23 Feb 20:17:04 2016 gaspar_d
## Last update Tue 23 Feb 21:08:26 2016 gaspar_d
##
main() {
gCSVs=""
while [[ "$#" -gt "0" ]]; do
file=$1
content=`cat $file`
gCSVs="${gCSVs}\`${content}\`,"
shift;
done
gCSVs="[${gCSVs%?}]"
output=$1
html=`cat index.html | grep -v stylesheet | grep -v script | grep -v '</body>'`
echo $html
for js in js/{d3.min.js,jquery-2.1.4.js,nv.d3.min.js,dashboard.js,graph.js}; do
echo "<script type='text/javascript'>"
cat ${js}
echo "</script>"
done
echo "<script type='text/javascript'>gCSVs=${gCSVs};</script>"
for css in css/*.css; do
echo "<style>"
cat ${css}
echo "</style>"
done
echo "</body>"
}
main $@

10595
generate_page_example.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,8 @@
/*
* Global variables
*/
gGraphs = {};
gCSVs = [];
var brush = d3.svg.brush()
.on("brushend", brushed);
@ -19,8 +18,6 @@ var x = d3.time.scale().range([0, width]),
/*
* DOM functions
*/
$(document).on('dragenter', function (e) {
e.stopPropagation();
e.preventDefault();
@ -39,10 +36,24 @@ $(document).on('drop', function (e) {
});
/*
* Init functions
*/
$(document).ready(function() {
// initialize graphs contained in gCSVs
if (gCSVs !== undefined && gCSVs.length > 0) {
$('#drop-background').hide();
for (i in gCSVs) {
processCSV(gCSVs[i], "csv " + i)
}
}
}
)
/*
* Settings functions
*/
var settings = { "compact": false }
applySettings(settings)
@ -52,7 +63,6 @@ function applySettings(settings) {
/*
* CSV Processing functions
*/
function processFiles(files) {
for (f = 0; file = files[f]; f++) {
processFile(file);