系列颜色与图表中的图例颜色不同
Series colours are different to legend colours in chart
我正在使用以下查询构建事件报告:
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
我还创建了一个图表,但是由于某种原因图表中的颜色与图例不一致。有什么想法吗?
原来这是一个 feature 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" 的答案。
我正在使用以下查询构建事件报告:
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
我还创建了一个图表,但是由于某种原因图表中的颜色与图例不一致。有什么想法吗?
原来这是一个 feature 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" 的答案。