Page 1 of 1

Graph overlays icons

Posted: Wednesday 06 September 2023 22:44
by janumix
Hi

Since abt. 2 beta versions back, custom graph overlays icons as follows:
Screenshot_20230808_232547.png
Screenshot_20230808_232547.png (67.58 KiB) Viewed 6466 times
Can't find any change in that matter in Release Notes.
The only workaround in to increase height param but then it does not scale to different resolutions as previously it was.

Regards

Re: Graph overlays icons

Posted: Thursday 07 September 2023 8:16
by Lokonli
I included some minor styling changes in a June update. Maybe it has some unexpected side effects.

Can you post the block definition for your graph block?
Do you make use of custom.js? If yes, can you post that as well?

How should it look like? The three domoticz device blocks should be shifted down? Can you post a 'before' picture?

Re: Graph overlays icons

Posted: Thursday 07 September 2023 13:54
by janumix
Sure.

Block definition:

Code: Select all

blocks['Energia_3435'] = {
    title: 'Energia',
    devices: [138,232,135],
    graphTypes: ['v'],
    //ylabels: ['1f','3f','FV'],
    graph: 'line',
    height: 190,
    buttonsSize: 10,
    legend: false,
    axisRight: true,
    datasetColors: ['red','yellow','green']
}


custom.js:

Code: Select all

function getExtendedBlockTypes(blocktypes){
	//blocktypes.Type['Lighting 2'] = { icon: 'fa fa-lightbulb-o', title: '<Name>', value: 'ds' }
	return blocktypes;
} 

function getStatus_57(block, afterupdate){   // oświetlenie garażu
    var idx = block.idx;
    var device = block.device;
	if(parseFloat(device['Data'])>0){
		$('div.block_57').addClass('warning_light');
	}
	else {
		$('div.block_57').removeClass('warning_light');
	}
}

function getStatus_18(block, afterupdate){   // oświetlenie piwnicy
    var idx = block.idx;
    var device = block.device;
	if(parseFloat(device['Data'])>0){
		$('div.block_18').addClass('warning_light');
	}
	else {
		$('div.block_18').removeClass('warning_light');
	}
}

function getStatus_137(block, afterupdate){   // oświetlenie strychu - poddasza
    var idx = block.idx;
    var device = block.device;
	if(parseFloat(device['Data'])>0){
		$('div.block_137').addClass('warning_light');
	}
	else {
		$('div.block_137').removeClass('warning_light');
	}
}

function getStatus_40(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
	if(parseFloat(device['Data'])<210){
		$('div.block_40').addClass('warning_light');
	}
	else {
		$('div.block_40').removeClass('warning_light');
	}
}

function getStatus_45(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
	if(parseFloat(device['Data'])<25){
		$('div.block_45').addClass('warning_light');
	}
	else {
		$('div.block_45').removeClass('warning_light');
	}
}

function getStatus_80(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
        if(device['Data']!="Closed"){
            $('div.block_80').addClass('warning_light'); 
        }
        else {
            $('div.block_80').removeClass('warning_light');
        }
}

function getStatus_7(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
        if(device['Data']!="Closed"){
            $('div.block_7').addClass('warning_light'); 
        }
        else {
            $('div.block_7').removeClass('warning_light');
        }
}

function getStatus_19(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
        if(device['Data']!="Closed"){
            $('div.block_19').addClass('warning_light'); 
        }
        else {
            $('div.block_19').removeClass('warning_light');
        }
}

function getStatus_28(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
        if(device['Data']!="Closed"){
            $('div.block_28').addClass('warning_light'); 
        }
        else {
            $('div.block_28').removeClass('warning_light');
        }
}

function getStatus_46(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
        if(device['Data']!="Off"){
            $('div.block_46').addClass('warning_light'); 
        }
        else {
            $('div.block_46').removeClass('warning_light');
        }
}

function getStatus_83(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
        if(device['Data']!="Closed"){
            $('div.block_83').addClass('warning_light'); 
        }
        else {
            $('div.block_83').removeClass('warning_light');
        }
}

function getStatus_141(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
        if(device['Data']!="Closed"){
            $('div.block_141').addClass('warning_light'); 
        }
        else {
            $('div.block_141').removeClass('warning_light');
        }
}


function getStatus_100(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
        if(parseFloat(device['Data'])<1){
            $('div.block_100').addClass('warning_light'); 
        }
        else {
            $('div.block_100').removeClass('warning_light');
        }
}

function getStatus_101(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
        if(parseFloat(device['Data'])<1){
            $('div.block_101').addClass('warning_light'); 
        }
        else {
            $('div.block_101').removeClass('warning_light');
        }
}
function getStatus_245(block, afterupdate){
    var idx = block.idx;
    var device = block.device;
        if(device['Data']!="Off"){
            $('div.block_245').addClass('warning_light'); 
        }
        else {
            $('div.block_245').removeClass('warning_light');
        }
}


Re: Graph overlays icons

Posted: Thursday 07 September 2023 21:44
by Lokonli
Thanks.

I've made some changes to the height computation of a graph block.

Can you test latest dashticz beta?
Update Dashticz with 'git pull'

Small change: You probably have to increase the height value of your graph block. With the new version, the value of the height parameter sets the height of the complete block, including header with buttons.

Re: Graph overlays icons

Posted: Thursday 07 September 2023 22:49
by janumix
Now it's great !
Thanks a lot.
No need to adjust height.