{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "title": "Timing component speed-up",
  "background": "transparent",
  "data": {
    "url": "scene_crossing_timing_component_speedup.csv",
    "format": {
      "type": "csv",
      "parse": {
        "row_order": "number",
        "collision_order": "number",
        "component_order": "number",
        "speedup": "number"
      }
    }
  },
  "config": {
    "font": "Inter",
    "view": {
      "stroke": null
    },
    "axis": {
      "domainColor": "#D1D5DB",
      "gridColor": "#E5E7EB",
      "labelColor": "#4B5563",
      "labelFontSize": 11,
      "tickSize": 0,
      "titleColor": "#4B5563",
      "titleFontSize": 11
    },
    "legend": {
      "labelColor": "#374151",
      "labelFontSize": 10,
      "symbolStrokeWidth": 0,
      "title": null
    },
    "header": {
      "labelColor": "#374151",
      "labelFontSize": 12,
      "labelFontWeight": 600,
      "title": null
    },
    "title": {
      "anchor": "start",
      "color": "#111827",
      "fontSize": 16,
      "fontWeight": 600
    }
  },
  "transform": [
    {
      "filter": "isValid(datum.speedup)"
    }
  ],
  "facet": {
    "column": {
      "field": "component_label",
      "type": "nominal",
      "sort": [
        "Kinematics",
        "Distance query",
        "Jacobian/gradient",
        "Collision overhead",
        "Solver/update"
      ]
    }
  },
  "spec": {
    "width": 125,
    "height": {
      "step": 32
    },
    "layer": [
      {
        "mark": "rect",
        "encoding": {
          "x": {
            "field": "collision_mode_label",
            "type": "ordinal",
            "sort": [
              "PRIM",
              "CAPT",
              "SDF"
            ],
            "axis": {
              "title": null,
              "labelAngle": 0
            }
          },
          "y": {
            "field": "row_label",
            "type": "ordinal",
            "sort": {
              "field": "row_order",
              "order": "ascending"
            },
            "axis": {
              "title": null
            }
          },
          "color": {
            "field": "speedup",
            "type": "quantitative",
            "scale": {
              "domain": [
                0,
                1,
                8
              ],
              "range": [
                "#FECACA",
                "#F8FAFC",
                "#1D4ED8"
              ]
            },
            "legend": {
              "title": "Pinocchio / SIMD"
            }
          },
          "tooltip": [
            {
              "field": "planner_label",
              "title": "Planner"
            },
            {
              "field": "eval_group_label",
              "title": "Group"
            },
            {
              "field": "component_label",
              "title": "Component"
            },
            {
              "field": "collision_mode_label",
              "title": "Collision"
            },
            {
              "field": "speedup",
              "title": "Speed-up",
              "format": ".2f"
            }
          ]
        }
      },
      {
        "mark": {
          "type": "text",
          "fontSize": 9
        },
        "encoding": {
          "x": {
            "field": "collision_mode_label",
            "type": "ordinal",
            "sort": [
              "PRIM",
              "CAPT",
              "SDF"
            ]
          },
          "y": {
            "field": "row_label",
            "type": "ordinal",
            "sort": {
              "field": "row_order",
              "order": "ascending"
            }
          },
          "text": {
            "field": "speedup",
            "type": "quantitative",
            "format": ".2f"
          },
          "color": {
            "condition": {
              "test": "datum.speedup >= 4",
              "value": "white"
            },
            "value": "#111827"
          }
        }
      }
    ]
  },
  "resolve": {
    "scale": {
      "color": "shared"
    }
  }
}
