SQL Reporting Services 图表 - 自定义轴标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/942086/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Reporting Services Chart - Custom Axis Label
提问by Jason Irwin
I have a SQL Server Reporting Services (2008) chart (error chart). The X-axis has date intervals 1/1/2009, 2/1/2009, etc. The Y-axis has numeric intervals of 50. Values on the Y-axis are 0, 50 and 100. However, instead of displaying 0, 50 and 100 i would like to display "Small","Medium" and "Large" respectively. Does anyone know how this text replacement can be performed?
我有一个 SQL Server Reporting Services (2008) 图表(错误图表)。X 轴的日期间隔为 1/1/2009、2/1/2009 等。Y 轴的数字间隔为 50。Y 轴上的值为 0、50 和 100。但是,不是显示 0 , 50 和 100 我想分别显示“小”、“中”和“大”。有谁知道如何执行此文本替换?
回答by Peter Radocchia
This is a bit of a hack, but here goes:
这有点黑客,但这里是:
First, normalize your values around zero, so the smallest value is -50 and the largest value is 50. You can do this in the chart control itself, no need to change your dataset. Your values are between 0 and 100, so just subtract 50.
Next, under value axis properties -> axis options, set your minimum to -50, maximum to 50, and interval to 50.
Finally, under value axis properties -> Number, select Category as "Custom" and enter this in as the custom format expression: ="Large;Small;Medium"
首先,将您的值标准化到零附近,因此最小值为 -50,最大值为 50。您可以在图表控件本身中执行此操作,无需更改数据集。您的值介于 0 和 100 之间,因此只需减去 50。
接下来,在值轴属性 -> 轴选项下,将最小值设置为 -50,最大值设置为 50,间隔设置为 50。
最后,在 value axis properties -> Number 下,选择 Category 作为“Custom”并输入它作为自定义格式表达式:="Large;Small;Medium"
(that's an excel format code: pos;neg;zero)
(这是一个 excel 格式代码:pos; neg; zero)
You should get something like this:
你应该得到这样的东西:
回答by Eugene Yokota
According to Arbitrary Label for Y axis in SSRS Charts, you can achieve the similar effect by using strip line collection. See How to: Highlight Chart Data by Adding Strip Lines.
根据SSRS Charts 中 Y 轴的任意标签,您可以通过使用带状线集合来实现类似的效果。请参见如何:通过添加带状线突出显示图表数据。