Multi line value graph - Postgres data source

Hi,

I am building a graph which should represent multi line values for time series. Below is the example of data-set.

The multi line graph should looks like below. Also, there should be an option to select/unselect required values (PRD/STG/QAS…) and graph should reflect values accordingly.

image

So far i was able to manage to display only one values.

Grafana v5.1.3 Docker installation.

Any suggestion how to achieve this?

@rags007 What datatype is your time column?

prd,stg,qas, sit and tis are having varchar datatype columns

@rags007 value columns need to be a numerical datatype.

If your time Column is a postgres time datatype the following should work:

SELECT time, prd::float, stg::float, qas::float, sit::float, tis::float FROM your_table;

Thanks for suggestion. I tried your suggestion, but the graph is not presenting multi lines in graph like below each line represents one column.

image

I am missing anything in the Axis and Display settings for the graph panel

Any input or is this a limitations in Grafana for Postgres data source?

Hola, it is hard to say without knowing how your data is structured, but it could be that you need to rework your query so that the results are formatted more like this using group by or something:

time | metric | value
-----|--------|------
17-03| qas |13.86
17-03| prd |6.97
etc

Or maybe you could use one separate query for each of the five columns (qas,prd,etc.) in your example.

Data’s are structured in postgres database. We have individual columns for prd, stg, qas, sit, and tis values and also have time column. The end goal is to represent the one graph where in X-Axis will be time series and Y-Axis will be numeric values. Then values from prd, stg, qas, sit, and tis values are represented in this graph with individual line values.