Convert bar chart to trend/line

Hi everyone.
I have following data:
id version result
1 v.1.1 4
2 v.1.1 2
3 v.1.3 3
4 v.1.2 12
5 v.1.1 13
6 v.1.3. 15
7 v.1.2 12

no time variables. you can see that there are multiple entries for each version.
Grafana performs SQL query to get AVG result per version and graph it as bar chart (with version as X axis)

is there a way to present this data as a line instead bars (trend/ or similar to time series )
thank you

For a trend you need the time, for an xy chart you need two numbers.

You can change the version to a number without the “v” .

But I think, thats not what you want. So I have no ideas.

1 Like

what is your datasource: mysql, mssql?

it’s mysql

you will need to pivot your data so that it appears as follows

Some visualizations

Also the trick is trendline requires the values to be ascending order, yours are not if you view them based on the id column

1 Like

Hello @pyrius if you want to disply version in x-axis in time series there is no way to do that because time series must need time column in this case your bar chat visualization is better approch. but i you want to disply convert the type of version into time using transformations (Convert field type) . that fine it will display the line graph.


OP asked about trendline, which does not require x to be date time

thank you.
Problem is that new entries with new versions will be added with time - so manually add them to the request is not optimal.
also converting version into numbers is tricky.
minor version can be 1 or 2 or 20 or any other number up to 99 - so casting a single number without dot - will give numbers with different interval and graph will have different segment length which is incorrect.
I was thinking into assigning every version number - like id 1,2,3,4
then plot using these numbers as X axis, and on the graph display versions instead of 1,2,3

That was just an example since we don’t have your db, that was just mock data to emulate your datab in ours