Skip to content

GraphQL Code Examples

GraphQL connectivity graph with D3

This example uses the GraphQL API to fetch space and door relations, then builds a connectivity graph using D3 force-directed layout.

The query retrieves spaces with their doors, then processes the data to create nodes (spaces) and links (connections via shared doors).

graphql
query GetFloorSpaces($floorId: ID!) {
  getFloorById(id: $floorId) {
    spaces {
      program
      usage
      id
      elements(where: { type: { in ["element:door", "element:spaceDivider" ] }) {
        id
      }
    }
  }
}