# Kibana Vega-lite xOffset is not a valid encoding channel

**URL:** <https://discuss.elastic.co/t/kibana-vega-lite-xoffset-is-not-a-valid-encoding-channel/292178>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [December 16, 2021, 4:02pm UTC](https://discuss.elastic.co/t/kibana-vega-lite-xoffset-is-not-a-valid-encoding-channel/292178 "2021-12-16T16:02:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliana\_cg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juliana_cg/32/99127_2.png) [@juliana\_cg](https://discuss.elastic.co/u/juliana_cg)\
**Post date:** [December 16, 2021, 4:02pm UTC](https://discuss.elastic.co/t/kibana-vega-lite-xoffset-is-not-a-valid-encoding-channel/292178/1 "2021-12-16T16:02:05Z")

</div>

Hello, i've been trying to create a grouped bar chart in kibana with vega lite, as shown in this [example](https://vega.github.io/vega-lite/examples/bar_grouped_repeated.html), but i always get a warning "xOffset-encoding is dropped as xOffset is not a valid encoding channel". As a result, i don't get to group the bars.

 ![vega-lite-warn](https://us1.discourse-cdn.com/elastic/original/3X/d/e/de023a262e1aa2c790bb6413f047bebe5e247f3e.png)

The exemple works fine in the vega editor so i'm wondering if this could be a Kibana issue or if there's there's something i am missing. I share my spec.

```auto
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "title": "Test",
  "data": {
    "format": {
      "property": "aggregations.users_per_day.buckets"
    },
    "url": {
      "index": "test-*",
      "body": {
        "size": 0,
        "aggs": {
          "users_per_day": {
            "date_histogram": {
              "field": "@timestamp",
              "calendar_interval": "day",
              "extended_bounds": {
                "min": 1637539200000,
                "max": 1638144000000
              },
              "min_doc_count": 0
            },
            "aggs": {
              "distinct_users": {
                "cardinality": {
                  "field": "identifier"
                }
              },
              "total_new_users": {
                "cumulative_cardinality": {
                  "buckets_path": "distinct_users"
                }
              },
              "incremental_new_users": {
                "derivative": {
                  "buckets_path": "total_new_users"
                }
              }
            }
          }
        },
        "query": {
          "bool": {
            "must": [
              {
                "range": {
                  "@timestamp": {
                    "gte": "2021-11-22T00:00:00.000Z",
                    "lte": "2021-11-29T00:00:00.000Z",
                    "format": "strict_date_optional_time"
                  }
                }
              }
            ],
            "filter": [],
            "should": [],
            "must_not": []
          }
        }
      }
    },
    "values": {
      "took": 5,
      "timed_out": false,
      "_shards": {
        "total": 56,
        "successful": 56,
        "skipped": 49,
        "failed": 0
      },
      "hits": {
        "total": 170,
        "max_score": null,
        "hits": []
      },
      "aggregations": {
        "users_per_day": {
          "buckets": [
            {
              "key_as_string": "2021-11-22T00:00:00.000Z",
              "key": 1637539200000,
              "doc_count": 5,
              "distinct_users": {
                "value": 3
              },
              "total_new_users": {
                "value": 3
              }
            },
            {
              "key_as_string": "2021-11-23T00:00:00.000Z",
              "key": 1637625600000,
              "doc_count": 17,
              "distinct_users": {
                "value": 1
              },
              "total_new_users": {
                "value": 3
              },
              "incremental_new_users": {
                "value": 0
              }
            },
            {
              "key_as_string": "2021-11-24T00:00:00.000Z",
              "key": 1637712000000,
              "doc_count": 32,
              "distinct_users": {
                "value": 2
              },
              "total_new_users": {
                "value": 3
              },
              "incremental_new_users": {
                "value": 0
              }
            },
            {
              "key_as_string": "2021-11-25T00:00:00.000Z",
              "key": 1637798400000,
              "doc_count": 31,
              "distinct_users": {
                "value": 2
              },
              "total_new_users": {
                "value": 3
              },
              "incremental_new_users": {
                "value": 0
              }
            },
            {
              "key_as_string": "2021-11-26T00:00:00.000Z",
              "key": 1637884800000,
              "doc_count": 40,
              "distinct_users": {
                "value": 5
              },
              "total_new_users": {
                "value": 6
              },
              "incremental_new_users": {
                "value": 3
              }
            },
            {
              "key_as_string": "2021-11-27T00:00:00.000Z",
              "key": 1637971200000,
              "doc_count": 30,
              "distinct_users": {
                "value": 2
              },
              "total_new_users": {
                "value": 6
              },
              "incremental_new_users": {
                "value": 0
              }
            },
            {
              "key_as_string": "2021-11-28T00:00:00.000Z",
              "key": 1638057600000,
              "doc_count": 15,
              "distinct_users": {
                "value": 2
              },
              "total_new_users": {
                "value": 6
              },
              "incremental_new_users": {
                "value": 0
              }
            },
            {
              "key_as_string": "2021-11-29T00:00:00.000Z",
              "key": 1638144000000,
              "doc_count": 0,
              "distinct_users": {
                "value": 0
              },
              "total_new_users": {
                "value": 6
              },
              "incremental_new_users": {
                "value": null
              }
            }
          ]
        }
      }
    }
  },
  "repeat": {
    "layer": [
      "distinct_users.value",
      "total_new_users.value",
      "incremental_new_users.value"
    ]
  },
  "spec": {
    "mark": "bar",
    "encoding": {
      "x": {
        "field": "key",
        "type": "nominal",
        "timeUnit": "monthdate",
        "axis": {
          "title": "Date"
        }
      },
      "y": {
        "field": {
          "repeat": "layer"
        },
        "type": "quantitative",
        "axis": {
          "title": "Number of users"
        }
      },
      "color": {
        "datum": {
          "repeat": "layer"
        },
        "type": "nominal"
      },
      "xOffset": {
        "datum": {
          "repeat": "layer"
        }
      }
    }
  },
  "config": {
    "range": {
      "category": {
        "scheme": "elastic"
      }
    },
    "mark": {
      "color": "#54B399"
    },
    "title": {
      "color": "#343741"
    },
    "style": {
      "guide-label": {
        "fill": "#69707d"
      },
      "guide-title": {
        "fill": "#343741"
      },
      "group-title": {
        "fill": "#343741"
      },
      "group-subtitle": {
        "fill": "#343741"
      }
    },
    "axis": {
      "tickColor": "#eef0f3",
      "domainColor": "#eef0f3",
      "gridColor": "#eef0f3"
    },
    "background": "transparent"
  },
  "width": "container",
  "height": "container",
  "autosize": {
    "type": "fit",
    "contains": "padding"
  }
}

```

---

<div class="post-metadata">

**Author:** ![kaiz123](https://avatars.discourse-cdn.com/v4/letter/k/7ab992/32.png) [@kaiz123](https://discuss.elastic.co/u/kaiz123)\
**Post date:** [January 7, 2022, 10:02pm UTC](https://discuss.elastic.co/t/kibana-vega-lite-xoffset-is-not-a-valid-encoding-channel/292178/2 "2022-01-07T22:02:28Z")

</div>

you need vega vesion 5 for this feature and is not available before

---

<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:** [February 4, 2022, 10:02pm UTC](https://discuss.elastic.co/t/kibana-vega-lite-xoffset-is-not-a-valid-encoding-channel/292178/3 "2022-02-04T22:02:31Z")

</div>

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