Grafana - Show NON DataTime Date/Time field on X axis - datetime

Grafana 6.x/7.x versions, especially version 7.x
If I have the following data in an Elasticsearch Index (<--Grafana: which it refers) or flat file (csv)
Sprint Velocity: 10 20 15 35 22
--------------------------------------
Sprint Name: S1 S2 S3 S4 S5
Sprint Number: 1 2 3 4 5
Then, in Grafana, is it possible to show Velocity field on Y axis and either Sprint Name/Number on X axis (which are non-date-time based fields).
In ELK (Kibana GUI), I have a visualization which points to an Elasticsearch Index via Index-Pattern (for the above data) and I can easily render/show a LINE visualization having X axis (Terms: using Sprint Name or Sprint Number).
I'm trying to achieve the same in Grafana but having hard time.
https://grafana.com/grafana/plugins/natel-plotly-panel didn't help either as it's supported only up to version Grafana 6.
Also, if I use the "series" option, it doesn't allow the points to be connected in the graph since Grafana thinks they all separate series. For ex: If I use this approach: https://github.com/gipong/grafana-groupedbarchart-panel I can't get one metric (Velocity) on Y axis as LINE chart and another metric (TotalSprintPoints) on Y axis as a BAR chart.

#AKS your example is really information did you tired with line chart ? I can follow your steps for bar chart etc when I move to line its not working. Also I like to show 4 different line in the chart but I am getting only one.

In Grafana, there are few possibilities (but it requires some leg work). A user can use MySQL (as the data source) to visualize non-time series data on X axis. One can use PostgreSQL as well. For more info, read the blog below. Thanks for Sean Bradley.
https://medium.com/grafana-tutorials/graphing-non-time-series-sql-data-in-grafana-8a0ea8c55ee3
Grafana can graph Time Series data from many different types of data sources extremely well. But sometimes you just want to graph, simple non time series data. i.e. Data without timestamps, flat tables with regularly updated statistics or just simple lookup tables.
Example Non Time Series data as a flat table.
And you want to see this simple data, as graphs similar to below.
Grafana needs Time Series data to create graphs, so this is not immediately possible from Non Time Series data, but there is a way, and it's shown below, how you can do it.
To test this yourself, you should have a MySQL database and create a Data Source connection to it in Grafana. If you don’t have a MySQL database, but you do have a Grafana Server, then you can follow the instructions at https://sbcode.net/grafana/create-mysql-data-source/ to quickly install yourself a MySQL server and configure a MySQL data source inside Grafana.
Now to organize a simple flat table with some non time series data it.
On my MySQL server, we can have a schema named exampledb. In it let's create a table called flat_table_example
Open a MySQL prompt on your server, and create a table with this script
CREATE TABLE `exampledb`.`flat_table_example` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(45) DEFAULT NULL,
`total` decimal(10,0) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
Now, let's insert some data:
INSERT INTO `exampledb`.`flat_table_example`
(`username`,
`total`)
VALUES
('Cat',56),
('Dog',5),
('Lizard',4),
('Crocodile',2),
('Koala',50),
('Cassowary',2),
('Peacock',1),
('Emu',1),
('Kangaroo',1);
To check if the data exists, run the following:
SELECT * FROM ``exampledb`.`flat_table_example`;
**Now**, Open up your **Grafana UI**, **ensure** your **MySQL Data Source** has been **configured and connects**, then go to the Explore Tab.
Choose your MySQL data source, press the Edit SQL button
Replace the default SQL with this below,
SELECT username AS metric, total as value FROM flat_table_example ORDER BY id
And select Format As = Table to see your data as a table inside Grafana.
Now, this data is not Time Series data, it has no timestamp columns, so Grafana will not know how to graph it. So here is the trick,
Modify the SQL statement to be,
SELECT NOW() AS "time", username AS metric, total as value FROM flat_table_example ORDER BY id
And now the data has been converted to Time Series. Now, all rows have time stamps, are identical and update to show now every time the query is executed. You may think this is wrong, but it’s not, it’s perfect.
Grafana can now graph this data as a pretty graph.
Leave the Explore page now, go to Manage Dashboards, create a New Dashboard and Add Query
Select your MySQL data source, press the Edit SQL button just like before, paste the new SQL script into the text area. But this time, leave Format As = Time Series instead of Table
Now go to visualisation, select Bar Gauge. Straight away, you have this below.
You can select Orientation = Horizontal, and Field Unit = Percent (0-100)
You can select the basic Gauge visualisation to get this result below, and add yourself an extra Threshold
And even select the default Graph visualisation, but ensure you also select X-Axis Mode = Series
Video Tutorial
To see this video tutorial on Viewing Non Time Series Data in Grafana then visit,
https://youtu.be/Q6aw9oInsyw
Special Thanks to Sean B.
One other way is mentioned here for grouped charts:
https://github.com/gipong/grafana-groupedbarchart-panel

Related

Do I need to create all nodes by hand in Neo4j?

I am probably missing something because I am very new to Neo4j, but looking at their Movie graph - probably the very first graph to play with when you are learning the platform - they give us a really big piece of code where every node and labels and properties are imputed by hand, one after the other. Ok, it seems fair to a small graph for learning purpose. But, how should I proceed when I want to import a CSV and create a graph from this data? I believe a hand-imput is not expected at all.
My data look something like this:
date
origin
destiny
value
type
balance
01-05-2021
A
B
500
transf
2500
It has more than 10 thousand rows like this.
I loaded it as:
LOAD CSV FROM "file:///MyData.csv" AS data
RETURN data;
and it worked. The data was loaded etc. But now I have some questions:
1- How do I proceeed if I want origin to be a node and destiny to be another node with type to be edges with value as property? I mean, I know how to create it like (a)->[]->(b) but how to create the entire graph without creating edge by edge, node by node, property by property etc...?
2- Am I able to select the date and see something like a time evolution for this graph? I want to see all transactions in 20-05-2021, 01-05-2021 etc and see how it evolves. Is it possible?
As example in the official docs says here: https://neo4j.com/docs/operations-manual/current/tutorial/neo4j-admin-import/#tutorial-neo4j-admin-import
You may want to create 3 separate files for the import:
First: you need the movies.csv to import nodes with label :Movie
movieId:ID,title,year:int,:LABEL
tt0133093,"The Matrix",1999,Movie
tt0234215,"The Matrix Reloaded",2003,Movie;Sequel
tt0242653,"The Matrix Revolutions",2003,Movie;Sequel
Second: you need actors.csv to import nodes with label :Actor
personId:ID,name,:LABEL
keanu,"Keanu Reeves",Actor
laurence,"Laurence Fishburne",Actor
carrieanne,"Carrie-Anne Moss",Actor
Finally, you can import relationships
As you see, actors and movies are already imported. So now you just need to specify the relationships. In the example, you're importing ROLE relationship in the given format:
:START_ID,role,:END_ID,:TYPE
keanu,"Neo",tt0133093,ACTED_IN
keanu,"Neo",tt0234215,ACTED_IN
keanu,"Neo",tt0242653,ACTED_IN
laurence,"Morpheus",tt0133093,ACTED_IN
laurence,"Morpheus",tt0234215,ACTED_IN
laurence,"Morpheus",tt0242653,ACTED_IN
carrieanne,"Trinity",tt0133093,ACTED_IN
carrieanne,"Trinity",tt0234215,ACTED_IN
carrieanne,"Trinity",tt0242653,ACTED_IN
So as you see in the header, you've got values:
START_ID - where the relationship starts, from which node
role - property name (you can specify multiple properties here, just make sure the csv format contains data for it)
:END_IN - where the relationship ends, to which node
:TYPE - type of the relationship
That's all :)

How to stop munin from calculating the values in millis?

I wrote my own munin-plugin and I'm confused, how munin represents values between 0 and 1.
The 2nd line of values uses an notation with 'n'. What does it mean and how can I avoid it? I just want a common floating point value like 0.33!
What I'm doing wrong?
Here is the plugin configuration:
graph_title Title
graph_args --base 1000 -l 0
graph_vlabel label
graph_category backup
Every hint is welcome.
UPDATE
Ok, I finally found it: https://serverfault.com/questions/123761/what-does-the-m-unit-in-munin-mean
'm' stands for milli!
I am a bit confused, why munin is using it in this context!
Is there any possibility to avoid this?
Some configuration items that may be of interest. See Munin Plugin Reference.
You may change the resolution in numeric resolution in the table data with the below. Use C/C++ formatting, and spacing may be an issue in end result.
graph_printf %5.2le # default is %6.2lf
# appears l (for long) is needed
For certain graph types you can also alter the display period for the munin graph. Munin graphs the average data between last two (nominally 5 minute spaced) measurements - with default of per/sec units on the result. This is based on the var.type attribute which defaults to GAUGE. If your for example data is reporting accumulated counts you can use:
type DERIVE # data displayed is change from last
# reading
type COUNTER # accumulating counter with reset on rollover
for each of these you can change the vertical axis to use per/minute or per/hour with:
graph_period minute # if type DERIVE or COUNTER
# display avg/period vs default of avg/sec
Note that the table shows the derived data for the graph_period.
See RRDCreate == rrdtool create for implementation particulars- munin used rrd underneath.

Cant I use dates as axes in a scatter plot in SAS VA?

In Enterprise Guide, I draw scatter plots with creation and closing date of issues to detect when backloggs occur and when they are resolved:
(The straight lines in the graph are batch interventions, like closing a set of issues that were handled outside ot the system.)
proc sgplot data=alert;
scatter x=create_Date y=CloseDate / group=CloseReason;
run;
When I try to do the same in SAS Visual Analytics, I can only put measures on the x-ax and y-ax and I cant make te date or datetime variable a measure.
Do I do something wrong? Should I use another graph type?
My take is that the inability of SAS VA Explorer to allow dates to be measures is a real weakness. Old school trickery would be perhaps to create a duplicate data item that computes the SAS data value (giving you a number result and thus a measure) and then formatting that with a custom format to render it back as a human readable date.
However, according to http://support.sas.com/kb/47/100.html#explorer
How SAS Visual Analytics Designer supports formats
In SAS Visual Analytics Designer, the Format property of the data item displays the name of the format for both numeric and character data items. However, there are some differences between numeric and character data items.
Numeric data items
You can change the format. If you change the format, you can restore the user-defined format by selecting Reset to Default in the Format type box.
You can specify to sort by formatted or unformatted values (release 6.2 and later).
(My bolds) Numeric data items with a user-defined format are classified as categories. You cannot change these data items to measures while the user-defined format is applied.
According to support.sas.com/documentation/cdl/en/vaug/68648/PDF/default/vaug.pdf , page 166, you could work on defining data roles for a scatter plot.
I am not sure that this could solve your situation but it says that:
"In addition to measures, you can assign a Group variable. The Group variable groups the data based on the values of the category data item that you assign. A separate set of scatter points is created for each value of the group variable.
You can add data items to the Data tips role. The values for the data items in the Data tips role are displayed in the data tips for the scatter plot".
Hope it helps.

JasperReports CategoryDataset has less data than expected?

I'm trying to develop a ChartCustomizer that takes the data from a chart and converts it into a histogram (because JR does not directly support histograms). It's a fairly simple implementation with hard-coded intervals, etc. mostly as a proof-of-concept at this point.
The data I'm analyzing is HTTP response-time data of the form [date, response-time] and I have a CSV file with 18512 records in it. In my summary band, I have 3 items:
A text field dumping $V{REPORT_COUNT} (it reports 18512 in iReport's report preview)
A time series showing all the data points [date, response-time]
A category plot containing all the data points in a single series [category=$F{DATE}, value=$F{RESPONSE_TIME}]
I decided that the most straightforward way to build a histogram would be to use the Category plot because it had the right structure for the final histogram chart.
When the ChartCustomizer runs, it dumps out all kinds of good information about the data set, including the size. Strangely, the size is 10252: it's missing something like 8000 data points. I can't understand why the category plot would have fewer data points than the whole data set.
Any ideas?
Answering my own question in case others run across this foolish user error.
The problem was that CategoryDataset only allows one data point per "category", and in my case, "category" was a java.util.Date captured from the web server log. Apparently, nearly half of my dates were duplicates and so part of the data set overwrote the other half, leaving a subset of the data.
That should have been totally obvious to me at the outset, because that is exactly how a category dataset works.
Anyhow, simply changing the category plot series's "category expression" from $F{DATE} to $V{REPORT_COUNT} gave each datum a unique category which makes everything work.

ms Chart Multiple Series X Value Mismatch (ASP.NET)

I'm currently developing a website that shows multiple charts that I build using data from SQL tables. I've used and followed Scott Mitchell's tutorial (https://web.archive.org/web/20210927195532/http://www.4guysfromrolla.com/articles/093009-1.aspx) and K. Scott Allen's ChartBuilder class (http://code.msdn.microsoft.com/mag200903XASP/Release/ProjectReleases.aspx?ReleaseId=2245) and all works well.
However when have two series that I want to show on the same Chart, if one set of data does not have all of the X values the other series does, the chart blindly puts all the data on, ignoring trying to match the X values of the other series, therefore mismatching the X values when the chart is shown.
I know that I can fiddle the data so that both sets of data have the same X values, however I'm trying to make the class handle anomalies in the data so that I don't have to worry too much about the data.
Any help is greatly appreciated.
chart.DataBindCrossTab match it for you.
See more here: http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx

Resources