vtkAxis - remove decimal points from axis notation - c++

I need to display the value of the axis without decimal points in a vtkChart.
eg- If I have values 2.31, 4.76, 7.39 etc.. I want to display them on the axis as 2, 5, 7. As integers and not as doubles or floats.
I tried using PRINTF_NOTATION on vtkAxis::SetNotation(int notation), but it would display a single decimal point.
Is there a way to achieve this in my chart using vtkAxis?
Any help would be appreciated. Thanks.

mululu's comment is correct. It should work with SetLabelFormat("%1.0f"),
but only with certain tick settings and notation according to the vtkAxis::SetLabelFormat documentation
Get/Set the printf-style format string used when TickLabelAlgorithm is
TICK_SIMPLE and Notation is PRINTF_NOTATION.
I tried the following and it worked for me. vtk 8.0 on windows:
axis->SetNotation( vtkAxis::PRINTF_NOTATION );
axis->SetTickLabelAlgorithm( vtkAxis::TICK_SIMPLE );
axis->SetLabelFormat("%1.0f");

Related

Strange number formating in ssas tabular?

I have a ssas tabular cube. I have a question regarding formatting here:
I have number 1,000,000,000.5
By using format: #,##0,.0
it gets displayed as: 1,000,000.5
I have 2 questions:
What's the logic? how is #,##0,.0 instructing to remove 000?
Also, i would like to get rid of the decimal, and show it like 1,000,000 How can I do it?
Commas before the decimal point that are not followed by # or 0 divide the result by 1000.
Whatever digits it shows will be rounded to that precision. If you want to drop the decimal rather than rounding, you can use TRUNC or INT in the measure definition.
If you use the following format #,### will give you the following.

GoogleVisualr How to Set its Axis format to N significant figures

I'm referring to this page
Google Documentation
And find that I can format my axis to following pattern:
{format: 'none'}: displays numbers with no formatting (e.g., 8000000)
{format: 'decimal'}: displays numbers with thousands separators (e.g., 8,000,000)
{format: 'scientific'}: displays numbers in scientific notation (e.g., 8e6)
{format: 'currency'}: displays numbers in the local currency (e.g., $8,000,000.00)
{format: 'percent'}: displays numbers as percentages (e.g., 800,000,000%)
{format: 'short'}: displays abbreviated numbers (e.g., 8M)
{format: 'long'}: displays numbers as full words (e.g., 8 million)
Can I format the axis to 4 significant figures?
say 0.000002345786 the axis display 0.000002346
and 0.0234567 display 0.02346
Is there a setting to achieve this?
Try this:
var formatter = new google.visualization.NumberFormat({pattern: '####'});
I haven't actually tested it, but the Google Visualization Docs linked this page which suggests this pattern should format to 4 significant digits.
I believe it would be easier if you format the numbers in Ruby instead before passing them to GoogleVisualr.
This is actually the main motivation of GoogleVisualr, because it allows you to do manipulation of the data in Ruby, which should be simpler.

What is SAS format 8.

I am new to SAS and currently working on a small piece of work with SAS.
Could I please ask what the below format means? I believe the 8. is formatting two digits to the right of the decimal place such as 896.33 but I am not sure. Not really sure what input means.
input(tablename.fieldname, 8.)
That is an INFORMAT, not a FORMAT. It means to read the first 8 characters as a number. If there is a decimal point in the data then it is used naturally. You could have up to 7 digits to the right of the decimal point (since the decimal point would use up the eighth character position). It will also support reading scientific notation so '896.33E2' would mean the number 89,633.

Remove decimal points in velocity template

I've written an Velocity email Template. The following Number Field is displaying with a decimal place.
Incident Level: $issue.getCustomFieldValue("customfield_11513") is showing to one decimal place e.g. 4.0
How can I format this number to remove the decimal place. e.g. Just 4 instead of 4.0?
Thanks for your help in advance.
Thanks
Santosh
If you always want an integer, you can use the standard Java method for transforming any Number to its integer value:
$issue.getCustomFieldValue("customfield_11513").intValue()

Incorrect conversion when decimal point embedded in VT_BSTR and German locale used

I have a piece of code(c++) that is writing some floating point values to excel like this:
...
values[ position ].bstrVal = formattedValue;
values[ position ].vt = VT_BSTR;
...
as you can see those floating point values are stored in the form of string and the decimal point is formatted in different ways, for example:
"110.000000", "20.11" etc. (this example is for English locale)
Now it works perfectly when English locale is used. However when I switch to German locale in the Control Panel the decimal point is changed to "," (and that's fine) but after passing those localized strings to Excel they are not correctly converted. For example in case of writing "110,000000" I'm getting 100 millions in excel. Other values like "20,11" stay as a text.
The only way to fix this is to overwrite the decimal point with "." in my program before writing to Excel. Any ideas why the conversion is not locale-aware when using VT_BSTR?
I should also add that I tried to switch the locale in my program from default one to German - still no luck.
Thank you in advance
It is never a good idea to let Excel guess at the value type. Do not use VT_BSTR, a currency value should be of variant type VT_CY. Assign the cyVal member with the value. It is an 8 byte integer value (int64 member of type LONGLONG), the currency amount multiplied by 10,000. Ten thousand :)