How it works...

Navigate to an account record page and enter the value 95 in the custom Credit Score number field. Upon saving, the account detail page displays the Credit Score Graphic image, as shown in the following screenshot:

Navigate to an account record page and enter the value 23 in the Credit Score number field. Upon saving, the account detail page displays the Credit Score Graphic image, as shown in the following screenshot:

Describing each part of the Google Chart code in the formula field gives the following:

/*********************************************************** 
Google Chart type Google-O-meter 
  
***********************************************************/ 
IF( 
  ISNUMBER( TEXT(Credit_Score__c) ),  
    IMAGE(  
      "https://chart.apis.google.com/chart?cht=gm" & 
      "&chxl=0:|0|50|100&chxt=y&chs=200x120&chls=2|10" &  
      "&chd=t:" & TEXT((Credit_Score__c)) & 
      "&chl=" & TEXT(Credit_Score__c), "Credit Score Graphic" 
    ), 
"Not Specified" 
) 

The comment section to describe the code in the formula is:

/*********************************************************** 
Google Chart type Google-O-meter 
  
***********************************************************/

Check that the Credit Score contains a number. If so, then continue to build the Google Chart code. If there is no valid number, then return the value Not Specified:

IF( 
  ISNUMBER( TEXT(Credit_Score__c) ),  
<.........................................> 
"Not Specified" 
) 

The Google Chart image construction is as follows:

    IMAGE(  
      "https://chart.apis.google.com/chart?cht=gm" & 
      "&chxl=0:|0|50|100&chxt=y&chs=200x120&chls=2|10" &  
      "&chd=t:" & TEXT((Credit_Score__c)) & 
      "&chl=" & TEXT(Credit_Score__c), "Credit Score Graphic" 
    ), 

Use the Google Chart URL https://chart.apis.google.com/chart?.
Specify the chart type gm (Google-O-Meter):

cht=gm 

Set the labels for the chart:

chxl=0:|0|50|100 

Specify using the y axis:

chxt=y 

Set the dimensions for the chart (width x height):

chs=200x120 

Specify the arrow line width and arrow head (2px line and small arrow head):

chls=2|10 

Set the data value passed to the graph (the data from the Credit Score field is passed):

chd=t:" & TEXT((Credit_Score__c)) 

Specify the data label on the chart (the data from the Credit Score field is passed):

chl=" & TEXT(Credit_Score__c)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset