Changed plot style to improve clarity
This commit makes the dots smaller and changes their style from dots to
crosses. Also, the last dot is now blue instead of black, and the line
is a gradient from 50% black to 100% black so the line progress can be
seen clearer (because the lines cross several times).
Change-Id: Ibc41a4a5c0d27eed01244a450c38945537b93e69
diff --git a/cron/generateCustomData.php b/cron/generateCustomData.php
index 5be2bc0..2055071 100644
--- a/cron/generateCustomData.php
+++ b/cron/generateCustomData.php
@@ -48,8 +48,11 @@
$file = tmpfile();
$fileName = stream_get_meta_data($file)['uri'];
- foreach ($summary as $row)
- fwrite($file, $row["data"]." ".$row["ia14"]." ".$row["rho7"]."\n");
+ $i = 0;
+ foreach ($summary as $row) {
+ fwrite($file, $row["data"]." ".$row["ia14"]." ".$row["rho7"]." ".$i."\n");
+ ++$i;
+ }
// Cridem al gnuplot perquè generi la gràfica
shell_exec("gnuplot -c generateCustomGraph.gnu \"".escapeshellcmd($area["name"])."\" \"".escapeshellcmd($area["codename"])."\" \"".escapeshellcmd($fileName)."\"");
diff --git a/cron/generateCustomGraph.gnu b/cron/generateCustomGraph.gnu
index 7f1e73f..fe88560 100644
--- a/cron/generateCustomGraph.gnu
+++ b/cron/generateCustomGraph.gnu
@@ -7,7 +7,6 @@
set terminal svg size 500, 500
set output '/tmp/covid19graphgenerator-area-'.codeName.'-graph.svg'
-set pointsize 0.75
load "includes/plotCustomGraph.gnu"
set terminal png size 500, 500
diff --git a/cron/generateData.php b/cron/generateData.php
index 996fdcd..363f346 100644
--- a/cron/generateData.php
+++ b/cron/generateData.php
@@ -61,8 +61,11 @@
foreach ($summary as $regio => $summaryRegio) {
$file = fopen("/tmp/covid19graphgenerator-".$CODENAME[$regio].".dat", "w");
- foreach ($summaryRegio as $row)
- fwrite($file, $row["data"]." ".$row["ia14"]." ".$row["rho7"]."\n");
+ $i = 0;
+ foreach ($summaryRegio as $row) {
+ fwrite($file, $row["data"]." ".$row["ia14"]." ".$row["rho7"]." ".$i."\n");
+ ++$i;
+ }
fclose($file);
}
diff --git a/cron/generateGraphs.gnu b/cron/generateGraphs.gnu
index 665641d..dd9f137 100644
--- a/cron/generateGraphs.gnu
+++ b/cron/generateGraphs.gnu
@@ -3,7 +3,6 @@
set terminal svg size 1200, 1200
set output '/tmp/covid19graphgenerator-output.svg'
-set pointsize 0.75
load "includes/plotAllGraphs.gnu"
set terminal png size 1600, 1600
diff --git a/cron/includes/plotSingleGraph.gnu b/cron/includes/plotSingleGraph.gnu
index 152fd11..0ddc61b 100644
--- a/cron/includes/plotSingleGraph.gnu
+++ b/cron/includes/plotSingleGraph.gnu
@@ -1,2 +1,11 @@
-set title graphTitle."\n{/*0.4 Última dada (punt negre): ".lastUpdated."}"
-plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", graphDataFile u 2:3 w lp pt 6 lt rgb "black", "< tail -n 1 ".graphDataFile u 2:3 w lp pt 7 lt rgb "black"
+num = system("cat ".graphDataFile." | wc -l")
+
+startGray = 0;
+endGray = 0.5;
+
+set palette model RGB functions startGray + (endGray - startGray)*(1 - gray), startGray + (endGray - startGray)*(1 - gray), startGray + (endGray - startGray)*(1 - gray)
+set cbrange [0:(num - 1)]
+unset colorbox
+
+set title graphTitle."\n{/*0.4 Última dada (punt blau): ".lastUpdated."}"
+plot 6*x w filledcurve y1=0 lt rgb "#ff9494", 100/x w filledcurve y1=0 lt rgb "#ffe494", 70/x w filledcurve y1=0 lt rgb "#dbff94", 30/x w filledcurve y1=0 lt rgb "#a0ff94", graphDataFile u 2:3:4 w lp lc palette pt 2 ps 0.5, "< tail -n 1 ".graphDataFile u 2:3 w lp pt 7 ps 0.7 lt rgb "#002991"