Config
{
"$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: index1
body: {
"size": 17000,
"_source": ["@timestamp", "value1","value2","value3"],
"sort" : { "@timestamp" : "desc" }
},
}
format: { property: "hits.hits" },
transform: [
{ type: "formula",as: "time", expr: "datetime(datum._source['@timestamp']) "}
]
},
{
name:"table2"
url: {
%context%: true
%timefield%: @timestamp
index: index2
body: {
"size": 17000,
"_source": ["@timestamp", "value4"],
"sort" : { "@timestamp" : "desc" }
},
}
format: { property: "hits.hits" },
transform: [
{ type: "formula",as: "time2", expr: "datetime(datum._source['@timestamp']) "}
]
}
]
"scales": [
{
"name": "timex",
"type": "time",
"range": "width",
"domain": {"data": "table", "field": "time"}
},
{
"name": "Namet",
"type": "linear",
"range": "height",
"nice": true,
"zero": true,
"domain": {"data": "table", "field": "_source.value1"}
},
{
"name": "Namec",
"type": "linear",
"range": "height",
"nice": true,
"zero": true,
"domain": {"data": "table", "field": "_source.value2"}
},
{
"name": "Namevalue3",
"type": "linear",
"range": "height",
"nice": true,
"zero": true,
"domain": {"data": "table", "field": "_source.value3"}
},
{
"name": "NameValue4",
"type": "linear",
"range": "height",
"nice": true,
"zero": true,
"domain": {"data": "table2", "field": "_source.value4"}
}
],
"axes": [
{
"orient": "bottom",
"scale": "timex",
"format": "%s",
"grid":"true"},
{
"orient": "left",
"scale": "Namet",
"grid":"true"},
{
"orient": "left",
"scale": "Namec",
"offset": 30,
"domainColor": "#FF00FF",
"labelColor": "#FF00FF",
"tickColor": "#FF00FF",
"grid":"true"
},
{
"orient": "left",
"scale": "NameValue4",
"offset": 60,
"domainColor": "#CCCCCC",
"labelColor": "#CCCCCC",
"tickColor": "#CCCCCC",
"grid":"true"
},
{
"orient": "left",
"scale": "Namevalue3",
"offset": 90,
"domainColor": "#444444",
"labelColor": "#444444",
"tickColor": "#444444",
"grid":"true"
}
],
"marks": [
{
"type": "line",
"from": {"data": "table"},
"encode": {
"enter": {
"x": {"scale": "timex", "field": "time"},
"y": {"scale": "Namec", "field": "_source.value2"},
"stroke": {"value": "#FF00FF"}
}
}
},
{
"type": "line",
"from": {"data": "table"},
"encode": {
"enter": {
"x": {"scale": "timex", "field": "time"},
"y": {"scale": "Namet", "field": "_source.value1"}
}
}
},
{
"type": "line",
"from": {"data": "table2"},
"encode": {
"enter": {
"x": {"scale": "timex", "field": "time2"},
"y": {
"scale": "NameValue4",
"field": "_source.value4"
},
"stroke": {"value": "#CCCCCC"}
}
}
},
{
"type": "line",
"from": {"data": "table"},
"encode": {
"enter": {
"x": {"scale": "timex", "field": "time"},
"y": {
"scale": "Namevalue3", "field": "_source.value3"},
"stroke": {"value": "#444444"}
}
}
}
]
}
This is the scale in %s, seconds.
According to the scale i woud insert data in nanoseconds. But thats not the case:
Here you can see what the timescale should look like.