Google Data Studio Variance chart (positive and negative numbers different colour) - bar-chart

Does anyone know how to make a variance chart with green positive bars and red negative bars. Seems like a basic task to invert colours for negative values but I can't find how to do it.
Thanks

One way that it can be achieved in a Bar Chart is by using the two IF functions below instead of a single field, in the Metric section (where the name of the respective field is Metric), and in the Style Tab, setting the bar colour of Positive to Green and Negative to Red then ticking Stacked Bars:
1) Positive (Colour: Green)
IF(Metric >= 0, Metric, NULL)
2) Negative (Red: Red)
IF(Metric >= 0, NULL, Metric)
Editable Google Data Studio Report (Embedded Google Sheets Data Source) and a GIF to elaborate:

Related

SSRS hide negative values from scale

I need to hide specific values from the scale in a line chart.
The report should load from -10 to the automatic Maxim but Hiding negative values.
My series are all positive so I can't base my expression on it.
I thought to colour these negative values of white or no colour but I don't know the way to get the current scale value.
Temporarily I checked the "hide first and last labels along this axis" checkbox but it is not the way because It is subject to rescale showing other negative values for example as second element.

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:

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:

Show 0 value in bar or column chart

In this screen shot from an SSRS report with bar charts, I would like for 0 values to display a tiny bit of color rather than just being blank. Here's what it looks like now:
Most of these charts have many series. I am generating a copy of the charts for each person under review and including the comparison values for everyone else in the group. I am thus coloring the bar representing the person under review differently from the normal color so they can easily see their performance compared to others.
Now, while there are y-axis labels, I would also like the 0 value to have at least a tiny sliver of color so everything is symmetric and the color can be seen. (I am also thinking about putting those with no data at all in the chart and need a way to distinguish those, so any ideas on how to accomplish that would help as well.)
I thought about making the axis start at -1 so the space from -1 to 0 would be colored, but I can't figure out how to get the labels to start at 0 (as shown) when I do this. I have played with quite a few settings and nothing is coming out right...
Sigh. I just figured it out.
Select the X axis.
Set CrossAt and Minimum properties to -1.
Set the IntervalOffset property to 1.
Important note: the chart in Design mode will NOT show correctly. Since I put an Interval of 20, it is showing -1 19 39 59 79 99, but when I actually Preview the report, the result is correct. Don't let yourself be thrown off by the design-mode pre-preview.
Now it looks like this:
If you leave out the CrossAt property, then the bars float away from the y-axis, leaving a gap. You must use all the properties I mentioned above to make the color reach past 0 all the way to the axis line.