Vegalite graph scale according to Min,Max of the value

I have plotted a graph using Vegalite visualization in Kibana as shown below:

As it can be seen, Y-axis scale starts from 0 and goes upto 450. Though it covers the Maximum and Min values of Y variable but not efficiently. I want the scale of the graph to be between [Min-10, Max+10] so that granular details can be seen which we cannot see at the moment and a straight line is being shown.

Following is the code responsible for defining axis:

    "repeat": {
      "layer": ["Avg_Wght", "Set_Point"]
    },

      "spec": {
    mark: "line",
    encoding: {
      x: {field: "time", "type": "temporal"},
      y: {
        "field": {"repeat": "layer"}
        "aggregate": "mean"
       
      }
      "color": {
        "datum": {"repeat": "layer"},
        "type": "nominal"
      }
    }
    } 

If I use "scale": {"domain": [400, 420]}, it does restrict it as per my needs but it is not dynamic for all the records.

i think you can use zero: false on the y scale, like in this example: Connected Scatterplot (Lines with Custom Paths) | Vega-Lite

@wylie It worked, thanks.

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