reporting services - SSRS stacked data bar with variable number of data points -
we've been trying come flexible design stacked data bar in ssrs allow visualizing percentage of viewed video material in 100% filled tablix column cell.
the goal display parts of video clip user has viewed. example - host 1 hour long episode of tv show, users don't watch entire episode beginning end , want know parts of video watched. users may jump around - watch little bit in beginning, skip middle , watch more, go end. streaming video system use provides detailed reports viewing began , ended. our job put information concise, fixed length databar in order show how of given video clip particular user has watched.
here's desired of report.
in first row, you'll see user has viewed 20% of video, jumped 49% , watched till 54% , stopped. resulted in 25% of total length of video viewed.
can achieved using stacked data bars? suggestions appreciated.
i able solve creating custom ssrs assembly generates bitmap image , returns byte array, used in image expression field.
if interested, partial c# code used generate image based on viewed portions of video below:
using system; using system.collections.generic; using system.drawing; using system.drawing.drawing2d; using system.drawing.imaging; using system.io; using system.linq; using system.text.regularexpressions; namespace ssrsextensions { public class reportfunctions { public static byte[] getviewingrangeimage(string ranges, string imageformatstring, single width, single height, string backgroundcolor, string foregroundcolor, string separatorcolor) { byte[] retvalue = null; imageformat imageformat = getimageformat(imageformatstring); if (imageformat != null) { imagecodecinfo imagecodec = getimageencoderinfo(imageformat); bitmap bitmap = getviewingrangeimagebitmap(ranges, width, height, backgroundcolor, foregroundcolor, separatorcolor); using (encoderparameters encoderparameters = new encoderparameters(1)) { using (encoderparameter encoderparameter = new encoderparameter(encoder.quality, 100l)) { encoderparameters.param[0] = encoderparameter; using (memorystream memorystream = new memorystream()) { bitmap.save(memorystream, imageformat); retvalue = memorystream.toarray(); } } } } return retvalue; } } }
the image expression is: =ssrsextensions.reportfunctions.getviewingrangeimage(fields!viewingrange.value, "png", 200, 25, "white", "#808080", "#bfbfbf")
the actual ranges specified in comma separated string, so: 0.000000-10.000000,20.000000-50.000000,90.000000-100.000000., user watched first 10%, skipped 20% , watched till 50%, skipped 90% , finished watching till end.
this older blog post (https://blog.oraylis.de/2012/04/ssrs-custom-drawing-code/) talks how draw dynamic images , use them in reports. uses inline vb. if want use c#, you'll have create external assembly, copy c:\program files\microsoft sql server[ssrs install folder]\reporting services\reportserver\bin folder , reference in report.
if needs additional details on how plug ssrs report, let me know , i'll gladly help.
Comments
Post a Comment