# Vega lite calcule worning

**URL:** <https://discuss.elastic.co/t/vega-lite-calcule-worning/251460>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [October 8, 2020, 2:13pm UTC](https://discuss.elastic.co/t/vega-lite-calcule-worning/251460 "2020-10-08T14:13:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![suibgui](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@suibgui](https://discuss.elastic.co/u/suibgui)\
**Post date:** [October 8, 2020, 2:13pm UTC](https://discuss.elastic.co/t/vega-lite-calcule-worning/251460/1 "2020-10-08T14:13:49Z")

</div>

hello,  
i have a problem that many values are showing superposed in place of one value .the image represent the problème.  
this is my code vega:

```auto
{
  $schema: https://vega.github.io/schema/vega-lite/v2.json
  "autosize":
  {
    "type": "pad",
    "resize": false
  },
  "data":
  {
    "url": {
      "%context%": true,
      "index": "index"
      "body":
      {
        "aggs" : {
          "eqpt_buckets": {
            "composite" : {
              "size": 5000,
              "sources" :
              [
                {
                  "code_pays":
                  {"terms" :
                  {
                    "field": "code_pays.keyword"
                  }
                  }
                },
                {
                  "proposed_contacts_total":
                  {"terms" :
                  {
                    "field": "proposed_contacts_total"
                  }
                  }
                },
                {
                  "customers_total":
                  {"terms" :
                  {"field": "customers_total"
                  }
                  }
                }
              ]
            }
          }
        }
      }
    }
    "format": {property: "aggregations.eqpt_buckets.buckets"}

  },
  "transform":
  [
    {"filter": "datum.key.proposed_contacts_total >= 0"},
    {"calculate": "datum.key.code_pays",
      "as": "code_pays.keyword"
    },
    {"calculate": "datum.key.proposed_contacts_total",
      "as": "proposed_contacts_total"},
    {"calculate": "datum.key.customers_total",
      "as": "customers_total"},
    {
      "window": [{"op": "sum", "field": "proposed_contacts_total", "as": "num",}],
      "groupby": ["code_pays"],
    }
    {
      "window": [{"op": "sum", "field": "customers_total", "as": "denum"}],
      "groupby": ["code_pays"],

    }
    {"calculate": "datum.num/datum.denum * 100", "as": "result"},

  ],

  "mark": "bar",
  "encoding": {
    "x": {
      "field": "result",
      "title":"",
      "type":"quantitative",
      "scale":{"padding":10},

    }
    "y": {"field": "code_pays.keyword" , "type":"ordinal","title":""}
    "tooltip": {"field": "result", "type": "quantitative","format":".2f"}
  },

  "layer": [{
    "mark": "bar"
  },
    {
      "mark": {
        "type": "text",
        "align": "left",
        "xOffset": 0,
        "dx":3
        "aria": false
      },
      "encoding": {
        "text": {"field": "result", "type": "quantitative","format":".2f"}
      }
    }]
}

```

![vegeBug](https://us1.discourse-cdn.com/elastic/original/3X/6/3/63770c45464c414e924c208be57240211feaec95.png)

thank you for help.

---

<div class="post-metadata">

**Author:** ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)\
**Post date:** [October 14, 2020, 9:33am UTC](https://discuss.elastic.co/t/vega-lite-calcule-worning/251460/2 "2020-10-14T09:33:05Z")

</div>

Hi @suibgui  
I don't exactly understood what should be the resulting charts, could you please describe it a bit more to understand what you are looking for?

Unfortunately, this is a vega specific question and seems not directly related to Kibana (the rendering issue you are showing seems like a wrong calculation on the position of the labels, or a correct calculation but the text position overlaps) so I think the best place to ask is: [https://groups.google.com/forum/#!forum/vega-js](https://groups.google.com/forum/#!forum/vega-js) or [https://bit.ly/join-vega-slack-2020](https://bit.ly/join-vega-slack-2020)  
If you are going to post your question there, please remember that the `data` part is extended in Kibana to allow you query ES. If you want to post to these specific channels please first copy the returned data from your ES query and replace the `data.url` part with that JSON

---

<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:** [November 11, 2020, 9:33am UTC](https://discuss.elastic.co/t/vega-lite-calcule-worning/251460/3 "2020-11-11T09:33:07Z")

</div>

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