简体   繁体   English

自定义IIF表达式SSRS中的颜色

[英]Customise colour in IIF expression SSRS

I currently have 2 values in one field: the total project count and the active projects count. 我目前在一个字段中有2个值:项目总数和活动项目数。 The values are displayed as, for example, 100/50 on the data label within the pie chart. 这些值在饼图内的数据标签上显示为例如100/50。

Is it possible to format the colours of each value individually so that the "100" (total projects) for example is coloured black and the "50" (active projects) is coloured blue? 是否可以分别格式化每个值的颜色,以使“ 100”(项目总数)为黑色,而“ 50”(活动项目)为蓝色?

=Fields!TotalProjs.Value & "/" & Fields!ActiveProjs.Value

I can see an expression field for colour under the data labels but I'm unsure of the type of expression required in this case. 我可以在数据标签下看到颜色的表达式字段,但不确定这种情况下所需的表达式类型。

I've tried : 我试过了 :

=IIF(fields!totalprojs.value>0,"black","red") & IIF(fields!activeprojs.value>0,"blue","red")

But I know this wouldn't work. 但是我知道这行不通。

You can achieve this by using PlaceHolders. 您可以使用PlaceHolders来实现。 It is illustrated in this article on Social.Microsoft site: https://social.technet.microsoft.com/wiki/contents/articles/18748.ssrs-multi-font-color-multi-font-size-within-a-single-field-textbox.aspx 本文在Social.Microsoft网站上进行了说明: https ://social.technet.microsoft.com/wiki/contents/articles/18748.ssrs-multi-font-color-multi-font-size-within-a- single-field-textbox.aspx

No - unfortunately, there's not a way to color parts of a label's text separately. -不幸的是,没有办法分别给标签文本的各个部分上色。

The Label's COLOR property will only let one value be selected. Label的COLOR属性只能选择一个值。 You can't use placeholders in a label nor can you use HTML. 您不能在标签中使用占位符,也不能使用HTML。

I can't think of any other workaround that can emulate anything like what you want. 我想不出任何其他可模仿您想要的东西的解决方法。

Maybe put the values in a table below or next to your pie that emulates a Legend and includes the values? 也许将这些值放在模拟图例并包含这些值的饼图下方或旁边的表格中? Then you could use either a placeholder or HTML for the color. 然后,您可以使用占位符或HTML作为颜色。 IMHO - the HTML would be simpler to implement than placeholders since there would just be one expression with both values and both colors. 恕我直言-HTML将比占位符更易于实现,因为将只有一个具有值和颜色的表达式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM