Vega lite calcule worning

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:

{
  $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

thank you for help.

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 or 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

1 Like

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