How do you format the y-axis and the tooltip value? - chartkick

Is there a way to format the numbers on the y-axis the tooltip value? Ex, I want the numbers to be delimited by commas. 1000 -> 1,000. 1000000 -> 1,000,000

You can use the thousands option for this:
<%= line_chart data, thousands: "," %>

Related

Numeric (not integer or double precision) picture token Clarion+Postgresql

i need numeric mask like this:
100
101.1
102.123
Take maksimum given decimal places but if last digit is 0 trim it.
Something like:
#n-12_`2 but trim right 0 and .
Ex:
x = 102.1230057::double precision
select rtrim(rtrim(round(x::numeric, 2)::text, '0'), '.')::numeric
If you don't need right aligned numbers, you can use #S10 (or the length you want).
#P<#.##P style pictures might help.

Calculating dates in excel

I want to count the dates. 1 date = 1, 2 dates = 2...
I have 2 dates and I want to prepare a formula if I have 2 dates, then this is total 2.
Adjust the range references to suit your data.
=COUNTA(C2:G2)
Where C2:G2 is your first row under datum. This equation will count the number of non blank cells.
If 4.9. is a number an not text, then you could also use
=COUNT(C2:G2)
In Excel you could create a new column that checks if the cell is a date by doing =ISERROR(DAY(A1)).
If it is a date the formula will return FALSE.
Then simply count all the cells with FALSE by doing =COUNTIF(B1:B10;FALSE)
Here B1:B10 should be replaced with the cellrange of your new column that holds the true or false values

Applescript: return specific index positions from a date string

I have already used the text delimiters and item numbers to extract a date from a file name, so I'm clear about how to use these. Unfortunately the date on these particular files are formatted as "yyyyMMdd" and I need to covert the date into format "yyyy-MM-dd". I have been trying to use the offset function to get particular index positions, and I have found several examples of how you would return the offset of particular digits in the string, example:
set theposition to offset of 10 in theString -- this works
(which could return 5 or 7) but I have not found examples of how to call the digits at a specific index:
set _day to offset 7 of file_date_raw -- error
"Finder got an error: Some parameter is missing for offset." number -1701
How would you do this, or is there a totally better way I'm unaware of?
To "call the digits at a specific index", you use:
text 1 thru 4 of myString
If you know that each string has 8 characters in the yyyymmdd format, then you don't need to use 'offset' or any parsing, just add in the -'s, using text x thru y to dissect the string.
set d to "20011018"
set newString to (text 1 thru 4 of d) & "-" & (text 5 thru 6 of d) & "-" & (text 7 thru 8 of d)

format of read file in fortran

What should be the read format of the of following dataset in fortran. there are 6 spaces between column 1 and 2 with no space of column 1 from margin.
1911.01.01 2.42873702403226
1911.01.02 3.5057043827303
1911.01.03 2.73602527398387
1911.01.04 6.07213767208333
1911.01.05 6.94818901068145
1911.01.06 3.66986589769583
1911.01.07 1.94565994542339
1911.01.08 2.39384275272177
1911.01.09 3.05526130775417
1911.01.10 2.69990836499194
1911.01.11 6.08406263835833
1911.01.12 7.34200241064516
1911.01.13 2.42873702403226
1911.01.14 3.5057043827303
1911.01.15 2.73602527398387
1911.01.16 6.07213767208333
1911.01.17 6.94818901068145
1911.01.18 3.66986589769583
1911.01.19 1.94565994542339
1911.01.20 2.39384275272177
1911.01.21 3.05526130775417
1911.01.22 2.69990836499194
1911.01.23 6.08406263835833
1911.01.24 7.34200241064516
1911.01.25 2.42873702403226
1911.01.26 3.5057043827303
1911.01.27 2.73602527398387
1911.01.28 6.07213767208333
1911.01.29 6.94818901068145
1911.01.30 3.66986589769583
1911.01.31 1.94565994542339
I tried.....
format (i4,i2,i2,6x,d9.14)
but it didnt work
thanks in advance
elisa
So try
(i4,a1,i2,a1,i2,6x,d16.14)
I think you've made two mistakes:
Not accounting for the . characters in the dates, I don't think that they will automatically be treated as field separators (as , or spaces would be). Obviously you'll want to ignore them.
In your d edit descriptor the number of decimal digits, that is the number after the . ought to be no greater than the total field width, ie the number before the ..

NSNumberFormatter to display custom labels for 10^n (10000 -> 10k)

I need to display numbers on a plot axis. The values could change but I want to avoid too long numbers that will ruin the readability of the graph.
My thought was to group every 3 characters and substitute them with K, M and so on (or a custom character).
So:
1 -> 1,
999 -> 999,
1.000 -> 1k,
1.200 -> 1.2k,
1.280 -> 1.2k,
12.800 -> 12.8k,
999.999 -> 999.9k,
1.000.000 -> 1M,
...
Note that probably I'll only need to format round numbers (1, 10, 1000, 1500, 2000, 10000, 20000, 30000, 100000, ...).
Is that possibile with NSNumberFormatter? I saw that it has a setFormat method but I don't know how much customizable it is.
I'm using NSNumberFormatter cause the graph object I use wants it to set label format and I want to avoid changing my data to set the label.
You can use this code:
let formatter = NSNumberFormatter()
formatter.multiplier = 0.001
formatter.positiveFormat = "#,###k"
formatter.zeroSymbol = "0"
return formatter
It helped me to convert the currency values:
2000 -> 2k
10000 -> 10k
No. The closest you can get is Scientific Notation. Have a look here for how to create a format for that. You could obviously quite easily do the k, M etc substitution yourself though.