SSRS bar chart custom grid line color with expression - reporting-services

I have a bar chart, the values are percentage. I want the 100% grid line to be a standout color like blue rather than the default grayish "Gainsboro".
I tried to use expression for the line color in "Chart Gridlines" dialog, but how do I know "current" line is 100%?

By adding a strip line, we can do it.
Select Value Axis
Click "StripLines"
Click "Add"
Set "BackgroundColor" and "BorderColor" you want.
Set "BorderWidth" so make it standout, I set it to 2pt.
Set "IntervalOffset". I set it to 1 because I want 100% is the target (1 = 100%).
do NOT change "StripWidth" otherwise it will not acurately aligned on the number you want!

Bit of a hack but how about adding a series with all 100% for each data point, then you could choose the colour of the series and make it as thick and as dark as you want

Related

ssrs change background color of line chart

I'm developing a report in which I have to highlight a particular period on a line chart.
To be more precise if the dates in the x axis are more than a given date the chart background colour after that date will have to be light green otherwise white.
Here is the expression
=IIF(Fields!Week_Day_Of.Value>Fields!startdate.Value,"LightGreen","#00000000")
I have put the expression in the chart area properties (Fill).
Fields!Week_Day_Of.Value represents the values on the X axis.
Fields!startdate.Value represents the parameter beyond which the cart has to turn light green.
It's not doing anything
As far as I am aware, you cannot fill parts of the chart background like this. Your best bet is to add another column data series on the secondary vertical axis that has a value of 1 or 0 depending on the expression you have above and set the colour of the series to whatever you need. To get the columns wide enough to form a solid block of colour, you will need to set the CustomAttributes -> MinPixelPointWidth property to 100.
You can then set the secondary axis to hidden by right clicking on the chart area and unchecking Show Secondary Vertical Axis and check the Do not show this series in a legend option in the Legend area of the series properties.
Do all this and your chart will look something like this:

Report Builder 3.0, breaking out data field for Bar Chart

I'm using Report Builder 3.0 and trying to figure out if i can break out one datafield with the few values I need for my bar chart. The data looks like this;
[[44278,47411],[{"name":"$41,000/year goal","y":41000}],["",""]]
I want bar 1 to be the 44,278 value, bar 2 to be the 47,411 value and the 41000 to be embedded as a goal. I've attached a screenshot of how we have it working with other grid and charting products, but this is going to be embedded in a much more in-depth SSRS report. Any sort of help would be great as i'm new to the whole SSRS reporting system.
You can do this with a custom StripLine:
Right-click the vertical chart axis and click Vertical Axis Properties.
The axis properties are displayed in the Properties window.
In the Appearance section of the Properties pane, for the StripLines property, click the Edit Collection (…) button to open the ChartStripLine Collection Editor.
Click Add to add a new strip line to the collection.
Click StripWidth to specify the width of the strip line. If your goals will fluctuate, you might want to make it relative to your Goal e.g. =Fields!YourGoalField.Value/100
Set the StripWidthType property to Number.
Set the InvervalOffset value to =Fields!YourGoalField.Value.
Set the IntervalOffsetType value to Number.
More on StripeLines: http://technet.microsoft.com/en-us/library/dd239316.aspx
EDIT To get the Goal Label outside the Chart Area as depicted, we have to do a sort of hack:
Delete the StripLine Title as there is no way to get that outside the Chart Area.
Right Click the Chart and select Add New Title.
On your new Chart Title's Properties Pane
Set the Docking Position to Right Center.
Set the TextOrientation to Horizontal.
Adjust the Font style and color to match your spec.
Set the Caption Expression to =Format(Fields!YourGoal.Value,"$0,000") & "/year goal"
Here is where the hack comes in. In order to get the Goal label to line up with the Goal Line, you need to add a certain number of carriage return/line feeds to your Caption Expression. To do this, append & vbcrlf to the Caption Expression a bunch of times and keep testing until it lines up. You might also want to adjust the DockingOffset property to move the Label closer to the Chart Area.

Target reference for each bar in Spotfire

In Spotfire:
Is it possible to show target value reference line for each bar in a bar chart.
A way around that i am doing now is using combination chart. Refer screenshot.
The problem here is that now i can not define a color by property to color bars using rules.
I don't believe you can do it automatically without scripting but here is an example of how to do it by hand.
Right click on your bar chart and go to the Lines & Curves section:
Here you can see I've added 4 lines based on percentage of the data.
You can do this or add lines of set values using the Add button in the top right and selecting Horizontal Line.
Notice I've added the line name as the description of the percentage it is, hovering over will show an actual value so it may better to do this if it isn't clear what the value represents.
This is what it produces:
To make it better match your question I've added 2 more employees and coloured by employee instead, I've also set fixed targets for each person rather than percentages and renamed them to make sure it is clear which line applies to which person in case the colour isn't enough.
Using the Settings -> Appearance section back in the first picture change the colour of the lines to match the fields they represent.
Like I said at the start you should be able to create a script to do this for you but that is another question.

In SSRS how to conditionally change the colour of a datalabel font on a chart when it appears on the bar

I have created a bar chart that shows values on data labels.
The Data label is placed outside the bar
But in some cases the label appears on the bar where the bar is too long.
In this scenario I would like to conditionally change the font/colour of the data label so that it's more visible.
However I can't see a way to dynamically determine where the label has been placed.
What I can think of is this. You can change the background/font color of all those series labels who's value lies in the range of 95%-100% of the maximum "Value". To be exactly precise as to what should be the threshold to change the bg/font color seems a daunting task, but you could play around with test data.
For writing the expression to change the font color,I would first change the dataset and add a column on the lines of PercOfMax. This column can be calculated easily in the dataset by using basic aggregate functions.
Then you need to go to the Chart Series Label properties-->Color and write the expression on the lines of -
=IIF(Fields!PercOfMax.Value>=95, "YELLOW", "BLACK")
As I said, you might need to do some more research to finalize the value of this threshold(which I am assuming to be 95).
Another solution to this problem is to use fill colour of the label and set its background to a bright colour (e.g. colour), and leave the font colour of the label black. Thus you can always see the label, and there is no difference when it's outside of the bar.

Implementing Target lines, in SSRS column Charts

I have a column graph, that shows a trend of consumption over time,
The y-axis being consumption and x-axis being time in month,
I have to implement a target consumption.
I implemented a target, by adding data field with a Line chart type, this is a constant, and will just display a horizontal line.
The problem i am facing is, if there is only one month, the line disappears? is there a way not to have it disappear, or is there a better way to add line target in column charts in SSRS
I am using SSRS 2008
Adding a StripLine may do what you want. They are a little hard to find, but here is how:
1) Make sure that the properties window is open beforehand. If it isn't, either hit F4 or go to the View Menu -> Properties Window.
2) Left click on your vertical axis to select it.
3) Select the StripLines entry in the Properties Window and click the ellipsis:
4) Click Add
5) Starting off, the stripline is invisible, so it can be a bit hard to adjust. :). To make it visible as a thin line, set BorderStyle to "Solid". Adjust the color with BorderColor and width with BorderWidth (not StripWidth). While positioning the line, I like to set the color to something obnoxious and make it wide to make it easier to spot.
5) To position it, you want to set the IntervalOffsetType to match the type of your interval you have set on the vertical axis. Then IntervalOffset to the y-value of where you want your target line to appear. Since you only want 1 line to appear and not repeat, you must keep Interval set to auto.
6) Once you get it positioned, make final adjustments to the appearance.
I had a hard time finding it for my Databar. I stumbled onto this...
Make sure Properties toolbar is visible
Click the Databar to highlight
Find ChartAreas in properties toolbar, click to open ChartAreas dialog
Find ValueAxes in ChartAreas dialog, click to open ChartAxis dialog
Find StripLines in ChartAxis dialog, click to open ChartStripLine dialog
I was playing around a little earlier, and i noticed that i can change the interval for the major and minor gridlines, AND change the format for the lines. I had the bright idea of making the minor lines look like the major ones i had and format the major lines to look like a target line. I don't know if this'll work for you buy you could try it.