I want to draw a chart in linux like this:
1################# 64.85
2################### 72.84
3####################### 91.19
4####################### 91.61
5########################### 108.66
6############################ 110.69
7###################################### 149.85
8####################################### 156.60
9########################################### 169.81
I want to do that in python, of course you noticed that I don't want code like:
for i in data:
print "#"*i
because data may contain big numbers, so it is not nice to print "#" milion times.
So what is the mathematical equation that I must use to do this, I think this is a kind of mathematical problem
Thanks a lot
You have to work with percentages I think sum up all you values and then you do bar value / total of bar values
So if I have the following values 1 2 3 6 the total will be 12 so then
i will do 1 / 12 the percentage will be 8 so you print '#' 8 times and so on.
then the max # you can print is hundred.
I don't know if this is what you want, but hope this will help.
Related
I am trying to alternate every 2 rows background color from white to blue as per below design in SSRS:
I have tried the below expression but it does not give the expected result:
=IIf((RowNumber(NOTHING) Mod 4) < 3 , "Blue", "Transparent")
Has anyone ever done anything similar and is there a way to achieve this?
I've just tested the following and it works on a simple table. If it does not work for you, please share your table/matrix design including any row or column groups.
=IIF(((RowNumber(Nothing)-1) Mod 4) < 2 , "Blue", Nothing)
This simply offsets the mod calculation by 1 as the first row is 1 so we get a sequence of 0,1,2,3,0,1,2,3....
I find that adding a new column with the mod expression helps debug things like this. SO I would add a new column with =(RowNumber(Nothing)-1) Mod 4 as the expression and see what it returns.
I have some question about fixed version kiss_fft's butterfly computation.
in "kf_bfly2", input divide by 2 use "C_FIXDIV",
in "kf_bfly3", input divide by 3 use "C_FIXDIV",
in "kf_bfly4", input divide by 4 use "C_FIXDIV",
in "kf_bfly5", input divide by 5 use "C_FIXDIV",
in "kiss_fftr" also use "C_FIXDIV",from the point of view of FFT algorithm,it's no use, It seems using "C_FIXDIV" just to prevent overflow.
but if the input is Q15, what's the output Q value?
the output Q value is consistent with input's?
whether the output magnitude is smaller than the expected?
I'm really puzzled.
The assignment is to construct a two-column table that starts at x= -4 and ends with x= 5 with one unit increments between consecutive x values. It should have column headings ‘x’ and ‘f(x)’. I can't find anything helpful on html.table(), which is what we're supposed to use.
This what I have so far. I just have no idea what to put into the html.table function.
x = var('x')
f(x) = (5 * x^2) - (9 * x) + 4
html.table()
You might want to have a look at sage's reference documentation page on html.table
It contains the following valuable information :
table(x, header=False)
Print a nested list as a HTML table. Strings of html will be parsed for math inside dollar and double-dollar signs. 2D graphics will be displayed in the cells. Expressions will be latexed.
INPUT:
x – a list of lists (i.e., a list of table rows)
header – a row of headers. If True, then the first row of the table is taken to be the header.
There is also an example for sin (instead of f) with x in 0..3 instead of -4..5, that you can probably adapt pretty easily :
html.table([(x,sin(x)) for x in [0..3]], header = ["$x$", "$\sin(x)$"])
#Cimbali has a great answer. For completeness, I'll point out that you should be able to get this information with
html.table?
or, in fact,
table?
since I would say we want to advocate the more general table function, which has a lot of good potential for you.
Is there a way to have a pie chart only show labels if there value is at least 1%? I have a dataset that returns about 20 results and I total the set then add a percentage to each individual return. So sometimes there will be 0% and it just junks up the graph and makes it difficult to read. Is there a standard way or custom function that can disable 0% from showing?
Let me add some knowledge here as well. My data is set-up so that the data returned from my dataset is displayed in column 1 and 2 - then in column 3 is a percentage that divides the data in column 2 by the total column. So it looks like this:
Microwave 42 30%
Stove 100 70%
Total 142 100%
How could it be achieved with data in this format?
In the past I've solved this by using a custom expression in the Series Label:
Where I essentially display an empty string where the data % is under a certain level, something like:
=IIf(Sum(Fields!MyValue.Value) / Sum(Fields!MyValue.Value, "ChartDataSet") < 0.01
, ""
, "#PERCENT{P0}")
Where Sum(Fields!MyValue.Value) / Sum(Fields!MyValue.Value, "ChartDataSet") is simply working out the % value of that particular group.
Edited to add:
Actually, thinking about this a bit more, you can use the Chart Series -> Label -> Visible property to control this; set the property as something like:
=IIf(Sum(Fields!MyValue.Value) / Sum(Fields!MyValue.Value, "ChartDataSet") < 0.01
, False
, True)
Maybe this is a slightly neater way of achieving the same thing.
I am go to generate an excel file from SSRS, and
I want to format the number like this...
15 is displayed as 15
14.3453453 is displayed as 14.35
12.1 is displayed as 12.1
0 is displayed as 0
1 is displayed as 1
I can apply this in Excel but unable to apply in SSRS
[=0]0;[=1]1;0.##
Does anyone can suggest another way for me? Thanks!
am assuming that you want to know how to format numbers in SSRS
Just right click the TextBox on which you want to apply formatting, go to its expression.
suppose its expression is something like below
=Fields!myField.Value
then do this
=Format(Fields!myField.Value,"##.##")
or
=Format(Fields!myFields.Value,"00.00")
difference between the two is that former one would make 4 as 4 and later one would make 4 as 04.00
this should give you an idea.
also: you might have to convert your field into a numerical one. i.e.
=Format(CDbl(Fields!myFields.Value),"00.00")
so: 0 in format expression means, when no number is present, place a 0 there and # means when no number is present, leave it. Both of them works same when numbers are present
ie. 45.6567 would be 45.65 for both of them:
UPDATE :
if you want to apply variable formatting on the same column based on row values i.e.
you want myField to have no formatting when it has no decimal value but formatting with double precision when it has decimal then you can do it through logic. (though you should not be doing so)
Go to the appropriate textbox and go to its expression and do this:
=IIF((Fields!myField.Value - CInt(Fields!myField.Value)) > 0,
Format(Fields!myField.Value, "##.##"),Fields!myField.Value)
so basically you are using IIF(condition, true,false) operator of SSRS,
ur condition is to check whether the number has decimal value, if it has, you apply the formatting and if no, you let it as it is.
this should give you an idea, how to handle variable formatting.
Have you tried with the custom format "#,##0.##" ?
You can use
=Format(Fields!myField.Value,"F2")