Format or Pattern for Decimal Numbers to display on axis on google charts - google-visualization

Good Morning,
When ever we create data table with certain data for Column Chart i.e.
**['Year', '% of ToTal Revenues ', '% of Total orders'],
['Feb12-July12', 0.25, 0.36],
['Aug12-Jan12', 0.58, 0.69],
['Feb13-July14', 0.47, 0.14],
['Aug13-Jan14', 0.62, 0.84]**
in the out put especially on VAxis the graph was displaying 0.1 to 0.98..
but when i a want to append % symbol to the given input values like 0.01%,0.02%,to 0.98% it was converting decimal into natural numbers that for ex 0.65 into 65 so what type of pattern i have to pass forex VAxis:{format:'#.##%'}};
Please Help Me
Thanks in advance

If I undestood right, you want to keep it as decimals instead of 0.5 = 50%. This should do the trick:
vAxis:{format: '#.#\'%\'' }

Related

Hour:Minute format on an APEX chart is not possible

I use Oracle APEX (v22.1) and on a page I created a (line) chart, but I have the following problem for the visualization of the graphic:
On the y-axis it is not possible to show the values in the format 'hh:mi' and I need a help for this.
Details for the axis:
x-axis: A date column represented as a string: to_char(time2, 'YYYY-MM')
y-axis: Two date columns and the average of the difference will be calculated: AVG(time2 - time1); the date time2 is the same as the date in the x-axis.
So I have the following SQL query for the visualization of the series:
SELECT DISTINCT to_char(time2, 'YYYY-MM') AS YEAR_MONTH --x-axis,
AVG(time2 - time1) AS AVERAGE_VALUE --y-axis
FROM users
GROUP BY to_char(time2, 'YYYY-MM')
ORDER BY to_char(time2, 'YYYY-MM')
I have another problem to solve it in another way: I am not familiar with JavaScript, if the solution is only possible in this way. Because I started new with APEX, but I have seen in different tutorials that you can use JS. So, when JS is the only solution, I would be happy to get a short description what I must do on the page.
(I don't know if this point is important for this case: The values time1 and time2 are updated daily.)
On the attributes of the chart I enabled the 'Time Axis Type' under Settings
On the y-axis I change the format to "Time - Short" and I tried with different pattern like ##:## but in this case you see for every value and also on the y-axis the value '01:00' although the line chart was represented in the right way. But when I change the format to Decimal the values are shown correct as the line chart.
I also tried it with the EXTRACT function for the value like 'EXTRACT(HOUR FROM AVG(time2 - time1))|| ':' || EXTRACT(MINUTE FROM AVG(time2 - time1))' but in this case I get an error message
So where is my mistake or is it more difficult to solve this?
ROUND(TRUNC(avg(time2 - time1)/60) + mod(avg(time2 - time1),60)/100, 2) AS Y
will get close to what you want, you can set Y Axis minimum 0 maximum 24
then 12.23 means 12 hour and 23 minutes.

Is there a way to show an exponent as a superscript when outputing as string?

I'm creating a plot using PGplot. When creating the title of the graph, the function (math function not c++ function) has an exponent in it, is there anyway to show the function as a proper exponent (superscript) and not just using "^".
Title of plot currently: y(t) = 1 - e^(-at)
String within source code for the title: cpglab("t", "y", "y(t) = 1 - e^(-at)");
The first 2 arguments within cpglab() are the x and y-axis title, by the way.

Can't get Google Charts Axis to format in decimal

I am trying to set an option for a specific graph in the decimal form. I went through many questions, but I can't seem to figure out why it isn't working for me.
var temp_chart_options = {
title: 'Temperature',
hAxis: {title: 'Date', titleTextStyle: {color: '#262626'}, format:'decimal' },
vAxis: {minValue: 0, format: 'decimal'},
keepInBounds: true,
};
temp_chart.draw(temp_data, temp_chart_options);
I tried doing format: 'decimal', or format: { pattern: 'decimal' } and even did temp_chart.draw(data, google.charts.Line.convertOptions(temp_chart_options)); and even looked at these questions:
google chart vertical axis and tooltip value formatting
Google Chart Vertical Axis and Tooltip Value Formatting
How to format numbers in Google API Linechart?
But none of them seem to work :(
EDIT
Does anyone know how to change the format of the hover?
The format parameter on your vertical axis needs to specify a proper format pattern. For example, vaxis: {format:'0.00'} will give you a number with two decimal places after it.
Note that Google's documentation is very incomplete about this. They give an example using the presets, and an example of using separators (e.g. '#,###'), but there is no example showing decimal places, nor is there any complete documentation on number format specifiers that I could find. Perhaps it is documented elsewhere, but the page I linked to above ought to at least provide a link to it if so. It does not. I discovered the 0.00 format by experimentation.
As an addition to the accepted answer, I needed to do a currency in GBP with 1000's separators and 2 decimal places.
The given Google 'currency' was unsuitable as it renders the currency symbol in your local currency.
I came up with this:
format: '£#,###.##'
Which could theoretically be used with any currency symbol.
This was the result:

Display percent symbol[%] in Y axis value in google chart

Can anyone help to get the percent symbol[%] in Y axis value.
I have attched png. in that in y axis 0 t0 18 values are there I want to see it as 0% to 18%.
http://i.stack.imgur.com/pF6U0.png
You need to format in two places: the data and the axis. To format the data, use a NumberFormatter:
var formatter = new google.visualization.NumberFormat({pattern: '#%'});
// format column 1 of the DataTable
formatter.format(data, 1);
Format the axis values, via the vAxis.format option:
vAxis: {
format: '#%'
}
No need of the google.visualization line, just the next line is needed:
vAxis: {
format: "#'%'"
}
Explanation:
The difference is the double quotes and simple quote. format property follows ICU pattern (as per GChart specs) that is used for formatting. When the simple quotes are not used, the presence of % multiplies x100 the value per the ICU specs. So by adding the simple quotes, the % is kind of escaped (more info)

understanding precision and scale on a property

property name="poiLat" length="60" ormtype="big_decimal" persistent=true precision="16" scale="14" default="0" hint="";
I don't understand precision or scale correctly. Using the property above why would '1' give an error and '2' be accepted? what should I change it to to accept '1'
1 ) -118.27 = error
2) -18.27 = ok
Scale refers the number of digits to the right of the decimal place. If you have precision 16 and scale 14, you can only have 2 digits to the left of the decimal place, so
18.12345678901234 = ok
118.27 = error
Try:
precision="16" scale="13"
That will allow 118.1234567890123, but that is a lot of decimal places. How many do you really need?
precision="16" scale="4"
Will allow 123456789012.1234