Show Zero Value in Line Chart

Is there a way to show zero values in line chart? One single point looks weird to me.
14%20PM

It would be great if we have things like this:
08%20PM

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

{
  "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
  }
}

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!

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:


which is different from what I want in the main thread.

Any suggestion?

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

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.

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