Add leading '$' to google charts - google-visualization

I am working with Google Charts. I need to add a '$' before the values on the y-axis as well as the value in the bubbles.
Is there a setting for this?
take care,
lee
UPdate,
Here is the data being used by the charts:
'Month','Semi-Detached in Toronto E04','Semi-Detached in Toronto E08','Condominium Townhouse in Toronto E04','Condominium Townhouse in Toronto E08', ],
['7/2011', 4354000,15305800,6776500,495000],['8/2011', 700000,10514418,7060786,0],['9/2011', 6854800,17805400,12087300,0],['10/2011', 7287400,14248900,16206500,0],['11/2011', 2696245,9733270,12698090,0],['12/2011', 1965800,6054500,8854390,0],['1/2012', 2450968,9012200,5500100,0] ]);
I've tried adding '$' before the values as well as '%24' as suggested before, but both throw syntax errors. And the values cannot be quoted without throwing a Google Charts error '
Data column(s) for axis #0 cannot be of type string×'.
Thanks everyone for your input. I found a question that was 99.9% the same:
How to set tooltips to display percentages to match axis in Google Visualization Line Chart?

Try using %24 which is the urlencoded form for $.

Use:
var formatter = new google.visualization.NumberFormat({prefix: '$'});
Check the example here:
https://developers.google.com/chart/interactive/docs/examples#interaction_example
More details here:
https://developers.google.com/chart/interactive/docs/reference#numberformatter

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.

Getting value between '-' in google sheets

Im trying to get the number between '-' and '-' in google sheets but after trying many things I still havent been able to find the solution.
Data record 1
England Premier League
West Ham vs Crystal Palace
2.090 - 3.47 - 3.770
Expected value = 3.47
Data record 2
England League Two
Carlisle vs Scunthorpe
2.830 - 3.15 - 2.820
Expected value = 3.15
Hopefully someone can help me out
Try either of the following
option 1.
=INDEX(IFERROR(REGEXEXTRACT(AE1:AE4," \d+\.\d+ ")*1))
option 2.
=INDEX(IFERROR(REGEXEXTRACT(AE1:AE4,".* - (\d+\.\d+) ")))
(Do adjust the formula according to your ranges and locale)
use:
=INDEX(IFNA(REGEXEXTRACT(A1:A, "- (\d+(?:.\d+)?) -")*1))

Replace blanks with a string with DAX coding in Power BI

I have a data in Excel and I have uploaded in power bi, created a visualisation using a chart which looks like -
blank, CP, Jj10 are basically my y axis and dashes are my bars of horizontal chart. I have tried to show how my chart looks like because I don't get any other option
(Blank)-------------998
CP-----------56
Jj10--------44
0BN--------------77
Hi-po---2
Naas-------21
There is a column named performance (sheet_name=Empl_data) and what I want is to replace the blanks with Non-GT in power bi with creating a new column.
What my output should look like -
(Non-GT)-------------998
CP-----------56
Jj10--------44
0BN--------------77
Hi-po---2
Naas-------21
I have tried this -
Non-GT = IF(ISBLANK('Empl_data'[performance]),"Non-GT",'Empl_data'[performance])
What i get is
Non-GT----------------964
(Blank)-------------34
CP-----------56
Jj10--------44
0BN--------------77
Hi-po---2
Naas-------21
I just want to replace blanks with Non-TSG completely but still it shows blank. Please help me out to solve the problem and please let me know if I have made clear what my prblm is.
My data -
Empl_id
Empl_name
performance
99807
Somman paul
0076
Richards.M
8870
Maheen Josef.T
11209
Dojar Farah
6651
Macklegn Sagoe
Hi-po
551
Cada Farez
Jj10
12
Qwezy Goha
Hi-po
6567
Beheriop Produse
CP
2227
John semmers
0BN
656
Majeeio .f
80100
Drejju Yan
Is it actually Blank where it is showing nothing? First confirm there are spaces or really null in the data, then apply conditions as bellow-
Non-GT =
IF(
'Empl_data'[performance] = BLANK() || 'Empl_data'[performance] = "",
"Non-GT",
'Empl_data'[performance]
)
Q: Where you are transforming data with that condition? Power Query Editor? Or creating Measure or Calculated column?

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:

ColdFusion CFchart and feedback form

I am creating a feedback form system where users can fill in feedback forms and admin users will be able to run reports against the answers. I am trying to use cfchart to display the results in an easy to read manner for the administrators.
Here is my code:
&ltcfquery name="getFeedbackresults" datasource="#application.dsn#">
SELECT ff.feedbackFormId
,ff.feedbackFormName
,ff.feedbackFormDescription
,ff.activeFrom
,ff.activeTo
,ff.feedbackCountry
,ffq.question
,ffa.answer
,ffq.feedbackQuestionTypeId
,count(answer) AS distinctAnswer
FROM feedbackForm ff
,feedbackFormQuestion ffq
,feedbackFormInstance ffi
,feedbackFormAnswer ffa
WHERE ff.feedbackFormId = ffq.feedbackFormId
AND ff.feedbackFormId = ffi.feedbackFormId
AND ffi.feedbackFormInstanceId = ffa.feedbackFormInstanceId
AND ffa.feedbackQuestionId = ffq.feedbackQuestionId
AND ffq.feedbackQuestionTypeId not in (2,3)
GROUP BY ff.feedbackFormId, ff.feedbackFormName, ff.feedbackFormDescription, ff.feedbackCountry, ffq.question, ff.activeFrom, ffq.feedbackQuestionTypeId, ff.activeTo, ffa.answer
ORDER BY question
&lt/cfquery>
&ltcfoutput>
&lth2>#getFeedbackresults.feedbackFormName# Results&lt/h2>
&lth3>Description:
&ltp>#getFeedbackresults.feedbackFormDescription#&lt/p>
&ltul>
&ltli>&ltstrong>Active From: &lt/strong>#getFeedbackresults.activeFrom#&lt/li>
&ltli>&ltstrong>Active To: &lt/strong>#getFeedbackresults.activeTo#&lt/li>
&ltli>&ltstrong>Country: &lt/strong>#getFeedbackresults.feedbackCountry#&lt/li>
&lt/ul>
&lt/cfoutput>
&ltcfdump var="#getFeedbackresults#">
&ltcfchart format="flash" xaxistitle="Questions" yaxistitle="Answers" show3d="yes" chartheight="400" chartwidth="400">
&ltcfoutput query="getFeedbackresults" group="answer">
&ltcfchartseries type="bar" serieslabel="#answer#">
&ltcfchartdata item="#question#" value="#distinctAnswer#">
&lt/cfchartseries>
&lt/cfoutput>
&lt/cfchart>
The problem I am having is that the chart is displaying each list of answers in every series. I tried to upload an image but as I am a new user I'm not allowed. If anyone would like the image I can send it to them.
Any help would be greatfully appreciated.
You need to sort your query by the answer column if that's what you're going to group by. Your current ORDER BY is "question". Once you're sorting the same value that you're using for the group attribute on your cfoutput, you should be good to go.