Struggling to render dashed line in a vega-lite chart


I’m trying to create to a custom chart with a dashed line like this.

I believe my vega-lite code should be correct, Weirdly it seems to be unable to render any dashed lines and show null for my chart.

If I set the dashed field to all true or false it shows a solid line.

Here’s the custom chart code

CustomChart {
  fields {
    field x {
      type: "dimension" 
    field y {
      type: "measure"
    field dashed {
      type: "dimension"
  options {
  template: @vgl {
    "data": {
    "values": @{values}
    "transform": [
      "joinaggregate": [
        {"op": "max", "field": @{}, "as": "max"},
        {"op": "min", "field": @{}, "as": "min"}
    {"calculate": "datum.max", "as": "max"},
    {"calculate": "datum.min", "as": "min"}
  "params": [
    {"name": "max", "expr": "data('data_0')[0]['max']"},
    {"name": "min", "expr": "data('data_0')[0]['min']"}
    "mark": "line",
    "encoding": {
      "x": {
        "field": @{},
        "type": "temporal", 
        "axis": null
      "y": {
        "field": @{},
        "type": "quantitative",
        "axis": null,
        "scale": {"domain": {"expr": "[min,max]"}}
      "strokeDash": {"field": @{}, "type": "nominal"}

Here’s what I get on my end. You can see it shows the dash in the legend.

Hi @olammas,

The dashed lines are rendered normally on our side using the code you sent us.

To further investigate the issue, we will need some more private info. Therefore, can you help file a ticket to [email protected] and include the following info:

  • the URL of the dataset you are using to build the chart
  • a screenshot of the fields you have selected to build your chart (i.e. what have you selected for field x, y, and dashed)

Looking forward to hearing from you

Thanks @huynhtehoa! After digging deeper this appears to be a bug with vega lite in which you must duplicate a point to connect the dashed line. For my chart it won’t show because I’m only trying to show one point.

See bug report here and in the example chart here

We can close this issue :slight_smile:

1 Like

Thanks @olammas for including the bug report! We will make sure to notify other users of the issue.