I am very new to Grafana, I have created a chart with one data source and the legend is shown correctly.
I then created another chart with 2 data sources and now the legend shows … Electric Electric … it should only show Electric once. It may be my query is wrong or is there something in Grafana I need to change ?
OR it maybe I use 2 separate queries for the graph, like this …
select json_extract( value, ‘$.Gas_reading’ ) as Gas, json_extract( value, ‘$.iso’) as time from DATABASE, json_tree( DATABASE.data, ‘$.IP15’ ) where type = ‘object’ and json_extract( value, ‘$.Gas_reading’ );
select json_extract( value, ‘$.Electricity_reading’ ) as Electicity, json_extract( value, ‘$.iso’) as time from DATABASE, json_tree( DATABASE.data, ‘$.IP22’ ) where type = ‘object’ and json_extract( value, ‘$.Electricity_reading’ );
Ithink they should be one query, but how ?
Try to Change it from Tables to Time Series
It is already set to Time series.
I am using a JSON SQlite databse and I do not seem to have your choices of queries shown above or do i need to add or change something ?
Where is it set as such? Let me try to spin up a sqllite db locally and test it
Which SQLLite plugin are you using?
Maybe you can use transform tab to change it into a time series ?
while I get that spun up, what happens if you removed the alias
also what version of grafana are you on?
If this helps …
My Database setup
and the objects that are in the above Database DATA table.
you want me to retype all of that
Please post as text and not as an image?
ha ha yes i did think of that just now … here you are
and the other
I have just found this … follow the link
Additionally I just noticed that this behaviour only happens while I have two query running for the same plot. If I remove one of them I goes back to the desired behaviour.
Can it be connected to the fact that both columns are called “value”? But then I would assume something like “alias1 alias2” to happen. I’m confused.
The reply is from the man that wrote the addon.
I cannot find the … Grafana visualization configuration.
Where would that be ?
sorry got stuck in python trying to import your data
Thanks for your help I finally found out what the problem was you have to change …
then you get
Easy when you find the answer
anyway thanks for your help and have a great day
that sounds hard to maintain if a new reading type comes in. this should be done dynamically
using Merge I get the following
without merge (double vision)
and it makes sense cause without merge you have 2 frames of data. So it is being helpful to differentiate one from the other.
Also I would go for 1 query approach with maybe a pivot.
You shouldn’t have to add an “override” but just use the regular “display name” setting.
This works pretty well in my opinion.
Version 3.1.1 of the plugin will have a bit better naming here but the core issue of more information added to the legend is due to Grafana (especially if using multiple lines in a chart).
Some more information can also be found here:
Legend appears twice · Issue #96 · fr-ser/grafana-sqlite-datasource · GitHub