rearrangeData(){
this.tabs.forEach((tab,index) => {
console.log(tab.name+" --> "+tab.no);
// this.data_array[index] = this.data_array[tab.no];
if(this.data_array[index] == undefined || this.data_array[index].data.length == 0){
this.noData[index] = true;
}
else{
this.noData[index]=false;
this.series[index] = []
this.data_array[index].data.forEach((data,index2) => {
this.series[index][index2] = {
dataSource: data.values,
fill: this.series_color[index2],
width:2,
opacity: 1,
type: 'Line',
xName: 'x',
yName: 'y',
name: data.name,
legendShape: 'Circle'
}
});
}
});
let name = this.tabs[this.selectedTab].name;
console.log(this.data_array)
console.log(this.selectedTab)
if(this.data_array.length>0 && this.data_array[this.selectedTab]!=undefined){
let unit = this.data_array[this.selectedTab].unit;
this.chartTooltip = {
headerText: '',
enable: true,
header: '',
textStyle: {
color: 'black'
},
fill: 'white',
opacity: 10,
border: {
width: 1,
color: 'grey'
},
fadeOutDuration: 100,
shared: true,
format: '${series.name} : ${point.x} : <b>${point.y} '+unit+'</b>'
};
if(unit!=undefined){
this.primaryYAxis.title = name +' ( '+unit+' )'
this.chartTooltip.format = '${series.name} : ${point.x} : <b>${point.y} '+unit+'</b>'
}
else{
this.primaryYAxis.title = name
this.chartTooltip.format = '${series.name} : ${point.x} : <b>${point.y}</b>'
}
}
// Set minimum to first value received in response
if(this.non_zero_axis.indexOf(name) != -1){
if(this.data_array[this.selectedTab].data != undefined && this.data_array[this.selectedTab].data[0] != undefined
&& this.data_array[this.selectedTab].data[0].values != undefined && this.data_array[this.selectedTab].data[0].values.length != 0)
this.primaryYAxis.minimum = parseFloat(this.data_array[this.selectedTab].data[0].values[0].y)
//console.log(this.data_array[this.selectedTab].data[0].values[0].y)
}
else if(this.zero_axis.indexOf(name) != -1){
this.primaryYAxis.minimum = 0
}
}