number-formatting

JavaScript Chart.js - Custom data formatting to display on tooltip

喜欢而已 提交于 2019-11-28 17:11:21
I have looked at various documentation and similar questions on here, but cannot seem to find the particular solution. Apologies if I have missed anything obvious or have repeated this question! As a bit of background info, I have implemented 4 graphs using the Chart.js plugin and passed in the required data using PHP from a database. This is all working correctly and is fine. My problem is I need to display the data in the tooltips as formatted data aka. as numeric with %. As an example, one of my data from database is -0.17222. I have formatted it as a percentage to display in my table and

Format an Integer using Java String Format

落花浮王杯 提交于 2019-11-28 16:35:58
I am wondering if it is possible, using the String.format method in Java, to give an integer preceding zeros? For example: 1 would become 001 2 would become 002 ... 11 would become 011 12 would become 012 ... 526 would remain as 526 ...etc At the moment I have tried the following code: String imageName = "_%3d" + "_%s"; for( int i = 0; i < 1000; i++ ){ System.out.println( String.format( imageName, i, "foo" ) ); } Unfortunately, this precedes the number with 3 empty spaces. Is it possible to precede the number with zeros instead? Use %03d in the format specifier for the integer. The 0 means

Using Fractions On Websites

懵懂的女人 提交于 2019-11-28 14:46:33
Is it possible to use any fraction symbol on a website, represented as ¼ rather than 1/4 for example? From what I've gathered, these are the only ones I can use: ½ ⅓ ⅔ ¼ ¾ Is this right and why is that? The reason why I ask this is because I've done a Google web search and can't seem to locate any others ... eg. 2/4 mohammad mohsenipur You can test http://www.mathjax.org/ it is a JavasScript library to make a Math Formula if this is what you want. poitroae The image below displays all unicode-defined fraction symbols. Each of them is treated as one single character. You can use all of them

asp.net mvc set number format default decimal thousands separators

你离开我真会死。 提交于 2019-11-28 13:57:53
How can I set both default decimal and thousands separator for formatting number in asp.net mvc regardless of culture? You could create a DisplayTemplate that would handle how numbers like this are displayed in your views: /Views/Shared/DisplayTemplates/float.cshmtl : @model float @string.Format("{0:N2}", Model); and then you can call it like this from your views, if Amount was of type float : @Html.DisplayFor(m => m.Amount) To control the thousands separator you'll have to apply your changes to the NumberFormat for the current culture. If you want this to happen regardless of the current

how to Display data in matrix with with more than 4 decimals

蓝咒 提交于 2019-11-28 13:47:36
He, My question is about this matlab output: >>model3.Mu ans = 0.7677 -1.1755 -0.8956 -0.0100 0.0883 0.0235 0.0001 -0.0010 -0.0003 -0.0000 0.0000 0.0000 How to display this data in a 4x3 matrix with more than 4 decimals? type at the matlab prompt: >> help format I think what you want to do is issue the command "FORMAT LONG" before you execute your script. You can also print the matrix out to arbitrary precision using fprintf in a loop. 来源: https://stackoverflow.com/questions/2311520/how-to-display-data-in-matrix-with-with-more-than-4-decimals

Printing the digits of a number in reverse order

℡╲_俬逩灬. 提交于 2019-11-28 12:57:00
问题 Can someone please help me solve this? The number should be variable and not constant. The output should be: Timestamping In 6 Digit 8 5 6 3 0 1 Average In 6 Digit 9 8 7 6 5 2 class Timestamp1 extends Average1 { public static void main (String args[]) { int i = 103658; int j = 10; int k = i % j; System.out.println(" Timestamping In 6 Digit " ); System.out.println(" " + k); int o = 10365; int p = 10; int q = o % p; System.out.println(" " + q); int l = 1036; int m = 10; int n = l % m; System

How do I go from 1.4795e+004 to 14795.00?

孤街浪徒 提交于 2019-11-28 11:37:25
I have this problem that has been bothering me for quite a while.. I want to change the format of the number.. Don`t know how? Ive tried the help files but can't find the answer.. If you can help me please do.. gnovice There are three different things you could potentially be referring to when you talk about the "format" of a number: the display format, the variable storage format in memory (i.e. the data type/class), and the storage format in a data file. I'll address each... Display format: As already mentioned by Amro , the display format can be adjusted with the FORMAT command. However,

Formatting Complex Numbers

一曲冷凌霜 提交于 2019-11-28 10:50:41
For a project in one of my classes we have to output numbers up to five decimal places.It is possible that the output will be a complex number and I am unable to figure out how to output a complex number with five decimal places. For floats I know it is just: print "%0.5f"%variable_name Is there something similar for complex numbers? For questions like this, the Python documentation should be your first stop. Specifically, have a look at the section on string formatting . It lists all the string format codes; there isn't one for complex numbers. What you can do is format the real and imaginary

Format numbers to roman numerals?

戏子无情 提交于 2019-11-28 10:26:32
问题 Is it possible to use Format function to display integers in roman numerals? For Counter As Integer = 1 To 10 Literal1.Text &= Format(Counter, "???") Next 回答1: No, there is no standard formatter for that. If you read the Wikipedia on Roman numerals you'll find that there are multiple ways of formatting Roman Numerals. So you will have to write your own method our use the code of someone else. 回答2: This is what I found on http://www.source-code.biz/snippets/vbasic/7.htm (originally written by

Chart.js number format

余生颓废 提交于 2019-11-28 08:58:55
I went over the Chart.js documentation and did not find anything on number formatting ie) 1,000.02 from number format "#,###.00" I also did some basic tests and it seems charts do not accept non-numeric text for its values Has anyone found a way to get values formatted to have thousands separator and a fixed number of decimal places? I would like to have the axis values and values in the chart formatted. Yacine B There is no built-in functionality for number formatting in Javascript. I found the easiest solution to be the addCommas function on this page . Then you just have to modify your