ECharts - Formatter removing the commas from numbers - is there a way to bypass it without js? - echarts

I have a pie chart with labels that show both titles and values thanks to formatter.
The values are with commas (ex. 12,349) at the source, but the formatter gets rid of the commas and displays values without them (ex. 12349).
The formatter at the moment:
"formatter": "{b} \n ({#[1]})"
As I have some bigger numbers there, without commas they are difficult to read.
Is there a simple way to keep the commas in the values without using javascript?

Related

Set global thousands separator for echarts

I am using apache echarts and I want to specify globally what the thousands separator should be.
By default it is a comma: ie I put in a number of 5000 and what is shown is formatted as 5,000.
I would like to specify different separator globally, or have it formatted automatically based on users locale is that possible?
As far as I know, it's impossible to set delimiter globally but Echarts already have API for format almost any value. If you need change value in tooltip use formatter, it's component attribute with callback support. You can define callback and modify any tooltip data.

Google Sheets float numbers in .csv becoming dates in .xls

Google Sheets currently does something rather obnoxious if you type a number such as 15.5 into a cell - it converts the number into 15/05/2020
I have a sheet file with lots of prices filled in, but every now and then I see these dates pop up... I can't do arithmetics with those dates, and using the "format" command to turn them into money numbers yields crazy stuff, 43.966,00 for example (from the number above)
Is there a workaround for this?
tl;dr - I need the floating point numbers which resemble dates to not become dates when inserted into a cell.
edit:
I didn't include all the information at first, so here we go:
The issue is not only typing in values, I'm actually reading a .csv file and inserting it into sheets via python's pydrive.
The workaround must not be something manual, I'd like my numbers to "show up" correctly in sheets without further manipulating the file.
In Brasil sheets (because of Portuguese i assume) the comma is used as the decimal, not the period. So instead of writing 15.5 you need to write your numbers like 15,5
You can change that by changing the locale of the sheet to somewhere that uses traditional decimal points.

Google Sheets - Concatenate NOW-1, slash, and NOW+120

In Google Sheets, I need to create a date in the following format:
2016-06-15T12:00-0800/2016-10-16T12:00-0800
(Yesterday's date / today's date + 120 days)
Using =NOW()-1, I get yesterday's date.
Using Format - Date - More - Year(1930)-Month(05)-Day(01)T:Hour(01):00-0800, I get the proper format for the 1st part of the date range (2016-06-15T12:00-0800).
Repeating the same process with =NOW()+120.
Got the 2nd part of the date range (2016-10-16T12:00-0800).
PROBLEM: Trying to =CONCATENATE(A2,"/",B2), results in this:
42901.6965777315/43022.6965777315
...and no matter what I do - change the format, try to use =CONCATENATE(=TEXT(A2),"/",=TEXT(B2)), or other tricks I know, I either get a blank cell, an error message, or an even worse mess.
All I want is to combine 2 date cells into 1, with a slash in between. How can this be accomplished?
Try join instead of concatenate:
=join("/",A1,B1)
Maybe:
=text(now()-1,"yyyy-mm-ddThh:mm")&"-0800/"&text(now()+120,"yyyy-mm-ddThh:mm")&"-0800"
TEXT with only a date as argument returns the serial number corresponding to that date,
First you should confer the result of you formulas that involves NOW to a formatted text by using TEXT with the second argument. Then you could concatenate the result of that.
The above be donde on a single formula but you maybe should start by doing each step on separate cells in order to make it easy to check the result of each part.

Finding the format of arbitrary delimited text file in MATLAB

I have a file that looks like this in notepad++
I can easily see the spaces (being the orange dots), and tabs (being the orange arrows). I can also right click this in MATLAB and import it in a variety of ways. The problem is firstly the delimiters are not consistent. It seems to go TAB then some spaces to make sure the total field equals 6 characters...
The only way I understand reading a file in is if you already know how it is delimited. But in this case I would like to parse each line so MATLAB has some 'token' of what goes where eg:
Line1: Text Space Text Space Text Tab Space Space Text NEWLINE
(Notepad++ seems to know just fine so surely MATLAB can get this info too?).
Is this possible? Then it would be nice to use this information to save the imported data back out to a file with exactly the same formatting.
The data is below. For some reason copying this into notepad++ does not preserve its delimiting, you will need to add the tabs in yourself so it looks like the file in the screenshot.
Average Counts : 56.2
Time : 120
Thanks
If you use textscan, the default behaviour should probably suit your needs:
Within each row of data, the default field delimiter is white space. White space can be any combination of space (' '), backspace ('\b'), or tab ('\t') characters. If you do not specify a delimiter, textscan interprets repeated white-space characters as a single delimiter.
The output is a cell array, where each column is saved as a cell. So C{1} would contain the strings, C{2} the colons, and C{2} the values.

Inputing '\' before a character in a string Matlab

I'm trying to insert a '\' into a string array before each '_' in the string. The reason I am trying to do this is to keep the format of the sheetnames I pull from an xls file when i use the sheetnames in the legend of a plot. I tried using:
legend(sheetname{n},'Interpreter','none','Location','East')
but it just adds the two commands as two other labels in the legend. Hense this solution. I have looked into searching through sheetnames and have found how to replace, but I don't want to replace the characters if possible. If there is a way to do this please let me know.
Try this instead:
legend(sheetname(n),'Interpreter','none','Location','East');
Note the use of parentheses instead of curly braces, which passes a cell to LEGEND instead of the contents of the cell (i.e. cell indexing instead of content indexing). This should allow the additional parameter/value pairs to be properly interpreted.
If you want to apply a string replacement function on each cell element, you can do this as follows:
cellfun(#(x) strrep(x,'_','\_'),sheetname,'uniformoutput',false)
this applies strrep(x,'_','\_') to all elements of sheetnames and outputs it as a new cell array (because of 'uniformoutput',false).