我能夠通過創建一個定製的SSRS程序集來生成位圖圖像並將其作爲字節數組返回,然後在圖像表達式字段中使用它來解決此問題。
如果有人有興趣,所使用的部分C#代碼來生成基於所述視頻的觀看部分圖像是下面:
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;
}
}
}
形象表達是:= SSRSExtensions.ReportFunctions.GetViewingRangeImage(字段!ViewingRange.Value, 「PNG」,200,25, 「白」, 「#808080」, 「#bfbfbf」)
的實際範圍以逗號分隔字符串指定的,就像這樣: 0.000000-10.000000,20.000000-50.000000,90.000000-100.000000。,其中用戶首先觀看10%,跳過20%並觀看直到50%,然後跳到90%,並完成觀看直到結束。
這篇較舊的博客文章(https://blog.oraylis.de/2012/04/ssrs-custom-drawing-code/)討論瞭如何繪製動態圖像並在報告中使用它們。它使用內聯VB。如果您想使用C#,您必須創建一個外部程序集,將其複製到C:\ Program Files \ Microsoft SQL Server [SSRS INSTALL FOLDER] \ Reporting Services \ ReportServer \ bin文件夾,並在您的報告中引用它。
如果有人需要關於如何將此全部插入到SSRS報告的其他詳細信息,請告訴我,我很樂意幫助。
來源
2016-03-26 07:24:27
TD7
我覺得「這是可能的」是它是。您是否有查詢返回已開發的相關數據?共享這個輸出將有助於我們爲圖表設計提供建議。 – Jonnus
我認爲範圍條形圖更適合使用。這與甘特圖相同。 – Kim
「在第一行中,您會看到用戶瀏覽過大約20%的視頻,然後跳到49%,然後觀看直到54%,然後停下來。」 - 它那種視頻吧? ;) – bushell