{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A basic bar chart example, with value labels shown upon mouse hover.",
"signals": [{
"name": "timeunit", "value": ["day"],
"bind": {"input": "select", "options": [
["month"], ["date"], ["day"], ["hours"]
]}}],
"data": [
{
"name": "flights",
url: {
index: samptuint
body: {
_source: ["date", "ticket", "priority", "inc_num", "status"]
}
}
format: { property: "hits.hits" }
"transform": [
{
"type": "timeunit",
"field": "date",
"units": {"signal": "timeunit"},
"signal": "tbin"
}
]
}
],
"scales": [
{
"name": "xscale",
"type": "band",
"range": "width",
"padding": 0.05,
"round": true,
"domain": {data:"flights", "signal": "timeSequence(tbin.unit, tbin.start, tbin.stop)"}
}
],
"axes": [
{ "orient": "bottom", "scale": "xscale",
"formatType": "time", "format": {"signal": "timeUnitSpecifier(tbin.units, {hours: '%H'})"} }
]
}
for reference:-
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A basic bar chart example, with value labels shown upon mouse hover.",
"width": 400,
"height": 200,
"padding": 5,
"signals": [
{
"name": "timeunit", "value": ["day"],
"bind": {"input": "select", "options": [
["month"], ["date"], ["day"], ["hours"]
]}
}
],
"data": [
{
"name": "flights",
"values": [
{"date": " 01 Jan 2012 23:00:00", "ticket":10, "priority":"p1", "inc":"INC001"},
{"date": " 01 feb 2012 20:00:00", "ticket":10, "priority":"p1", "inc":"INC001"},
{"date": " 01 Jan 2012 23:00:00", "ticket":17, "priority":"p3", "inc":"INC002"},
{"date": " 01 feb 2012 23:00:00", "ticket":20, "priority":"p3", "inc":"INC003"},
{"date": " 04 march 2012 23:00:00", "ticket":15,"priority":"p4", "inc":"INC004"},
{"date": " 01 Apr 2018 23:00:00", "ticket":28, "priority":"p4", "inc":"INC008"},
{"date": " 01 Jan 2016 23:00:00", "ticket":27, "priority":"p2", "inc":"INC005"},
{"date": " 06 feb 2016 23:00:00", "ticket":32, "priority":"p3", "inc":"INC006"},
{"date": " 07 march 2016 20:00:00", "ticket":11, "priority":"p4", "inc":"INC007"},
{"date": " 01 Jan 2018 23:00:00", "ticket":28, "priority":"p4", "inc":"INC008"},
{"date": " 05 feb 2018 13:00:00", "ticket":16, "priority":"p2", "inc":"INC009"},
{"date": " 08 march 2018 23:00:00", "ticket":19, "priority":"p2", "inc":"INC010"},
{"date": " 01 Jan 2020 23:00:00", "ticket":29, "priority":"p1", "inc":"INC011"},
{"date": " 05 feb 2020 23:00:00", "ticket":18, "priority":"p3", "inc":"INC012"},
{"date": "06 march 2020 23:00:00", "ticket":18, "priority":"p3", "inc":"INC013"}
],
"format": {"type": "json", "parse": "auto"},
"transform": [
{
"type": "timeunit",
"field": "date",
"units": {"signal": "timeunit"},
"signal": "tbin"
}
]
}
],
"scales": [
{
"name": "xscale",
"type": "band",
"range": "width",
"padding": 0.05,
"round": true,
"domain": {"signal": "timeSequence(tbin.unit, tbin.start, tbin.stop)"}
}
],
"axes": [
{ "orient": "bottom", "scale": "xscale",
"formatType": "time", "format": {"signal": "timeUnitSpecifier(tbin.units, {hours: '%H'})"} }
]
}