The same problem occurs with different data. When I zoomed out it looks like everything is correct and the time fits but when the timescale is smaller the same error appears.
{
"$schema": "https://vega.github.io/schema/vega/v4.3.json",
"description": "A basic line chart example.",
"padding": 5,
data: [
{
name:"table"
url: {
%context%: true
%timefield%: @timestamp
index: elasticoffee
body: {
"size": 10000,
"_source": ["@timestamp", "quadId"],
"sort" : { "@timestamp" : "desc" }
},
}
format: { property: "hits.hits" },
transform: [
{ type: "formula",as: "time", expr: "datetime(datum._source['@timestamp'])"}
]
}
],
"scales": [
{
"name": "timex",
"type": "time",
"range": "width",
"domain": {"data": "table", "field": "time"}
},
{
"name": "NameBeverage",
"type": "linear",
"range": "height",
"nice": true,
"zero": true,
"domain": {"data": "table", "field": "_source.quadId"}
}
],
"axes": [
{
"orient": "bottom",
"scale": "timex",
"format": "%d %H:%m",
"grid":"true"
},
{
"orient": "left",
"scale": "NameBeverage",
"grid":"true"},
],
"marks": [
{
"type": "line",
"from": {"data": "table"},
"encode": {
"enter": {
"x": {"scale": "timex", "field": "time"},
"y": {"scale": "NameBeverage", "field": "_source.quadId"},
"stroke": {"value": "#FF00FF"},
"strokeWidth": "1"
}
}
}
]
}
The used data was from Elastic Coffee and looks something like this:
POST _bulk
{ "index" : { "_index" : "elasticoffee", "_type" : "doc", "_id" : "5005" } }
{"sceneID": "2", "sceneData": "0", "entityID": "zwave.quad2", "quadId": 15, "quadMod": "1", "@timestamp": "2018-08-30T08:26:39Z", "beverageClass": "Hot Beverages", "beverage": "Latte", "beverageSide": "left", "beverageIndex": 5, "quantity": 1}
I used quadId for my testing purpose. I am clueless why this time shift happens. May best guess is that is has something to do with the transform function, its the only thing that can manipulate the time.

