The Equations feature in Mango lets you extract even more insight from your data by performing basic mathematical functions using attribute variables.

You can insert an equation in to the custom popup editor to add value to your map user’s experience, configure an interactive calculator popup, or include an equation in a query report.

In a Custom Popup, an equation can provide additional insights to the underlying attribute data.

For example, you have data for {total_population}, {workforce}, and {employed} in census tracts, and you want to report the unemployment rate for queried tracts.

As they are simply percentage equations, we can approach them in the same way we might perform an equation in Excel: foo / bar * 100

Percentage of total population in the workforce: #{ {workforce}/{total population}*100 }#

Percentage of people in the workforce who are employed: #{ {employed}/{workforce}*100 }#

Percentage of people in the workforce who are unemployed #{ 100-{employed}/{workforce}*100 }#


The following shows how you can use simple maths to round results to no or 2 decimal places without having to use multi-line functions.

In this example, we take the total of {males} and {totalpop} for the selected features:

{totpop:total}: 13395682, {males:total}: 6516054

And perform a basic equation to reveal the percentage:

Default (many decimal places)

#{ {males:total}/{totpop:total}*100; }#%

= 48.64294330068451%

Using the Math.round(x) function, we can tidy up long decimal numbers.

No decimal

#{ Math.round( {males:total}/{totpop:total}*100 ); }#%

= 49%

2 Decimal places

#{ Math.round( {males:total}/{totpop:total}*10000 )/100; }#%

= 48.64%

Javascript Math function reference

Math.abs(a) the absolute value of a
Math.acos(a) arc cosine of a
Math.asin(a) arc sine of a
Math.atan(a) arc tangent of a
Math.atan2(a,b) arc tangent of a/b
Math.ceil(a) integer closest to a and not less than a
Math.cos(a) cosine of a
Math.exp(a) exponent of a (Math.E to the power a)
Math.floor(a) integer closest to a, not greater than a
Math.log(a) log of a base e
Math.max(a,b) the maximum of a and b
Math.min(a,b) the minimum of a and b
Math.pow(a,b) a to the power b
Math.random() pseudorandom number 0 to 1
Math.round(a) integer closest to a
Math.round(10*X)/10; round X to tenths
Math.round(100*X)/100; round X to hundredths
Math.round(1000*X)/1000; round X to thousandths
Math.sin(a) sine of a
Math.sqrt(a) square root of a
Math.tan(a) tangent of a

Need more help with this?
✉ Email the Mango support team

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.