SSRS: Custom bar width between multi-level categories

落爺英雄遲暮 提交于 2019-12-10 16:58:29

问题


I have a bar chart with multiple category groups and I need to increase the spacing between the first level category group, that is, where the blue arrow points to.

I want to change this:

Into this:

Thanks in advance.


回答1:


As far as I know, there is no way to adjust the spacing between self-imposed groups of bars. However, there is a trick to get the desired affect. All you have to do is trick SSRS. In your query, you'll need to create empty bars with no labels. Without knowing how your query is structured, you can do it something like this:

Select 'Group 1' as Group_Label --This would be equivalent to your Recursos or Credito Pessoal
    , 'Bar 1' as Bar_Label --This would be like T-3
    , 10 as Value_1 --This would be like the Red part of the bar
    , 20 as Value_2
    , '1' as Bar_Sort --This will come in handy later

Union All

Select 'Group 2' as Group_Label --This would be equivalent to your Recursos or Credito Pessoal
    , 'Bar 1' as Bar_Label --This would be like T-3
    , 15 as Value_1 --This would be like the Red part of the bar
    , 30 as Value_2
    , '2' as Bar_Sort --This will come in handy later

Union All

Select '' as Group_Label
    , '' as Bar_Label
    , 0 as Value_1
    , 0 as Value_2
    , 1.5 as Bar_Sort

Order by Bar_Sort

What you would get if you set this up is the Group 1 Bar 1 followed by an empty bar (with no labels) followed by Group 2 Bar 1. This puts what the user will see as a definitive space between the groups of bars, but you know is really just an empty set of values. I've used this successfully with Bar charts multiple times.

If this isn't making sense to you, create a SQLfiddle example and I can help you tweak your code to make this work.



来源:https://stackoverflow.com/questions/21833783/ssrs-custom-bar-width-between-multi-level-categories

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!