我正在使用以下查询构建事件报告:
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
我还创建了一个图表,但是由于某种原因,图表中的颜色与图例不一致。 有什么想法吗?
这是一个功能错误已知问题,如果您使用 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"的答案。