what is wrong with ratio? (100,200)
https://chart.googleapis.com/chart?cht=p&chd=t:100,200&chs=300x120&chl=Hello|World
As marcog explained, by default values over 100 will be truncated to 100, thus causing your api call to be processed in the background as:
https://chart.googleapis.com/chart?cht=p&chd=t:100,100&chs=300x120&chl=Hello|World
which is why you see a pie chart with two equal pieces. One way to fix this is to add a custom scale to your data series using the chds parameter like this:
https://chart.googleapis.com/chart?cht=p&chd=t:100,200&chds=0,200&chs=300x120&chl=Hello|World
Note I added a &chds=0,200 to specify that values can range from 0 to 200.
Another option is to use percentages rather than actual values
Hope this helps.
The values need to be between 0 and 100, with values above 100 truncated to 100 (reference).
Had a quick mess around with the URL. Is it possible there's meant to be a "total" parameter in the URL? Since 3 parameters just splits it equally into 3 parts...
Related
I'm making a time-spending tracker based on the work I do every hour of the day.
Now, suppose I have 28 types of work listed in my tracker (which I also have to increase from time to time), and I have about 8 significance values that I have decided to relate to these 28 types of work, predefined.
I want that, as soon as I enter a type of work in cell 1 - I want the adjacent cell 2 to get automatically populated with a significance value (from a range of 8 values) that is pre-definitely set by me.
Every time I input a new or old occurrence of a type of work, the adjacent cell should automatically get matched with its relevant significance value & automatically get populated in real-time.
I know how to do it using IF, IFS, and IF_OR conditions, but I feel that based on the ever-expanding types of work & significance values, the above formulas will be very big, complicated, and repetitive in the future. I feel there's a more efficient way to achieve it. Also, I don't want it to be selected from a drop-down list.
Guys, please help me out with the most efficient way to handle this. TUIA :)
Also, I've added a snapshot and a sample sheet describing the problem.
Sample sheet
XLOOKUP() may work. Try-
=XLOOKUP(D2,A2:A,B2:B)
Or FILTER() function like-
=FILTER(B2:B,A2:A=D2)
You can use this formula for a whole column:
=INDEX(IFERROR(VLOOKUP(C14:C,A2:B9,2,0)))
Adapt the ranges to your actual tables in order to include in the second argument all the potential values and their significances
This is the formula, that worked for me (for anybody's reference):
I created another reference sheet, stating the types of work & their significance. From that sheet, I'm using either vlookup, filter, xlookup.Using gforms for inputting my data.
=ARRAYFORMULA(IFS(ROW(D:D)=1,"Significance",A:A="","",TRUE,VLOOKUP(D:D,Reference!$A:$B,2,0)))
I have a dataset in which there's a numerical attribute for the 'number of days since last contact' but the value -1 is being used to indicate that there hasn't been a last contact. It is by far the largest value for this attribute.
My idea is to discretise this attribute but how can I ensure there is a 'no contact'/-1 bin?
Also, is this the correct approach to this problem?
The proper approach supposedly is to
Split the data into -1 and everything else
Apply binning to the values in the 'everything else' set only
Concatenate the data sets again (it may be good to shuffle, too)
If anyone else has this question and can't find an answer, here's how I did it based on Anony-Mousse's method. The filter documentation for MathExpression gives a good example of splitting into arbitrary bins.
Split using the MathExpression filter e.g. ifelse(A>0, 2, 1) to split into two bins: above and below 0. I used ifelse(A>0, ifelse(A>400, 21, ceil(A/20)+1), 1) to bin my -1 and >400 values, and for in between values to be in bins of width 20.
Convert using numericToNominal
I have this Column Chart using Google's Visualization Chart API tools. How would I make it so the y-axis numbers are only positive whole numbers? I've tried looking through the documentation but can't seem to find anything.
I used the following and have not seen fractions since...
vAxis:{minValue:0,maxValue:5,gridlines:{count:6}}
The trick seems to be that with 6 gridlines and 5 as lowest 'high' value,
the halves and tenths aren't applicable anymore.
This worked for me
vAxis: {minValue:0, format:'#'}
Simply use hAxis.format
example :
hAxis: {minValue:0,format:'0'},
format 0 = Digit
Positive numbers:
You can use vAxis.minValue to set the lowest y-axis gridline, however the actual value of the gridline will be the minimum of what you set and the lowest value in your data, so if you have 0 in your data (as it seems you do for Unsatisfactory), this value will be used for the lowest y-axis gridline.
Whole numbers:
http://groups.google.com/group/google-visualization-api/browse_thread/thread/04a001766367dc0f/84c34338c2808069 - this is an older post, but as there is nothing in the chart API documentation, it seems the functionality to specify whole numbers only is still lacking.
Because the chart defaults to 5 gridlines (this is what you'd like to be able to override), if your highest data value is 2.0 (like in the example) you could force whole numbers by setting vAxis: {maxValue: 5}, although this may not be the most elegant solution.
you can use the axisLabels feature.
To use it, you must manually edit your axixLabels as shown here: http://code.google.com/apis/chart/image/docs/chart_params.html#axis_labels
e.g.:
chxt=x,y
chxp=0:|Excellent|Very Good|Fair|Unsatisfactory|1:|0|1|2
Greetings,
Jan
If you change your graph type as follow:
google.load('visualization', '1', {'packages':['linechart']});
will work for you..
var max=Math.max(1,10,15,20);(u have to pass the values what the values u have)
var maxvalue= max / 4;
var res=Math.floor(maxvalue);
res=res+1;
var remin= max % 4;
if(res != 0) {
maxvalue=(res * 4);
}
else
maxvalue= 4;
use the above code its working fine for me.
The only workaround that I could find to this problem is that... For example, the default grid divisions are 4. You could change that number. But incase of the default (4) the vAxis.maxValue should be divisible by 4, if now increment that number so that it is.
The url I'm using is this:
https://chart.apis.google.com/chart?chxl=0:|2010-08-06|2010-08-02|2010-08-05|2010-08-03|2010-08-04|1:|0|2347.002|3650|2:|min|average|max&chxp=2,10,50.83,90&chxr=0,2347.002,3650&chxt=x,y,r&chs=200x120&cht=bvg&chco=EBB411&chd=t:3455.01,730,2240,1760,3550&chma=|5&chtt=Revenue
The image:
The bars shouldn't be filling all the way to the top, but I cannot figure out what I've done wrong.
See the documentation on data encoding:
Basic text-formatted data lets you specify floating point values from 0—100, inclusive, as numbers.
You're supplying numbers bigger than 100, which is why they're going all the way to the top.
For example, if I change one of the supplied data points to 50, it looks like this:
You need to either include a scaling parameter or used the extended encoding format.
Is there a way to set the length of a data series using Google Charts i.e. send in 40 values and stipulate that the range is 256 values and have it plot the 40 values and leave room for (256-40) more values in the chart?
To get the idea, think of a finance intraday chart, at 10 o clock it displays only the data that is gotten by that time, but the chart still shows all of the space that eventually WILL get filled (when the trading day is over, that is).
I'd say to get a live preview of the effect to be accomplished here, see finance.google.com and look at the chart before 4 o'clock this afternoon and you'll see that it is not completely filled, although the chart is always the same "size" in terms of datarange.
Fill the rest of the values using the _ (or __ depending on your encoding) special value to indicate "no data".
See the documentation for simple encoding for additional information on this. Text encoding uses negative values to indicate missing data.