> ## Documentation Index
> Fetch the complete documentation index at: https://calcs.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Reactions Diagram

> Visualize all reactions for each support in a structural member

The Reactions Diagram is used throughout the modern platform to plot all the reactions for each support in a member. It uses diagram widget type `"beamReactions"`.

## Implementation

<CodeBlock title="Basic Reactions Diagram">
  ```json theme={null}
  {
      "type": "sheetTemplateWidgets",
      "attributes": {
          "type": "diagram",
          "diagram": [
              {
                  "type": "beamReactions"
              }
          ],
          "equation": [
              {
                  "result": "{PARAMETERS}",
                  "condition": "CONDITIONS"
              }
          ],
          "referenceId": "reactions_diagram"
      }
  }
  ```
</CodeBlock>

## Plot Parameters

| Parameter           | Format           | Default | Description                                                                                                                                                                  |
| ------------------- | ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| L                   | number           | -       | The length of the member                                                                                                                                                     |
| dispR               | array of strings | `[]`    | Example: `["UltMax", "UltMin", "G", "Q"]`. A list of the load types to plot in the reactions diagram. All load types, along with "Ult", "UltMax", and "UltMin" are available |
| dispTooltip         | array of strings | `dispR` | A list of the load types to display in the tooltip                                                                                                                           |
| allR                | array of dicts   | `[]`    | Example: `remote.plot.allR`. All of the reactions data from the solver                                                                                                       |
| lenConvert          | number           | `1`     | Conversion factor for length                                                                                                                                                 |
| lenUnit             | string           | `"m"`   | Unit for lengths                                                                                                                                                             |
| bearingUnit         | string           | `"mm"`  | Unit for length of bearing, if different                                                                                                                                     |
| plUnit              | string           | `"kN"`  | (defaults to `"kN"`) Unit for point reactions                                                                                                                                |
| mlUnit              | string           | `"kNm"` | (defaults to `"kNm"`) Unit for moment reactions                                                                                                                              |
| column              | boolean          | `false` | (defaults to `false`) Plots the reactions on a vertical axis and adjusts other text locations appropriately                                                                  |
| scaleArrows         | boolean          | `true`  | (defaults to `true`) Whether or not to scale the reaction arrows according to the absolute value of the ultimate maximum reactions                                           |
| upstreamReferenceId | string           | -       | If you want to display a button to link the reaction to other sheets as an upstream sheet                                                                                    |

## Reaction Data Format

The `allR` parameter contains comprehensive reaction data from the solver:

<CodeBlock title="Reaction Data Structure">
  ```javascript theme={null}
  allR: [
      {
          x: 0,                    // Support location
          supportType: "fixed",    // Type of support
          reactions: {
              "G": {               // Dead load reactions
                  Ry: 45.2,        // Vertical reaction (kN)
                  Rx: 0,           // Horizontal reaction (kN) 
                  Mz: 0            // Moment reaction (kNm)
              },
              "Q": {               // Live load reactions
                  Ry: 30.8,
                  Rx: 0,
                  Mz: 0
              },
              "UltMax": {          // Ultimate maximum
                  Ry: 98.5,
                  Rx: 0,
                  Mz: 0
              },
              "UltMin": {          // Ultimate minimum
                  Ry: 76.0,
                  Rx: 0,
                  Mz: 0
              }
          }
      },
      // ... more supports
  ]
  ```
</CodeBlock>

## Load Type Display

Use `dispR` to control which load combinations are displayed:

<CodeBlock title="Load Type Selection">
  ```javascript theme={null}
  {
      dispR: ["G", "Q", "UltMax", "UltMin"],  // Show dead, live, and ultimate reactions
      dispTooltip: ["G", "Q", "W", "UltMax", "UltMin"]  // Include wind in tooltips
  }
  ```
</CodeBlock>

<Accordion title="Common Load Type Codes">
  * **G**: Dead loads (permanent loads)
  * **Q**: Live loads (imposed loads)
  * **W**: Wind loads
  * **E**: Earthquake loads
  * **S**: Snow loads
  * **Ult**: Ultimate load combination
  * **UltMax**: Maximum ultimate combination
  * **UltMin**: Minimum ultimate combination
  * **SLS**: Serviceability limit state
</Accordion>

## Example Implementation

<CodeBlock title="Complete Reactions Diagram">
  ```json theme={null}
  {
      "type": "sheetTemplateWidgets",
      "attributes": {
          "type": "diagram",
          "diagram": [
              {
                  "type": "beamReactions"
              }
          ],
          "equation": [
              {
                  "result": "{
                      L: beam_length,
                      allR: remote.plot.allR,
                      dispR: [\"G\", \"Q\", \"UltMax\"],
                      dispTooltip: [\"G\", \"Q\", \"W\", \"UltMax\", \"UltMin\"],
                      lenUnit: \"m\",
                      plUnit: \"kN\",
                      mlUnit: \"kNm\",
                      lenConvert: 0.001,
                      scaleArrows: true
                  }",
                  "condition": "@default"
              }
          ],
          "referenceId": "beam_reactions",
          "label": "Support Reactions",
          "showInSuperSummary": true
      }
  }
  ```
</CodeBlock>

## Column Mode

For vertical members, set `column: true`:

<CodeBlock title="Column Reactions">
  ```json theme={null}
  {
      "result": "{
          L: column_height,
          allR: column_reactions,
          dispR: [\"G\", \"Q\", \"UltMax\"],
          column: true,
          lenUnit: \"m\",
          plUnit: \"kN\"
      }"
  }
  ```
</CodeBlock>

## Upstream Linking

The `upstreamReferenceId` parameter enables linking reactions to upstream sheets:

<CodeBlock title="Upstream Linking Setup">
  ```json theme={null}
  {
      "result": "{
          // ... other parameters
          upstreamReferenceId: \"linkMembersY\"
      }"
  }
  ```
</CodeBlock>

<Note>
  **Tutorial**: [Upstream Linking Video](https://www.loom.com/share/eb54fa913b61477caf420e1c3085ef3a)

  If you want to display a button to link the reaction to other sheets as an upstream sheet, the value should be the type of reaction that the diagram represents such as `linkMembersY`.

  Clicking the button will open a modal with options of which sheets you can link to the reaction. Compatible sheets are those with templates where this `upstreamReferenceId` value is in the `importReferenceIds` array of the template.
</Note>

### Upstream Reference Setup

In the target template's header, include the reference ID in `importReferenceIds`:

<CodeBlock title="Template Import Configuration">
  ```json theme={null}
  {
      "importReferenceIds": [
          "linkDL",
          "linkLine", 
          "linkMembers"
      ]
  }
  ```
</CodeBlock>

## Arrow Scaling

Control reaction arrow scaling with `scaleArrows`:

<CodeBlock title="Arrow Scaling Options">
  ```javascript theme={null}
  {
      scaleArrows: true,   // Scale arrows based on ultimate maximum reactions
      scaleArrows: false   // Use uniform arrow sizes
  }
  ```
</CodeBlock>

<Tip>
  Setting `scaleArrows: true` helps visualize the relative magnitude of reactions, making it easier to identify critical supports.
</Tip>

## Best Practices

1. **Load Selection**: Choose appropriate load types for display based on design requirements
2. **Units**: Ensure consistent units for all reaction components
3. **Tooltips**: Include more load types in tooltips than displayed for comprehensive information
4. **Linking**: Use upstream linking for templates that feed loads to other calculations
5. **Scaling**: Use arrow scaling to help visualize reaction magnitudes

<Warning>
  Only one `upstreamReferenceId` can currently be passed per diagram. If you need multiple linking options, consider using separate diagrams or custom implementations.
</Warning>

## Integration with Beam Solvers

Reactions diagrams work seamlessly with beam solver results:

<CodeBlock title="Beam Solver Integration">
  ```json theme={null}
  {
      "type": "sheetTemplateWidgets",
      "attributes": {
          "type": "remote",
          "solver": "beam",
          "equation": [
              {
                  "condition": "@default", 
                  "result": "{
                      L: beam_length,
                      r: support_data,
                      PL: point_loads,
                      DL: distributed_loads,
                      loadCombinations: load_combinations
                  }"
              }
          ],
          "referenceId": "beam_analysis"
      }
  }
  ```
</CodeBlock>

The solver automatically generates the `allR` data structure with reactions for all specified load combinations.
