graphData(){ let columns = []; columns.push([" x",... this.sensorData.map(t => Date.parse(t.messageTimeStamp))]); columns.push([" Temperature",... this.sensorData.map(t => t.temperature)]); // columns.push([" Class",... this.sensorData.map(t => t.temperature)]);
this.temperatureAlarms.forEach(currentItem => {
this.alarmMinName = `${currentItem.alarmName} Min`;
this.alarmMaxName = `${currentItem.alarmName} Max`;
columns.push([this.alarmMinName, ...this.sensorData.map(() => currentItem.minVal)])
columns.push([this.alarmMaxName, ...this.sensorData.map(() => currentItem.maxVal)])
});
// console.log(this.MinName,"this.MinName")
console.log('columns: ', columns);
console.log('new columns', ...columns);
let coc = [];
this.custodyChanges.forEach(currentItem => {
// console.log(currentItem);
coc.push({ value: Date.parse(currentItem.timestamp), text: currentItem.id, class: 'coc' })
});
let geo = [];
this.geozones.forEach(currentItem => {
geo.push({ value: Date.parse(currentItem.timestamp), text: currentItem.id, class: 'geofence' })
});
var ngChart = bb.generate({
bindto: this.chart,
data: {
"x": "x",
columns: [
...columns
],
types: {
data1: "line",
COC: "bar",
maxName: "bar",
minName: "step",
Temperature: "area"
},
// colors: {
// Temperature:"green",
// } ,
color: function (color, d) {
// console.log("devalue", d)
// console.log("akshay", d.indexOf('Yellow'))
debugger
if (typeof d === "string") {
console.log("devalue inside", d)
if (d.indexOf('Yellow') == -1) {
return color = "red";
} else {
return color = "yellow";
}
}
return color="green";
},