Hi, I am trying to create a chart which shows some kind of risk. The logic behind is that I have an index which has Dalue, startDate and endDate. I would like to show the line which is cumulative sum of value with startdate substracted by the same value but with enddate. I am only able to show value with only one of this date. Here is my code:
{
$schema: https://vega.github.io/schema/vega-lite/v4.json
data: {
# URL object is a context-aware query to Elasticsearch
url: {
%context%: true
%timefield%: startDate
index: nebula
body: {
size: 10000
_source: [
startDate
Value
endDate
]
}
}
# We only need the content of hits.hits array
format: {
property: hits.hits
}
}
#Parse timestamp into a javascript date value
selection: {
brush: {"type": "interval", "encodings": ["x"], "bind": "scales"}}
mark: {
type: line
point: true
}
encoding: {
x: {
field: _source.startDate
type: temporal
timeUnit: "day"
zoom: true
bin: {"maxbins": 100 , "extent": {"selection": "brush"}}
axis: {
title: Date
format: "%Y-%m-%d"
labelAngle: -45
labelOverlap: true
}
}
y: {
field: _source.Value
type: "quantitative"
aggregate: "sum"
axis: {
title: Risk
}
}
}
}
I would appreciate any kind of help!
> Blockquote