Page 1 of 1

Use of variables

Posted: Friday 24 April 2020 21:40
by Ewaldharmsen
Maybe I missed it, but what I find quite usefull is the use of variables in my config:

Code: Select all

//IDX List
Weerstation 		= 5;
Screen			= 8;
Slaapkamer	 	= 32;
Rain				= 34;

//Definition of blocks
blocks = {}
blocks[Weerstation] = {
  width: 6
}

blocks['temperature'] = {
	title: 'Temperature',
	devices: [Slaapkamer,Weerstation],
	graphTypes : ['te'],
	spanGaps: false,
	maxTicksLimit: 10,
	legend: {
        	['te_'+Weerstation]: 'Outside',
		['te_'+Slaapkamer]: 'Inside'
        },
	customHeader: {
		[Weerstation]: 'data.split(",").slice(0,1)',                      
		[Slaapkamer]: 'data.split(",").slice(0,1)',               
		x:  '(data.'+Weerstation+'-data.'+Slaapkamer+').toFixed(2) + " °C"',
	},
	height : '300px'
}

//Definition of columns
columns = {}
columns[1] = {
	width: 4,
	blocks : [Screen,Rain,'temperature'],
}