Stop overloading the legend by using a whitelist

This commit is contained in:
Danielv123 committed 2017-03-17 16:00:03 +01:00
1 parent 3186fa8fb7
commit 9fe4ebdacd
1 file changed
+4 -4
+4 -4
View File
@@ -1,6 +1,5 @@
// get all slaves recently connected to master // ask master for slaves and render them nicely on a page with production graphs
// ask master for slaves
setTimeout(function() { setTimeout(function() {
var xmlhttp = new XMLHttpRequest(); var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() { xmlhttp.onreadystatechange = function() {
@@ -76,7 +75,6 @@ function post(url, data, callback) {
xhr.open("POST", url, true); xhr.open("POST", url, true);
xhr.setRequestHeader("Content-type", "application/json"); xhr.setRequestHeader("Content-type", "application/json");
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
console.log(xhr.readyState + "WOW")
if (xhr.readyState == 4 && xhr.status == 200) { if (xhr.readyState == 4 && xhr.status == 200) {
var json = JSON.parse(xhr.responseText); var json = JSON.parse(xhr.responseText);
callback(json); callback(json);
@@ -106,7 +104,9 @@ function generateLineChartArray(data, nameKey) {
let xyz = {}; let xyz = {};
xyz.name = nameKey; xyz.name = nameKey;
xyz.type = "line"; xyz.type = "line";
xyz.showInLegend = true; if(nameKey == "copper-wire"||nameKey == "iron-plate"||nameKey == "copper-plate"||nameKey == "electronic-circuit"||nameKey == "steel-plate"||nameKey == "advanced-circuit"||nameKey == "crude-oil"||nameKey == "petroleum-gas"){
xyz.showInLegend = true;
}
xyz.dataPoints = chartData; xyz.dataPoints = chartData;
return xyz; return xyz;
} }