{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "title": "Collision timing breakdown",
  "background": "transparent",
  "data": {
    "url": "scene_crossing_collision_timing_breakdown.csv",
    "format": {
      "type": "csv",
      "parse": {
        "row_order": "number",
        "component_order": "number",
        "percentage": "number",
        "median_seconds": "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.percentage)"
    }
  ],
  "facet": {
    "column": {
      "field": "collision_mode_label",
      "type": "nominal",
      "sort": [
        "PRIM",
        "CAPT",
        "SDF"
      ]
    }
  },
  "spec": {
    "width": 210,
    "height": {
      "step": 24
    },
    "mark": {
      "type": "bar",
      "stroke": "white",
      "strokeWidth": 0.4
    },
    "encoding": {
      "x": {
        "field": "percentage",
        "type": "quantitative",
        "stack": "zero",
        "scale": {
          "domain": [
            0,
            100
          ]
        },
        "axis": {
          "title": "share (%)",
          "values": [
            0,
            50,
            100
          ]
        }
      },
      "y": {
        "field": "row_label",
        "type": "ordinal",
        "sort": {
          "field": "row_order",
          "order": "ascending"
        },
        "axis": {
          "title": null
        }
      },
      "color": {
        "field": "component_label",
        "type": "nominal",
        "scale": {
          "domain": [
            "Kinematics",
            "Sphere/setup",
            "Distance query",
            "Jacobian/gradient",
            "Self-collision pair",
            "Other"
          ],
          "range": [
            "#45B4DE",
            "#4FC9BE",
            "#ED914A",
            "#56B86B",
            "#C95FBD",
            "#A6A6A6"
          ]
        },
        "sort": [
          "Kinematics",
          "Sphere/setup",
          "Distance query",
          "Jacobian/gradient",
          "Self-collision pair",
          "Other"
        ],
        "legend": {
          "orient": "bottom",
          "columns": 3
        }
      },
      "order": {
        "field": "component_order",
        "type": "quantitative"
      },
      "tooltip": [
        {
          "field": "planner_label",
          "title": "Planner"
        },
        {
          "field": "kinematics_backend",
          "title": "Backend"
        },
        {
          "field": "eval_group_label",
          "title": "Group"
        },
        {
          "field": "collision_mode_label",
          "title": "Collision"
        },
        {
          "field": "component_label",
          "title": "Component"
        },
        {
          "field": "percentage",
          "title": "Share (%)",
          "format": ".2f"
        },
        {
          "field": "median_seconds",
          "title": "Median seconds",
          "format": ".4g"
        }
      ]
    }
  },
  "resolve": {
    "scale": {
      "x": "shared",
      "color": "shared"
    }
  }
}
