Show property summary stats based on a filter

This is a test of planned function. This is Beta and not launched. Support for this function is limited.
There are 2 method shown here
1. Get summary stats based on a filter
2. Create a table of values

Summary Stats By Filter

These 3 sections show how the 4 summary stats (max price, min price, avg price and count of active) can be generated based on any filter.

1. City of Arvada, Detached Single Family

Min Price: $
Max Price: $
Avg Price: $
Detached Single Family Properties:

 

2. City of Arvada, Attached Single Family

Min Price: $
Max Price: $
Avg Price: $
Attached Single Family Properties:

 

3. City of Arvada, Land

Min Price: $
Max Price: $
Avg Price: $
Land Properties:

 

4. City of Arvada, Condos over $800,000

Min Price: $
Max Price: $
Avg Price: $
Number of Condos on the Market:

 

Summary Stats In A Table

These section shows a summary table of property type and various stats based on a filter.

5. Group Summary

[easyembed field=”jstable”]

[easyembed field=”js”]

How It’s Done

For the first 4 sections, JavaScript is used in each case to generate the values.
Values are displayed on the page using a span with a unique class that is referenced in the JavaScript:

<h3>1. City of Arvada, Detached Single Family</h3>
<div>Min Price: $<span class="price-min"></span></div>
<div>Max Price: $<span class="price-max"></span></div>
<div>Avg Price: $<span class="price-avg"></span></div>
<div>Detached Single Family Properties: <span class="props-ttl"></span></div>

Standard Widget Filters can create the precise analysis you seek.
Then use JavaScript to dynamically get values for each of the span class names values:

<script>var url = "https://www.mbb2.com/api/search/get-totals/auth_key/728iu4y49ru-7dbmdews11z/?filter=mls_id:demo+city:arvada+property_type:detsf";
mbbQuery.ajax({
 url: url.replace(/\+/g, "%2B"),
 success: function(response){
 mbbQuery(".price-min").html(MBBv3_PriceFormatter(response.data.price_min));
 mbbQuery(".price-max").html(MBBv3_PriceFormatter(response.data.price_max));
 mbbQuery(".price-avg").html(MBBv3_PriceFormatter(response.data.price_avg));
 mbbQuery(".props-ttl").html(response.data.num_props);
 }
});
</script>

In case 5 – Group Summary, JavaScript is used to generate the values and references a HTML table that is on the page.