Search code examples
plotdata-sciencevegaanomaly-detectionvega-lite

Disconnect points to plot overlay in Vega-lite / Vega


An example in vega-editor here

I don’t want dateTime 5 & dateTime 7 to be connected since they are not consecutive. Idea is to plot on overlay based on some condition and connect only when the count is >=5.

Has anyone tried this already?


Solution

  • You can replace your filter statement:

    {"filter": "datum.count >= 5"}
    

    With a calculate statement that sets filtered values to null:

    {"as": "count", "calculate": "if(datum.count >= 5, datum.count, null)"}
    

    The result is here

    enter image description here