Dashticz / dashticz_v2

Alternative dashboard for Domoticz
107 stars 62 forks source link

Don't apply width for popup graphs #458

Closed aalwash closed 5 years ago

aalwash commented 5 years ago

In extension of this PR https://github.com/Dashticz/dashticz_v2/pull/443

This also fixes https://github.com/Dashticz/dashticz_v2/issues/424 The graph configuration also applies for popups (except for width)

aalwash commented 5 years ago

@paalkr I checked the code, the graphTypes already applies for popup graphs

This PR only fixes that the width in the configuration doesn't apply for the graph popup

paalkr commented 5 years ago

@aalwash , how is the graphTypes applied to a popup graph? I have not succeeded achieving this.

aalwash commented 5 years ago

Can you show me your config? It should work like mentioned in #443 So:

blocks['graph_idx'] = {
    title: 'Outside (temperature only)',
    width: 6,
    graphTypes: ['te']
};

The graphType applies for normal graphs, but also works for popup graphs

paalkr commented 5 years ago

Well, the thing is that when I use this config

blocks['graph_567'] = {
    title: 'Utetemperatur',
    width: 6,
    graphTypes: ['te'],
    hide_title: true,
    last_update: true
};
columns['Main_c_3']['blocks'] = [
                                'graph_567',568,
                                569,
                                '567_2','572_3'
                                ];  

I get this correct result image

But I would like to have this as a button like this image Which I can get by adding this config

blocks['567_1'] = {
    title: 'Utetemperatur',
    width: 6,
    graphTypes: ['te'],
    hide_title: true,
    last_update: true
};
columns['Main_c_3']['blocks'] = [
                                '567_1',568,
                                569,
                                '567_2','572_3'
                                ];

And when I click that button, this popup is displayed, with both temperature (green line) and humidity (red line) added. image

paalkr commented 5 years ago

I think also one of the problems is that you can use a different notations for blocks when you refer them in a column (idx, 'graph_idx', 'idx_1','idx_n'), even if you just defined the block as. blocks[idx]

If I use this config I actually get what I want, except clicking the 567_2 block (humidity), actually brings up the same temperature graph as clicking the 567_1 block.

blocks['567_1'] = {
    title: 'Utetemperatur',
    width: 6,
    hide_title: true,
    last_update: true
};
blocks['graph_567'] = {
    title: 'Utetemperatur',
    width: 6,
    graphTypes: ['te'],
    hide_title: true,
    last_update: true
};
blocks['567_2'] = {
    title: 'Luftfuktighet',
    width: 6,
    last_update: true
};
columns['Main_c_3'] = {
    width: 4,
    blocks: ['567_1','567_2']
};

What I actually would like to do, is to use this notation and still get subtype filters applied to the graph popups. The value and title on the blocks does honor this configuration. image

blocks['567_1'] = {
    title: 'Utetemperatur',
    width: 6,
    hide_title: true,
    last_update: true
};
blocks['567_2'] = {
    title: 'Luftfuktighet',
    width: 6,
    last_update: true
};
columns['Main_c_3'] = {
    width: 4,
    blocks: ['567_1','567_2]
};

And to make it even more confusing, you could actually do something like this, which is also a valid config. But title make less sense, hide_tile is not honored and graphTypes is not honored (which wouldn't have made any sense anyway in this config).

blocks[567] = {
    title: 'Utetemperatur',
    width: 6,
    graphTypes: ['te'],
    hide_title: true,
    last_update: true
};
columns['Main_c_3'] = {
    width: 4,
    blocks: ['567_1','567_2']
};

And even this is a valid config, graphTypes is not honored. Which would make less sense for the 567_2 block in the column def.

blocks[567] = {
    title: 'Utetemperatur',
    width: 6,
    graphTypes: ['te'],
    hide_title: true,
    last_update: true
};
columns['Main_c_3'] = {
    width: 4,
    blocks: ['graph_567','567_2']
};

This config will not work for the 567_2 block added to the column. The graph_567 block will be rendered correctly, honoring the graphTypes (only temperature plots are added to the graph).

blocks['graph_567'] = {
    title: 'Utetemperatur',
    width: 6,
    graphTypes: ['te'],
    hide_title: true,
    last_update: true
};
columns['Main_c_3'] = {
    width: 4,
    blocks: ['graph_567','567_2']
};

So to say it mildly. This is not user friendly, consistent nor clever designed. Maintaining and understanding the source code becomes hard for anybody but the author - maybe.

aalwash commented 5 years ago

So to say it mildly. This is not user friendly, consistent nor clever designed. Maintaining and understanding the source code becomes hard for anybody but the author - maybe.

I totally agree, I did some digging in the code, it isn't easy to fix this problem :( Unfortunately poorly designed code

It needs more research to understand how this code works...