# Data values about time graph kibana vega, vega-lite

**URL:** <https://discuss.elastic.co/t/data-values-about-time-graph-kibana-vega-vega-lite/272714>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [May 11, 2021, 3:06pm UTC](https://discuss.elastic.co/t/data-values-about-time-graph-kibana-vega-vega-lite/272714 "2021-05-11T15:06:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LombardoAndrea195](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lombardoandrea195/32/88080_2.png) [@LombardoAndrea195](https://discuss.elastic.co/u/LombardoAndrea195)\
**Post date:** [May 11, 2021, 3:06pm UTC](https://discuss.elastic.co/t/data-values-about-time-graph-kibana-vega-vega-lite/272714/1 "2021-05-11T15:06:06Z")

</div>

Hi all experts, I'm a beginner of this new techonolgy. I would like to use vega for display line graph that plot data values over time-series (timestamp). The goal is to represent how data values and not count of data change in the time. It's important that data is taken from the index and not imported as provided by vega library examples from json or csv. Thanks for the attention.  
Data is a float variable like ANGLE that is modified in time.  
below there's the starting point of the vega.  
(As suggested by elastic web page I modify the index from \_all to my\_index but I would like to represent data in the y axis not document\_count but a parametric field as Angle)  
P.s. the timefield selected is correct because I insert as date field @timestamp and it's worked.

````auto
{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "title": "Event counts from all indexes",
  "data": {
    "url": {
      "%context%": true,
      "%timefield%": "@timestamp",
      "index": "my_index",
      "body": {
        "aggs": {
          "time_buckets": {
            "date_histogram": {
              "field": "@timestamp",
              "interval": {"%autointerval%": true},
              "extended_bounds": {
                "min": {"%timefilter%": "min"},
                "max": {"%timefilter%": "max"}
              },
              "min_doc_count": 0
            }
          }
        },
        "size": 0
      }
    },
    "format": {"property": "aggregations.time_buckets.buckets"}
  },
  "mark": "line",
  "encoding": {
    "x": {"field": "key", "type": "temporal", "axis": {"title": false}},
    "y": {
      "field": "doc_count",
      "type": "quantitative",
      "axis": {"title": "Document count"}
    }
  },
}```
````

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [May 12, 2021, 4:19pm UTC](https://discuss.elastic.co/t/data-values-about-time-graph-kibana-vega-vega-lite/272714/2 "2021-05-12T16:19:04Z")

</div>

The start looks good, just use your data field in here:

```auto
  "y": {
      "field": "doc_count",
      "type": "quantitative",

```

instead of `doc_count`. that you should show you the values of the field. There might be some tuning to be done in the time\_buckets interval, but that depends on the usual interval between your events.

---

<div class="post-metadata">

**Author:** ![LombardoAndrea195](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lombardoandrea195/32/88080_2.png) [@LombardoAndrea195](https://discuss.elastic.co/u/LombardoAndrea195)\
**Post date:** [May 12, 2021, 5:43pm UTC](https://discuss.elastic.co/t/data-values-about-time-graph-kibana-vega-vega-lite/272714/3 "2021-05-12T17:43:27Z")

</div>

I've tryed but the system return an error like "infinite,infinite" so I belive the problem is the kind of aggregation that is not what I'm looking for because I want only to visualize data based on timestamp. So following a kibana tutorial on youtube I start testing query and then I've tryed to visualize data as a line.  
But I got different error I don't understand why due to the fact it's very similar to the lineguide follow. The range let us to retrive all documents  
Now system provide me this error:  
`url.%context% and url.%timefield% must not be used when url.body.query is set`

```auto

        {
     $schema: https: //vega.github.io/schema/vega-lite/v4.json
            mark: point
           data: {
          url: {
          %context%: true
          %timefield%: @timestamp
          index: _all
          body: {
        size: 10, 
        _source: ["@timestamp","ANGLE"],
        query:{
             bool: {
              must: [{
                exists: {
                   field: "ANGLE"
                 }
        
            }],
            filter: [{
                range: {
                  ANGLE: {
                      gte: 1,
                      lte: 49
                  }
                }
            }]
          }
        },
      },
    }
    format: { property: "hits.hits" }
      },
         encoding: {
         x: { field: "@timestamp", type: "temporal" }
         y: { field: "ANGLE", type: "quantitative" }
      }
    } 

```

---

<div class="post-metadata">

**Author:** ![LombardoAndrea195](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lombardoandrea195/32/88080_2.png) [@LombardoAndrea195](https://discuss.elastic.co/u/LombardoAndrea195)\
**Post date:** [May 12, 2021, 5:44pm UTC](https://discuss.elastic.co/t/data-values-about-time-graph-kibana-vega-vega-lite/272714/4 "2021-05-12T17:44:51Z")

</div>

If I remouve the url.content and timefield it provide me again the problem pf infinite defined above:  
Infinite extent for field "ANGLE": [Infinity, -Infinity]

---

<div class="post-metadata">

**Author:** ![LombardoAndrea195](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lombardoandrea195/32/88080_2.png) [@LombardoAndrea195](https://discuss.elastic.co/u/LombardoAndrea195)\
**Post date:** [May 12, 2021, 5:45pm UTC](https://discuss.elastic.co/t/data-values-about-time-graph-kibana-vega-vega-lite/272714/5 "2021-05-12T17:45:31Z")

</div>

[quote="LombardoAndrea195, post:4, topic:272714"]  
`Infinite extent for field "ANGLE": [Infinity, -Infinity] `

---

<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:** [June 9, 2021, 5:45pm UTC](https://discuss.elastic.co/t/data-values-about-time-graph-kibana-vega-vega-lite/272714/6 "2021-06-09T17:45:38Z")

</div>

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