Sparklines stacked bar color options only allow two color variations? - google-apps-script

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.

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:

Position data points in bar graphs in SSRS

I have SSRS reports which has a column chart.
The column chart has 2 value: Actual and Target.
The actual value is displayed as column chart with data labels displayed
and target value as Range column (my data has different targets for different values and would like to display target line for each bar)
The problem which I am running into is that sometimes this target line gets displayed over the data labels and its hard to read the data value.
Is there any way to set these labels to display over the target line when this happens?
This is what is happening right now:
https://drive.google.com/file/d/0Bx_Po7ND9VtOcW8xN3JSNlk5NjQ/view?usp=sharing
Options I tried till now:
1) setting the target values as first series and actual as second series: In this case I don't get to see the target lines as bars gets painted over the target lines.
You can set your Range Series' Fill color to use Transparency to allow the elements behind the line to be seen.
On another note, in the future you may want to do this with a StripLine on the axis rather than creating a new series.
http://blogs.adatis.co.uk/blogs/jeoc/archive/2013/07/23/adding-strip-lines-to-reports.aspx
http://blog.jontav.com/post/7067899413/axis-striplines-in-ssrs-charts

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.

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.

How to create a certain configuration given below in HTML?

For certain project I want to create a configuration like shown below in image in HTML.
This is a circular ring (bounded by two circles) divided into 10 equal cells and each cell have different color (out of 10 different colors) . Each cell also has a digit (0-9) corresponds to it and placement of digits is fixed (for example: top cell with black color has digit '0' and next cell has digit '1' in clock wise direction). The color of each cell have to change dynamically (on each session) and all cells have unique colors out of 10 different colors. I want to write HTML code for it.
My approach is :
first I draw two circles and divide into 10 equal cells using line geometry. but problem is how to fill color in each cell !!
Any suggestions !!! Please give me HTML code or correct approach to do this.
there is a plugin called Set Text on a Circle , it may be useful for you , try it here http://css-tricks.com/set-text-on-a-circle/