# Show Zero Value in Line Chart

**URL:** <https://discuss.elastic.co/t/show-zero-value-in-line-chart/141263>\
**Category:** Kibana\
**Created:** [July 23, 2018, 10:50pm UTC](https://discuss.elastic.co/t/show-zero-value-in-line-chart/141263 "2018-07-23T22:50:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naruhodou](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@Naruhodou](https://discuss.elastic.co/u/Naruhodou)\
**Post date:** [July 23, 2018, 10:50pm UTC](https://discuss.elastic.co/t/show-zero-value-in-line-chart/141263/1 "2018-07-23T22:50:30Z")

</div>

Is there a way to show zero values in line chart? One single point looks weird to me.  
 ![14%20PM](https://us1.discourse-cdn.com/elastic/original/3X/1/6/16a68436f642c4e4ab6ddc1bb51af9f93d18a7ef.png)

It would be great if we have things like this:  
 ![08%20PM](https://us1.discourse-cdn.com/elastic/original/3X/0/f/0fa9f62c8ccfaec36aa80212a6bdc43385370ac6.png)

I use a date histogram aggregation for X-axis and a term aggregation as the sub-bucket.  
The query for the visualization is:

```auto
{
  "size": 0,
  "_source": {
    "excludes": []
  },
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "@datetime",
        "interval": "12h",
        "time_zone": "America/Los_Angeles",
        "min_doc_count": 1
      },
      "aggs": {
        "3": {
          "terms": {
            "field": "beat.hostname.keyword",
            "size": 5,
            "order": {
              "_count": "desc"
            }
          }
        }
      }
    }
  },
  "version": true,
  "stored_fields": [
    "*"
  ],
  "script_fields": {},
  "docvalue_fields": [
    "@datetime",
    "@timestamp"
  ],
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "\"Itec.zkclient.exception.ZkException\" OR \"Itec.zkclient.exception.ZkTimeoutException\"",
            "analyze_wildcard": true,
            "default_field": "*"
          }
        },
        {
          "match_all": {}
        },
        {
          "range": {
            "@datetime": {
              "gte": 1529794790328,
              "lte": 1532386790328,
              "format": "epoch_millis"
            }
          }
        }
      ],
      "filter": [],
      "should": [],
      "must_not": []
    }
  },
  "highlight": {
    "pre_tags": [
      "@kibana-highlighted-field@"
    ],
    "post_tags": [
      "@/kibana-highlighted-field@"
    ],
    "fields": {
      "*": {}
    },
    "fragment_size": 2147483647
  }
}

```

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [July 24, 2018, 9:50pm UTC](https://discuss.elastic.co/t/show-zero-value-in-line-chart/141263/2 "2018-07-24T21:50:27Z")

</div>

If you expand the "advanced" portion of your bucket aggregation, you should be able to add the following to get what you want: `{"min_doc_count": 0}`

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Naruhodou](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@Naruhodou](https://discuss.elastic.co/u/Naruhodou)\
**Post date:** [July 24, 2018, 10:06pm UTC](https://discuss.elastic.co/t/show-zero-value-in-line-chart/141263/3 "2018-07-24T22:06:39Z")

</div>

Hi Lukas,

Thanks for the advice! I add {"min\_doc\_count": 0} in "JSON input" field in my aggregation bucket. It begins to show some zero points(adding new labels) but no line, just like this:

 ![49%20PM](https://us1.discourse-cdn.com/elastic/original/3X/0/4/04c904626676adc9c4eb9395b46c1cd951647da5.png)  
which is different from what I want in the main thread.

Any suggestion?

---

<div class="post-metadata">

**Author:** ![Naruhodou](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@Naruhodou](https://discuss.elastic.co/u/Naruhodou)\
**Post date:** [July 25, 2018, 10:45pm UTC](https://discuss.elastic.co/t/show-zero-value-in-line-chart/141263/4 "2018-07-25T22:45:42Z")

</div>

Hi Lukas,

I found the problem. When I add {"min\_doc\_count": 0}, it only shows zero points between non-zero points, like this:  
 ![13%20PM](https://us1.discourse-cdn.com/elastic/original/3X/6/d/6dcbeb0b3c05bd1526e7d58dc079bd45784f22c1.png)

Any way to make it show zero points after 2018-07-06?

The previous screenshot comes from Kibana 6.3.0. But your solution works when I use 4.8.

 ![38%20PM](https://us1.discourse-cdn.com/elastic/original/3X/7/d/7dcb985a8efe6b31ada73d275bba9e167b99f899.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:** [August 22, 2018, 10:45pm UTC](https://discuss.elastic.co/t/show-zero-value-in-line-chart/141263/5 "2018-08-22T22:45:47Z")

</div>

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