# Last value in Bar graph

**URL:** https://discuss.elastic.co/t/last-value-in-bar-graph/146523
**Category:** Kibana
**Created:** [August 29, 2018, 11:43am UTC](https://discuss.elastic.co/t/last-value-in-bar-graph/146523 "2018-08-29T11:43:24Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Marcos\_Dione](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@Marcos\_Dione](https://discuss.elastic.co/u/Marcos_Dione)
#### Post date: [August 29, 2018, 11:43am UTC](https://discuss.elastic.co/t/last-value-in-bar-graph/146523/1 "2018-08-29T11:43:24Z")

</div>

I want to have a bar graph with current values, but so far the best I can do is to use Average. The data being graphed is disk usage vs size spanning several disks and hosts.

A colleague suggested to try to sort by timestamp and take the top 1, but I'm already Bucketing the X axis by mount point and splitting the chart by host, and for some reason I can't do that anymore.

```
{
  "title": "Disk Used vs Total",
  "type": "histogram",
  "params": {
    "addLegend": true,
    "addTimeMarker": false,
    "addTooltip": false,
    "categoryAxes": [
      {
        "id": "CategoryAxis-1",
        "labels": {
          "show": true,
          "truncate": 100
        },
        "position": "bottom",
        "scale": {
          "type": "linear"
        },
        "show": true,
        "style": {},
        "title": {},
        "type": "category"
      }
    ],
    "grid": {
      "categoryLines": false,
      "style": {
        "color": "#eee"
      }
    },
    "legendPosition": "top",
    "seriesParams": [
      {
        "data": {
          "id": "1",
          "label": "Used"
        },
        "drawLinesBetweenPoints": true,
        "mode": "stacked",
        "show": "true",
        "showCircles": true,
        "type": "histogram",
        "valueAxis": "ValueAxis-1"
      },
      {
        "data": {
          "id": "3",
          "label": "Total"
        },
        "drawLinesBetweenPoints": true,
        "mode": "stacked",
        "show": true,
        "showCircles": true,
        "type": "histogram",
        "valueAxis": "ValueAxis-1"
      }
    ],
    "times": [],
    "type": "histogram",
    "valueAxes": [
      {
        "id": "ValueAxis-1",
        "labels": {
          "filter": false,
          "rotate": 0,
          "show": true,
          "truncate": 100
        },
        "name": "LeftAxis-1",
        "position": "left",
        "scale": {
          "mode": "normal",
          "type": "linear",
          "defaultYExtents": false
        },
        "show": true,
        "style": {},
        "title": {
          "text": "Average system.filesystem.used.bytes"
        },
        "type": "value"
      }
    ]
  },
  "aggs": [
    {
      "id": "1",
      "enabled": true,
      "type": "avg",
      "schema": "metric",
      "params": {
        "field": "system.filesystem.used.bytes",
        "customLabel": "Used"
      }
    },
    {
      "id": "3",
      "enabled": true,
      "type": "avg",
      "schema": "metric",
      "params": {
        "field": "system.filesystem.available",
        "customLabel": "Total"
      }
    },
    {
      "id": "4",
      "enabled": true,
      "type": "terms",
      "schema": "segment",
      "params": {
        "field": "system.filesystem.mount_point",
        "otherBucket": false,
        "otherBucketLabel": "Other",
        "missingBucket": false,
        "missingBucketLabel": "Missing",
        "size": 4,
        "order": "asc",
        "orderBy": "1"
      }
    },
    {
      "id": "5",
      "enabled": true,
      "type": "terms",
      "schema": "split",
      "params": {
        "field": "beat.hostname",
        "otherBucket": false,
        "otherBucketLabel": "Other",
        "missingBucket": false,
        "missingBucketLabel": "Missing",
        "size": 3,
        "order": "asc",
        "orderBy": "1",
        "row": false
      }
    }
  ]
}
```

---

<div class="post-metadata">

### Author: ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)
#### Post date: [August 30, 2018, 7:51pm UTC](https://discuss.elastic.co/t/last-value-in-bar-graph/146523/2 "2018-08-30T19:51:58Z")

</div>

@timroes / @ppisljar can we please get some help?

Thanks,  
Bhavya

---

<div class="post-metadata">

### Author: ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)
#### Post date: [August 31, 2018, 9:03am UTC](https://discuss.elastic.co/t/last-value-in-bar-graph/146523/3 "2018-08-31T09:03:39Z")

</div>

You could try to use the Top hits aggregation as a metric. there you can sort by timestamp and just take the average of the last x (in your case 1) documents.

If that's not working, there is currently no way in classical visualizations to visualize "individual" documents, which sounds a lot like what you are trying. In this case Vega visualizations are the only solution for you right now.

---

<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: [September 28, 2018, 9:03am UTC](https://discuss.elastic.co/t/last-value-in-bar-graph/146523/4 "2018-09-28T09:03:41Z")

</div>

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