I made a SQL Server procedure that can help you. It returns the histogram of a dataset. https://github.com/oscar-be/SQLServerStuff/blob/master/Data%20Analysis%20and%20Statistics/PLOT_GRAPH.sql