问题
I am looking to change the color in the "gaps" in the range chart that I have built.
Essentially I am trying to build a visualization for the staff to see the availability on bays. The red markings mean the bay is booked, I wanted green then to be in between the red to highlight free bays.
Occupied bays:
I suspect I need to go back to my dataset and add in some date tables to show "null data" to allow a "switch" to work, but I thought someone might know if I could change this without going this way.
An example of the dataset would be:
Following up
here is a screen shot of my output, i added data labels to see if i was going wrong...HOWEVER I also added shadows to my data and my data is actually still there, just hiding behing my secondary bars......
you are right about my data set, i had to add a series grouping to get my appointments all to appear other wise i was just getting the first appointments on the row only to appear....
Following up 2
A further follow up, I have followed @iamdave 's excellent RangeChart.RDL
I have applied my dataset to it but I am now getting the following output, I know I am probably missing something simple, my gut is telling me the cust_id are seperating all the appointments on to seperate lines yet I have both the primary and secondary axis set to "DrawSideBySide = False"
Here is my set up..
here is my latest output, if I could just group all the rows/bars/lines down to the 6 bays it would be great.
回答1:
You can do this by adding in another data series based on your original dataset, that will require significantly less processing than filling in all your empty periods as suggested by WEI_DBA
.
- In your dataset, add a new column that returns
dense_rank() over (order by BAY) as BayID
(order by
should be your desired axis label).- This may be best done as a wrapping
select
statement to preserve the rest of the query logic as is.
- This may be best done as a wrapping
- In your Range Chart, add in another
Values
item, with the sameCategory Field
as your current one. - Set the
Top Value
to1
and yourBottom Value
to0
.- You could also set this to the
min
andmax
time of your dataset or the start and end period of your report to only cover the period the Bay was available.
- You could also set this to the
- Set it to display on the
Secondary Axis
for bothVertical
andHorizontal
axes. - Also select the
Do not show this series in a legend
option. - Set up the Secondary Vertical Axis in exactly the same way as your Primary Vertical axis.
- Set the Secondary Horizontal Axis
Minimum
andMaximum
to the same values as yourBottom
andTop
above. - Hide both the Secondary Axes.
- Select the new
Values
item and in theProperties
window, expand theCustomAttributes
section and changeDrawSideBySide
toFalse
. - If necessary, adjust the order of the
Values
items in yourChart Data
window to make sure the new Range Bar displays underneath your actual data. - Select the original
Values
item and in the properties sidebar navigate toData > DataPoint
:- Change
AxisLabel
to=Fields!BAY.Value
(Your axis label). - Change
Values > X
to=Fields!BayID.Value
(Value from point 1.).
- Change
You should now have a range chart that that displays your data on top of a solid bar, that you can set to any colour you require:
来源:https://stackoverflow.com/questions/55063682/ssrs-range-bar-chart-different-color-when-no-data