系列颜色与图表中的图例颜色不同

时间:2017-10-04 23:48:06

标签: sql sql-server reporting-services charts ssrs-2008-r2

我正在使用以下查询构建事件报告:

SELECT Incident_Logged
      ,Location_Name
      ,Incident_Type
      ,Body_Part_Name
FROM Incident
INNER JOIN Location ON Location_ID = Incident_Location_ID
INNER JOIN Body_Part ON Body_Part_ID = Incident_Body_Part_ID
WHERE Incident_Logged BETWEEN @StartDate and @EndDate
AND Incident_Location_ID IN (@Location)
ORDER BY Incident_Logged DESC

我还创建了一个图表,但由于某种原因,图表中的颜色与图例不符。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

原来这是一个功能 bug 已知问题,如果你使用COUNT()聚合就会发生。我通过在查询中添加值为1的伪列来解决此问题:

SELECT Incident_Logged
      ,Location_Name
      ,Incident_Type
      ,Body_Part_Name
      ,1 Incident_Sum
FROM Incident
INNER JOIN Location ON Location_ID = Incident_Location_ID
INNER JOIN Body_Part ON Body_Part_ID = Incident_Body_Part_ID
WHERE Incident_Logged BETWEEN @StartDate and @EndDate
AND Incident_Location_ID IN (@Location)
ORDER BY Incident_Logged DESC

执行此操作后,将值更改为新列的总和。一旦你这样做,你的颜色应该排成一行。

来源:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/0dc8aad4-b846-476d-a429-f8fc2312c585/ssrs-2008-chart-legend-colours-not-matching-series-colour?forum=sqlreportingservices - 寻找“softworks phil smith”的答案。