I have chunks of data for each build that I want to visualize with Grafana X-Y chart. Let's say (simplified):
kpi | average_time | build_id |
---|---|---|
Start App | 150 | 870 |
Stop App | 890 | 870 |
kpi | average_time | build_id |
---|---|---|
Start App | 140 | 871 |
Stop App | 860 | 871 |
I used PostgreSQL to show lines for each kpi
with build_id
as X and average_time
as Y
SELECT DISTINCT ON (kpi, build_id)
build_id AS BUILD_ID,
average_time AS AVERAGE_TIME
FROM <MY_TABLE> WHERE kpi IN (${kpi});
...and $kpi
is a multi-value variable simply returned by SELECT kpi FROM <MY_TABLE>;
When I try to select Start App
as single $kpi
value it looks OK
but if to select both $kpi
values it looks like two lines (that's what I want) but connected with each other (that's not what I want) with extra line
So how to display separate lines for each kpi
(with possibility to set a color for each)?
There is no easy way to do what you described, but it is possible.
To show charts in different ways, you'll need to present values to panel as they are different series. It is possible to do in three major ways:
kpi
independently. I believe it is worst case, as you'll need to a separate query, and link every dataset into panel. I will not describe it in detail as it's fairly clear on its own.kpi
. As a result data will be split into separate series.build_id
. The rest will be selected automatically.Both ways you result for supplied example data would look something like this: