Code: Select all
particulate_plot() {
let particulte_chart = this.sensor_chart.stockChart('particulate_plot', {
chart: {
type: 'line',
animation: true,
backgroundColor: "transparent",
Color: "black"
},
credits: {
enabled: false
},
legend: {
enabled: true,
layout: 'horizontal',
verticalAlign: 'bottom',
floating: false,
},
rangeSelector: {
selected: 1,
inputEnabled: false,
enabled: false
},
// title: {
// text: "Air Quailty",
// style: { "color": "#f4f5f8", "fontSize": "12px" }
// },
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
day: '%e of %b',
},
title: {
text: 'Date',
style: { "color": "#ECEAF9", "fontSize": "12px" }
},
labels: {
style: { "color": "#ECEAF9", "fontSize": "12px" }
}
},
yAxis: {
gridLineColor: '#bfd8dc',
gridLineWidth: 2,
min: 0,
opposite: false,
// title: {
// text: "Mass \xb5g/m\xb3",
// style: { "color": "#010101", "fontSize": "12px" }
// },
// labels: {
// formatter: function () {
// return (this.value.toFixed(2) ? '' : '') + this.value.toFixed(2);
// },
// style: { "color": "#010101", "fontSize": "12px" }
// },
plotLines: [{
label:
{
text: "EU Limit 40 \xb5g/m\xb3",
style: { "color": "#010101", "fontSize": "12px" },
align: 'center',
y: -10,
},
color: 'red', // Color value
value: 3, // Value of where the line will appear
width: 5 // Width of the line
}],
},
navigator: {
enabled: false
},
scrollbar: { enabled: false },
series: [{
//data: this.plotdata,
data:[1,2,3],
//data: this.series[0].data,
zones: [{
value: 30,
color: '#0c8eca'
}, {
value: 60,
color: '#eeb333'
}, {
value: 90,
color: '#f0250a'
}]
}],
"tooltip": {
"pointFormat": "<b>{point.y:.2f}</b>",
"shared": true
},
});
}
Azure_table_qyery_cycle() {
console.log("Azure_table_qyery_cycle()");
this.Azure.HTTP_GET_AZURE_TABLE(this.Azure.node_sensor_selected, this.azureTableQuery)
.subscribe(data => {
data.headers.keys();
console.log("azure tables");
console.log(data.body.value);
console.log(data.headers.headers);
console.log(data.headers.keys());
console.log(data.body.value.length);
this.AzureTableStorageResult.push(...data.body.value);
var test_data=[{ data: [] }, { data: [] }, { data: [] }];
for (var i = 0; i < data.body.value.length; i++) {
var local_time = this.Azure.local_time(moment(data.body.value[i].Timestamp))
var timestampn = moment.utc(local_time).valueOf();
this.PM.push(data.body.value[i].iot_mass_con_b)
this.global_timestamp.push(data.body.value[i].Timestamp)
//console.log(data.body.value[i].Timestamp)
this.series[0].data.push([timestampn,data.body.value[i].iot_mass_con_b]);
test_data[0].data.push([timestampn,data.body.value[i].iot_mass_con_b]);
}
console.log( this.series[0].data)
//const data_Clone = {...this.series[0].data};
//console.log( data_Clone)
//this.plotdata. =data_Clone.reverse();
//this.plotdata = test_data[0].data.reverse();
//console.log(this.plotdata)
this.particulte_chart.HighCharts[0].series[0].setData(test_data[0].data.reverse()).
this.particulate_plot();
console.log("Next Partition Key");
var nextpartitionkey = data.headers.headers.get('x-ms-continuation-nextpartitionkey')[0];
//console.log(nextpartitionkey);
console.log("Next Row Key");
var nextrowkey = data.headers.headers.get('x-ms-continuation-nextrowkey')[0];
//console.log(nextrowkey);
if ((typeof nextrowkey === "undefined") || (typeof nextpartitionkey === "undefined")) {
console.log("No more Query");
}
else {
var query_orginal = "$filter=PartitionKey%20ge%20'" + this.start_month_year + "'%20and%20PartitionKey%20le%20'" + this.current_month_year + "'and(%20iot_mass_con_a%20ge%2000%20or%20iot_num_con_b%20ge%2000)" + this.azureTableSelect;
this.azureTableQuery = query_orginal + "&NextPartitionKey=" + nextpartitionkey + "&NextRowKey=" + nextrowkey
//if (this.tempCount <2)
{
setTimeout(() => { this.Azure_table_qyery_cycle() }, 1);
}
this.tempCount++
}
}, err => {
console.log("ERROR");
console.log(err);
});
}