Fix server crash with empty data when plotting a chart using gnuplot.
This commit is contained in:
parent
04a8bac338
commit
03125d8b47
1 changed files with 1 additions and 0 deletions
|
@ -26,6 +26,7 @@ function plot(data) {
|
||||||
Object.keys(data).sort().forEach(function (key) {
|
Object.keys(data).sort().forEach(function (key) {
|
||||||
dataToFeed.push(dataToFeed.length + " \"" + key.replace(/"/g, "'") + "\" " + parseFloat(data[key]));
|
dataToFeed.push(dataToFeed.length + " \"" + key.replace(/"/g, "'") + "\" " + parseFloat(data[key]));
|
||||||
});
|
});
|
||||||
|
if (dataToFeed.length == 0) dataToFeed.push("0 \"\" 0");
|
||||||
var gnuplotObject = gnuplot().set("terminal png size 800,480").set("tics font \"Poppins,12\"").set("xtics rotate by 45 right").set("boxwidth 0.6").set("style fill solid").set("yrange [0:*]").set("grid ytics mytics").set("grid").plot("'-' using 1:3:xtic(2) notitle lc rgb \"#007000\" with boxes");
|
var gnuplotObject = gnuplot().set("terminal png size 800,480").set("tics font \"Poppins,12\"").set("xtics rotate by 45 right").set("boxwidth 0.6").set("style fill solid").set("yrange [0:*]").set("grid ytics mytics").set("grid").plot("'-' using 1:3:xtic(2) notitle lc rgb \"#007000\" with boxes");
|
||||||
gnuplotObject.end(dataToFeed.join("\n"));
|
gnuplotObject.end(dataToFeed.join("\n"));
|
||||||
return gnuplotObject;
|
return gnuplotObject;
|
||||||
|
|
Loading…
Reference in a new issue