Grafana refuses to plot some variables

  • grafana 5-latest, ubuntu 21.10, self hosted

  • What are you trying to achieve?
    I want to have a line plot for each day of the number of new cases, hospitalizations and deaths due to covid-19.

  • How are you trying to achieve it?
    I have downloaded the covid-19 figures of out world in data. From that I created a postgres database with a little over 161,000 rows and about 67 variables. There are observations for each day of several variables for most countries. Currently I try to plot the figures for the Netherlands (iso_code=‘NLD’).

This works for SELECT date as “time”, new_cases but not for when I replace new_cases by new_cases_per_million.

  • What happened?
    When I select the column new_cases_per_million the selection “jumps back” to new_cases, the graph does not change. The user interface refuses to select the column. This happens to a lot of variables. In postgres this column contains values, a number of each day. When I try to force a graph of new_cases_per_million by editing the SQL like:

  date AS "time",
FROM dapp_dataobservation
  iso_code = 'NLD'

Still no graph is shown and when I switch back to the query builder it shows new_cases again.

  • What did you expect to happen?
    When I select new_cases_per_million I expect to see variable new_cases_per_millon in the SELECT section of the query builder and a graph that show the numbers.

  • Can you copy/paste the configuration(s) that you are having problems with?
    I am prepared to do that but couldn’t find information how to do that.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    /var/log/grafana/grafana.log showed some initial errors of the moment I provided the wrong credentials to the postgres source. After correcting this there are no errors to be found.

  • Did you follow any online instructions? If so, what is the URL?

What datatype has new_cases_per_million column in the DB?

Data type is ‘Double precision’.

Some values in the database are NULL, which translate to NaN in python floating point variables. It appears that Grafana can’t handle this type of value. When I convert NaN to zero, I get results.

@rnoldr I’m glad to see you found a solution/workaround. Out of curiosity, are you actually running Grafana version 5 as stated in your initial post? That’s a few years old now, and IIRC an early version of Postgres support had just been introduced then. You’d be much better off using a more recent version, especially for Postgres data.