Тёмный

Grafana - Bar Chart with Multiple Series | How To Tutorial Example 

CodeCowboyOrg
Подписаться 13 тыс.
Просмотров 38 тыс.
50% 1

How to Create a Grafana Bar Chart with Multiple Series Example using SQL Server Database. The Database used here is AdventureWorks downloadable here
docs.microsoft.com/en-us/sql/...
SELECT TOP 10 * FROM Sales.SalesOrderDetail
SELECT
DATEPART(Year, ModifiedDate) AS [Year],
DATEPART(Month, ModifiedDate) AS [Month],
COUNT(ModifiedDate) AS Total
FROM Sales.SalesOrderDetail
GROUP BY DATEPART(Year, ModifiedDate) , DATEPART(Month, ModifiedDate)
ORDER BY DATEPART(Year, ModifiedDate) ASC , DATEPART(Month, ModifiedDate) ASC
SELECT [Month] AS [Month],[2011], [2012], [2013], [2014]
FROM
(
SELECT
DATEPART(Year, ModifiedDate) AS [Year],
STR(DATEPART(Month, ModifiedDate)) AS [Month]
FROM Sales.SalesOrderDetail a
) AS SourceTable
PIVOT
(
COUNT(Year)
FOR [Year] IN ([2011], [2012], [2013], [2014])
) AS PivotTable
ORDER BY Month

Наука

Опубликовано:

 

14 янв 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 12   
@GereHadush
@GereHadush 17 дней назад
It is very helpful. They need to add this to the help page.
@vhschalk
@vhschalk Год назад
A Grafana transform did not quite do the job for me, but creating the pivot in SQL made all the difference. Thanks for the tip!
@rossivan75
@rossivan75 2 года назад
Awesome work!
@PedruU0
@PedruU0 Год назад
Thank you so much!
@QuinnFavo
@QuinnFavo Год назад
thanks for this
@romanbatrak3763
@romanbatrak3763 Год назад
is there a way to do the same with prometheus as a datasource ? I mean using not mysql query but PROMQL.
@kevinalfredolinerosoto624
@kevinalfredolinerosoto624 Год назад
Cómo puedo hacer una línea horizontal en este tipo de gráficas ?
@bitraw4370
@bitraw4370 Год назад
which version of grafana this is I'm on 7.x and I do not see the Bar char or time series.. now there is "Graph" by using that I could not get to work... my sql output below I want this to come as stacked on x axis of day .. am I missing something day,zone1,zone2 5, 6, 18
@suikast420
@suikast420 Год назад
That should works with grafana 8+
@user-cr3jv8se1u
@user-cr3jv8se1u 6 месяцев назад
Would this still work with 9.2.3? On mine, I have to take the month field and do month as time. Then I get a strange timestamp, not 1 2 3 4 5 as in your example. Maybe your version was a bit more tolerant with x-axis values?
@user-cr3jv8se1u
@user-cr3jv8se1u 6 месяцев назад
Grafana doc sez: Only one data frame is supported and it must have at least one string field that will be used as the category for an X or Y axis and one or more numerical fields. Seems to no longer be true.
@krisztianfekete3277
@krisztianfekete3277 Месяц назад
0:21 🎯🎯 🤣🤣
Далее
SQL Tutorial for Beginners
44:57
Просмотров 2 млн
How To Build a Time-Series Graph in Grafana
7:55
Просмотров 33 тыс.
How To Setup A Grafana Dashboard Step By Step
21:00
Просмотров 435 тыс.
Grafana : Dashboard Variables
15:40
Просмотров 56 тыс.
Grafana : Visualizing Non Time Series Data
6:16
Просмотров 14 тыс.