Problems with graph

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
darrepac
Posts: 133
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Problems with graph

Post by darrepac »

Hello

I have 2 graphs and 2 problems :roll:
I am fighting since several hours without success...
2021-11-15 15_21_45-WhatsApp.png
2021-11-15 15_21_45-WhatsApp.png (333.25 KiB) Viewed 575 times
For the graph on the left, I don't understand why I don't have the legend at the bottom.
See my code:

Code: Select all

//Graph Temp
blocks ['Graph Temp'] = {
	title: 'Températures',
        devices: [37, 81, 41, 38],
	graphTypes: ['te'],
	width: 12,
        graph: ['line', 'line', 'line', 'line'],
        custom: {
        "Dernières heures": {
                range: 'last hours',
                data: {
                        Maison: 'd.te_37',
                        Moyenne: 'd.te_81',
			AirPulsé: 'd.te_41',
			Extèrieur: 'd.te_38',
                }
            },
        "Dernières 24h":{
                range: 'day',
                 data: {
                        Maison: 'd.te_37',
                        Moyenne: 'd.te_81',
                        AirPulsé: 'd.te_41',
                        Extèrieur: 'd.te_38',

                }

            },
        "Mois":{
                range: 'month',
                 data: {
                        Maison: 'd.te_37',
                        Moyenne: 'd.te_81',
                        AirPulsé: 'd.te_41',
                        Extèrieur: 'd.te_38',

                }

            },
	legend: {
		'te_37': 'Maison',
		'te_81': 'Moyenne',
		'te_41': 'Air Pulsé',
		'te_38': 'Extèrieur' 
	  }

        }
}
On the right, the graph simply disappear when I introduced the one on the left :!: :?:

Code: Select all

//Graph Elec
blocks ['Graph Elec'] = {
	title: 'Consommation',
	devices: [34, 157],
	graph: ['bar', 'bar', 'bar'],
	legend: true,
	width: 12,
	custom: {
	"Dernières heures": {
		range: 'last hours',
		data: {
			Linky: 'd.v_34',
			Solaire: 'd.v_157',
		},
	    },
	"Dernières 24h":{
		range: 'day',
		 data: {
                        Linky: 'd.v_34',
                        Solaire: 'd.v_157',
                },

	    },
        "Mois":{
                range: 'month',
                 data: {
                        Linky: 'd.v_34',
                        Solaire: 'd.v_157',
                },

            },

	},
}
Attachments
2021-11-15 15_16_44-WhatsApp.png
2021-11-15 15_16_44-WhatsApp.png (94.93 KiB) Viewed 575 times
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problems with graph

Post by Lokonli »

darrepac wrote: Monday 15 November 2021 15:24 Hello

I have 2 graphs and 2 problems :roll:
I am fighting since several hours without success...

2021-11-15 15_21_45-WhatsApp.png
For the graph on the left, I don't understand why I don't have the legend at the bottom.
See my code:

Code: Select all

//Graph Temp
blocks ['Graph Temp'] = {
	title: 'Températures',
        devices: [37, 81, 41, 38],
	graphTypes: ['te'],
	width: 12,
        graph: ['line', 'line', 'line', 'line'],
        custom: {
        "Dernières heures": {
                range: 'last hours',
                data: {
                        Maison: 'd.te_37',
                        Moyenne: 'd.te_81',
			AirPulsé: 'd.te_41',
			Extèrieur: 'd.te_38',
                }
            },
        "Dernières 24h":{
                range: 'day',
                 data: {
                        Maison: 'd.te_37',
                        Moyenne: 'd.te_81',
                        AirPulsé: 'd.te_41',
                        Extèrieur: 'd.te_38',

                }

            },
        "Mois":{
                range: 'month',
                 data: {
                        Maison: 'd.te_37',
                        Moyenne: 'd.te_81',
                        AirPulsé: 'd.te_41',
                        Extèrieur: 'd.te_38',

                }

            },
	legend: {
		'te_37': 'Maison',
		'te_81': 'Moyenne',
		'te_41': 'Air Pulsé',
		'te_38': 'Extèrieur' 
	  }

        }
}
On the right, the graph simply disappear when I introduced the one on the left :!: :?:

Code: Select all

//Graph Elec
blocks ['Graph Elec'] = {
	title: 'Consommation',
	devices: [34, 157],
	graph: ['bar', 'bar', 'bar'],
	legend: true,
	width: 12,
	custom: {
	"Dernières heures": {
		range: 'last hours',
		data: {
			Linky: 'd.v_34',
			Solaire: 'd.v_157',
		},
	    },
	"Dernières 24h":{
		range: 'day',
		 data: {
                        Linky: 'd.v_34',
                        Solaire: 'd.v_157',
                },

	    },
        "Mois":{
                range: 'month',
                 data: {
                        Linky: 'd.v_34',
                        Solaire: 'd.v_157',
                },

            },

	},
}
For the first one:
the legend is defined on the wrong position. It's now defined as a data series.
Further, don't define a legend for custom graphs. If you want to show the legend, just add legend:true.

Try the following:

Code: Select all

//Graph Temp
blocks ['Graph Temp'] = {
	title: 'Températures',
        devices: [37, 81, 41, 38],
	graphTypes: ['te'],
	width: 12,
        graph: ['line', 'line', 'line', 'line'],
        custom: {
        "Dernières heures": {
                range: 'last hours',
                data: {
                        Maison: 'd.te_37',
                        Moyenne: 'd.te_81',
			AirPulsé: 'd.te_41',
			Extèrieur: 'd.te_38',
                }
            },
        "Dernières 24h":{
                range: 'day',
                 data: {
                        Maison: 'd.te_37',
                        Moyenne: 'd.te_81',
                        AirPulsé: 'd.te_41',
                        Extèrieur: 'd.te_38',

                }

            },
        "Mois":{
                range: 'month',
                 data: {
                        Maison: 'd.te_37',
                        Moyenne: 'd.te_81',
                        AirPulsé: 'd.te_41',
                        Extèrieur: 'd.te_38',

                }

            }

        },
	legend: true

}
darrepac
Posts: 133
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Problems with graph

Post by darrepac »

ok thanks, the problem for the left graph is solved!
The problem for the left, remain
TapNL
Posts: 30
Joined: Monday 24 April 2017 21:52
Target OS: -
Domoticz version:
Contact:

Re: Problems with graph

Post by TapNL »

@darepac.

I really like your icons, can you point me in a direction where I can find them and install them?

Thx in advance.
darrepac
Posts: 133
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Problems with graph

Post by darrepac »

TapNL wrote: Monday 15 November 2021 18:55 @darepac.

I really like your icons, can you point me in a direction where I can find them and install them?

Thx in advance.
Which icons? I am using standard dial feature
TapNL
Posts: 30
Joined: Monday 24 April 2017 21:52
Target OS: -
Domoticz version:
Contact:

Re: Problems with graph

Post by TapNL »

I was not aware of the dial feature.
Did not update layout of my dashboard for a while. Will have a look at it. Thx!
darrepac
Posts: 133
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Problems with graph

Post by darrepac »

@lonkoli I still cannot make the graph on the right to work... in the console, I have the following:

Code: Select all

bundle.js?t=18:309 jQuery.Deferred exception: Cannot set properties of undefined (setting 'type') TypeError: Cannot set properties of undefined (setting 'type')
    at js/components/graph.js:809:49
    at Array.forEach (<anonymous>)
    at createGraph (js/components/graph.js:808:25)
    at Array.<anonymous> (js/components/graph.js:381:5)
    at mightThrow (http://192.168.0.61:8082/dist/bundle.js?t=18:309:28164)
    at R (http://192.168.0.61:8082/dist/bundle.js?t=18:309:28545) undefined
darrepac
Posts: 133
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Problems with graph

Post by darrepac »

Found it , it was this line:

Code: Select all

graph: ['bar', 'bar', 'bar'],
should be

Code: Select all

graph: ['bar', 'bar'],
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problems with graph

Post by Lokonli »

darrepac wrote: Thursday 18 November 2021 11:39 Found it , it was this line:

Code: Select all

graph: ['bar', 'bar', 'bar'],
should be

Code: Select all

graph: ['bar', 'bar'],
ah, good that you found that one. The error checking within Dashticz is indeed pretty limited...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest