# Creating Gauge Visualization

**URL:** https://discuss.elastic.co/t/creating-gauge-visualization/122384
**Category:** Kibana
**Created:** [March 3, 2018, 6:59pm UTC](https://discuss.elastic.co/t/creating-gauge-visualization/122384 "2018-03-03T18:59:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![wwalker](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wwalker](https://discuss.elastic.co/u/wwalker)
#### Post date: [March 3, 2018, 6:59pm UTC](https://discuss.elastic.co/t/creating-gauge-visualization/122384/1 "2018-03-03T18:59:31Z")

</div>

I have a field that contains one of two values, pass or fail. I'd like to setup a gauge with the following math:

Total # of field occurrence / Total # field = pass

This should leave me with an integer between 0.0 to 1.0 which could then be expressed as a decimal. The upper bounds of the gauge would be the total count of the field with the amount of fill on the gauge being the count that matches pass. If that makes sense....

---

<div class="post-metadata">

### Author: ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)
#### Post date: [March 3, 2018, 8:09pm UTC](https://discuss.elastic.co/t/creating-gauge-visualization/122384/2 "2018-03-03T20:09:58Z")

</div>

Can you give a few examples documents in Elasticsearch so we can see what the structure and field values look like?

---

<div class="post-metadata">

### Author: ![wwalker](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wwalker](https://discuss.elastic.co/u/wwalker)
#### Post date: [March 3, 2018, 8:21pm UTC](https://discuss.elastic.co/t/creating-gauge-visualization/122384/3 "2018-03-03T20:21:59Z")

</div>

You mean something like this?? It's the email.spf\_evaluation field. It's going to be a string vaule of pass or fail.

```
{
  "_index": "dmarcxml-2018.03.62",
  "_type": "doc",
  "_id": "N-nn6mEBsGXTOKCBQqtC",
  "_version": 1,
  "_score": null,
  "_source": {
    "email.dmarc_action": [
      "none"
    ],
    "authresult.spf_result": [
      "pass"
    ],
    "report.start": [
      "1518220800"
    ],
    "report.org_contact": [
      "dmarc_support@corp.mail.ru"
    ],
    "policy.dmarc.subdomain_action": [
      "none"
    ],
    "policy.percentage": [
      "100"
    ],
    "@timestamp": "2018-03-03T08:07:59.247Z",
    "report.additional_contact": [
      "http://help.mail.ru/mail-help"
    ],
    "email.dkim_evaluation": [
      "fail"
    ],
    "email.count": [
      "1"
    ],
    "policy.dkim_mode": [
      "r"
    ],
    "report.org": [
      "Mail.Ru"
    ],
    "email.source_ip": [
      "192.168.1.1"
    ],
    "policy.domain": [
      "example.com"
    ],
    "policy.spf_mode": [
      "r"
    ],
    "authresult.spf_scope": [
      "mfrom"
    ],
    "path": "C:/DMARC/mail.ru!example.com!1518220800!1518307200.xml",
    "email.header_from": [
      "example.com"
    ],
    "report.id": [
      "37256247916566362691518220800"
    ],
    "authresult.spf_domain": [
      "example.com"
    ],
    "email.spf_evaluation": [
      "pass"
    ],
    "geoip": {
      "latitude": 37.4249,
      "dma_code": 807,
      "city_name": "Sunnyvale",
      "location": {
        "lat": 37.4249,
        "lon": -122.0074,
        "coordinates": "37.4249, -122.0074"
      },
      "country_name": "United States",
      "country_code3": "US",
      "region_code": "CA",
      "longitude": -122.0074,
      "region_name": "California",
      "continent_code": "NA",
      "ip": "192.168.1.1",
      "timezone": "America/Los_Angeles",
      "postal_code": "94089",
      "country_code2": "US"
    },
    "message": " <record>\r\n <row>\r\n <source_ip>192.168.1.1</source_ip>\r\n <count>1</count>\r\n <policy_evaluated>\r\n <disposition>none</disposition>\r\n <dkim>fail</dkim>\r\n <spf>pass</spf>\r\n </policy_evaluated>\r\n </row>\r\n <identifiers>\r\n <header_from>example.com</header_from>\r\n </identifiers>\r\n <auth_results>\r\n <spf>\r\n <domain>example.com</domain>\r\n <scope>mfrom</scope>\r\n <result>pass</result>\r\n </spf>\r\n </auth_results>\r\n <report_metadata>\r\n <org_name>Mail.Ru</org_name>\r\n <email>dmarc_support@corp.mail.ru</email>\r\n <extra_contact_info>http://help.mail.ru/mail-help</extra_contact_info>\r\n <report_id>37256247916566362691518220800</report_id>\r\n <date_range>\r\n <begin>1518220800</begin>\r\n <end>1518307200</end>\r\n </date_range>\r\n </report_metadata>\r\n <policy_published>\r\n <domain>example.com</domain>\r\n <adkim>r</adkim>\r\n <aspf>r</aspf>\r\n <p>none</p>\r\n <sp>none</sp>\r\n <pct>100</pct>\r\n </policy_published>\r\n </record>\r",
    "policy.dmarc.domain_action": [
      "none"
    ],
    "report.end": [
      "1518307200"
    ],
    "tags": [
      "multiline"
    ]
  },
  "fields": {
    "report.end": [
      "2018-02-11T00:00:00.000Z"
    ],
    "report.start": [
      "2018-02-10T00:00:00.000Z"
    ],
    "@timestamp": [
      "2018-03-03T08:07:59.247Z"
    ]
  },
  "sort": [
    1520064479247
  ]
}
```

---

<div class="post-metadata">

### Author: ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)
#### Post date: [March 4, 2018, 1:53am UTC](https://discuss.elastic.co/t/creating-gauge-visualization/122384/4 "2018-03-04T01:53:56Z")

</div>

Well, I'm really not sure here but sometimes I'm a little bit lucky from just exploring the screens and guessing.

Using TSVB, you can start with a `count` aggregation that gives a count for the number of documents in each time bucket. Then make another metric in the same series, and choose `Filter Ratio`. Numerator and Denominator are both filters, so your numerator will be `email.spf_evaluation:pass` and the denominator will be `*`.

In general, the way I use TSVB is to start with the Time Series chart and make sure my series are creating a shape of data over time that looks right. Then I would switch to Guage to see the "last" ratio bucket as a single metric.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/0/d0e3ec2ee0cf6a4e8b34d2f0837eed8d47a31c7a.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/4/740ecdd2af126ea7ba4abfcc4fb93c0096acbd97.png)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 1, 2018, 1:54am UTC](https://discuss.elastic.co/t/creating-gauge-visualization/122384/5 "2018-04-01T01:54:00Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
