Vega: Fitting time range to Kibana filter

Hello, I've been struggling with this problem.
I'm creating a visualization of events in a timeline wich resemble a Gantt graph. I've succesfully pulled data from elasticsearch and displayed it on the graph area using X and X2 encodings and the instants that are already present in the documents.

The problem is with the boudaries.
Using the %timefield% and %context% actually selects correct data and display it, but time axis represented in vega graph is not scaled between these 2 values. The "beginning" of the graph axis correspond with the first event start instant and the end of the axis is the last event end instant (which is out of the timefilter boundary).

I've been trying with a scale: domain: in the X encoding, but this lead to [-infinite:infinite] error. To keep it simple in this test I hardcoded the 2 data limits, as you can see below (these are exactly the 2 instants in kibana time filter).

        x: {
          field: _source.startAlertInstant
          type: temporal
          axis: {
            tickCount: 20
            labelFontSize: 10
            labelExpr: "[timeFormat(datum.value, '%M') == '30' ? timeFormat(datum.value, '%H') : '', timeFormat(datum.value, '%M:%S')]"
          scale: {
            type: time
            domain: ["2022-09-09T13:09:11.583Z","2022-09-09T13:31:00.141Z"]
          title: TimeStamp
          stack: null

The final goal is controlling scale of time axis to match it with kibana displayed one in other dashboard's graphs.

Does anybody have an advice, I'm really new to all of this.

Thank you in advance.

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