How to fix a rule on x axis using time

hello all,

I am trying to fix a fixed line to the x acse where time = 15:30 so that I can notice the bars that took longer than 15:30. what have i done wrong?

tha is my Code:

   {
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "title": "Event counts from all indexes",
  "layer": [
    {
      "data": {
        "url": {
          "%context%": true,
          "%timefield%": "Date",
          "index": "index_tev_test",
          "body": {"size": 300, "_source": ["Date", "Start", "COMD Belege"]}
        },
        "format": {"property": "hits.hits"}
      },
      "mark": "bar",
      "encoding": {
        "y": {
          "field": "_source.Date",
          "type": "n",
          "sort": 0,
          "axis": {"title": "Datum "}
        },
        "x": {
          "field": "_source.Start",
          "type": "nominal",
          "axis": {"title": "Start to COMD Belege"}
        },
        "x2": {"field": "_source.COMD Belege", "type": "n"},
        "color": {"value": "green"}
      }
    },
    {
      "data": {"values": {"foo": "bar"}},
      "transform": [
      //{"calculate": "field": "COMD Belege", "expr": "hours(datum.COMD Beleg)"}
      {"calculate": "time(1530)", "as": "now_field"}
      //{"calculate": [{"field": "hour", "expr": "hours(datum.date)"}],
      
      ],
      "mark": "rule",
      "encoding": {
        "x": {"aggregate": "mean", "type": "o", "field": "now_field"},
        "color": {"value": "red"},
        "size": {"value": 5}
      }
    }
  ]
}

the result is :slightly_frowning_face: :

Can you try setting it to

"value": 1331321

where you replace 1331321 with the equivalent for 15:30 instead of doing all that calculate stuff?
You would have to remove the aggregate, the type and the field properties.

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