ssrs change background color of line chart - reporting-services

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:

Related

Horizontal Axis Properties

In my chart, Incomprehensible what value of Y axis belong to X axis, what the best way to present the chart clearly. Attached Image.
Have you considered using StripLines?
Taken from this MSDN article
To show vertical strip lines, right-click the horizontal chart axis and click Horizontal Axis Properties.
Select the Use interlacing option. Grey strip lines will appear on your chart.
Applying this to a chart will then alternate the colour for each category on the X axis, such as this. This will make it clearer which columns belong to which X axis category.
Update
For use with a 3D Clustered column chart you will need to set up the Striplines in a more complicated way.
Select your X axis and find StripLines in the properties. Hit the '...' to open a new window.
Add a New Member and set it up as shown in the below image. This is effectively saying show a line for every second number, and offset the stripline by 0.5 of a category.
In my example I have set the BackgroundColour to MidnightBlue also, which gives an output similar to
With this alternating background it should make it clearer for your users to see which columns belong to which category.
Let me know if you need further assistance with this.

Add additional labels in SSRS Chart

I have a chart in SSRS with horizontal and vertical axis. The chart is as shown in the figure below. I need to add some calculated labels (marked with black) on top of the chart (example is from Excel). How can this be done in SSRS charts?
Labels and smart labels won't work in this case because of the series. It will show values for each group (ex: red, blue, yellow). I just want it once in the totals.
In a nutshell:
Create a second dataset that fetches the values you want for the Data Labels
Select the Series in the Chart and in the Properties pane going to Labels, then set UseValueAsLabel = False
Set the "Label" property to be a LookUp() that fetched the appropriate value from my second dataset
Use the "Visible" property to hide the labels for the other series so that they no longer show.
You can then change the label position to force them at the top of the columns
I found that the best way is to create a new chart (ex: Line Chart)
with value 0.
Then select Secondary Axis for the Horizontal Axis.
Set the Data Point --> Axis Label to whatever you want.

Sparklines stacked bar color options only allow two color variations?

I'm using the sparkline function in Google Spreadsheets. Here is an example of some data:
Feb-2015 MTD Actual MTD Budget Budget
Campaign 1 $41.32 $13.71 $96.00
I'd like to create a stacked bar chart sparkline as per the documentation here.
=sparkline(D9:F9,{
"charttype","bar";
"color1","blue";
"color2","yellow";
"color3","red"})
D9:F9 corresponds to $41.42: $96
Here is what the result looks like:
I had expected a segment to be red (color3). But the sparkline only seems to customize 2 colors. Can't see anything in the documentation about this. Is this a bug? Or am I misunderstanding something?
If it's the case that I can only edit 2 colors using this function, I don't suppose it's possible to edit the functionality using Google-Apps-Script?
There is a trick if you want to have 100% 3-shares bar. So, if you have 3 values that gives sum of 100 do as follows:
Remove 3rd value from the data cell.
Set "max","100" (or "max"/"100" for Europe).
Make a color background for sparkline cell.
This way the third value that fills to 100 is represented by cell background - it is a third sparkline color.
There is only color1 and color2 options listed for a bar graph. Sparklines are not expressly exposed to Apps Script, but can be written to a cell as a value. For example:
ss.appendRow(['==sparkline(D9:F9,{"charttype","bar";"color1","blue";"color2","yellow";})']);
From the docs:
https://support.google.com/docs/answer/3093289?hl=en
For bar charts:
"max" sets the maximum value along the horizontal axis.
"color1" sets the first color used for bars in the chart.
"color2" sets the second color used for bars in the chart.
"empty" sets how to treat empty cells. Possible corresponding values include: "zero" or "ignore".
"nan" sets how to treat cells with non-numeric data. Options are: "convert" and "ignore".
"rtl" determines whether or not the chart is rendered right to left. Options are true or false.

SSRS - How to align the vertical axis of 2 chart areas on the one chart

I have basically loosely followed this link
http://www.angelsbiblog.com/2012/02/improve-data-visualization-in-your-ssrs.html
and made the below linked graph. Its one dataset, I have simply pulled in Gross Profit and Sales fields. Neither are calculated fields. I put them in 2 different chart areas, but then as per that link, made the chart areas the same size so they overlay.
*Apologies for a photobucket link instead of inserted image but I don't have 10 reputation points to be able to insert images.
http://i1375.photobucket.com/albums/ag447/AndrewJacksons/IncomeandProfit_zpse074ac02.jpg
what I want to do, is as illustrated by that inserted green arrow in the graph image, is raise up the Zero line for the Income bars (yellow) to the same level as the Profit/Loss(Blue-Red).
I also want the vertical axis to preferably have the same axis, so i dont have to have that secondary axis on the right.
However the main thing is the graphs sharing their zero line. I have made the Profit bars smaller I width than the yellow bars, so in a month of blue profit, it would simply sit neatly inside the yellow income bar.
I haven't added expenses because it should be obvious what they are by the height differential btw Income to Profit or to the Loss.
Any ideas much appreciated.
I have just experienced this problem, but this page did not solve it.
Dan's answer ("simply set the minimum and maximum values for the vertical axes on both areas manually") came close, but did not solve the problem for me because I needed the axis to be automatically calculated. If the maximum of the two datasets is something like 193,456 then you get that exact value as a label on the axis rather than the sensible value of 200,000.
The solution is to allow SSRS to calculate the axis labels automatically but to trick it by using both sets of data in each chart. Then you hide the data set that you don't want the user to see.
In each chart I made the data series of interest a column chart and the other data series a line chart (without markers), as all you need to do is set the fill color for the line series to None. If you try the same with columns for the other series the invisible columns affect the position of the visible columns even if they have been set to zero width.
Make sure both series in the chart use the Primary Vertical axis. Go into properties for the Income series > Go to "Axes and Chart Area", and make sure that the series uses the primary vertical axis:

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.