> ## Documentation Index
> Fetch the complete documentation index at: https://bruno-a6972042-docs-timeline-scripts.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Response Visualization

Bruno provides a powerful visualization feature that allows you to display API response data in a more readable and interactive format using the `bru.visualize` function.

```javascript theme={null}
bru.visualize(type, config)
```

1. **type**: The type of visualization to render (e.g., 'table', 'html').

2. **config**: A configuration object that includes:

   * **name**: The name of the visualization instance.

   * **provider**: The rendering library or provider used to display the visualization (e.g., 'ag-grid', 'react-table').

   * **props**: Additional properties required by the provider to configure the visualization.

## Supported Visualization Types and Providers

### Table Visualization ('table')

You can render tables using different providers like `ag-grid` and `react-table`.

#### Using **ag-grid**

*Example:*

<img src="https://mintcdn.com/bruno-a6972042-docs-timeline-scripts/qLeHtpKFpf3RFoq7/v2/images/screenshots/visualization/ag-grid.webp?fit=max&auto=format&n=qLeHtpKFpf3RFoq7&q=85&s=0a62654e4d2bf35a7fac7b8ba3e76c04" alt="ag-grid" width="1156" height="318" data-path="v2/images/screenshots/visualization/ag-grid.webp" />

```javascript theme={null}
const rowData = [
  { name: 'John Doe', age: 28, email: 'john@example.com', city: 'New York' },
  { name: 'Jane Smith', age: 32, email: 'jane@example.com', city: 'London' }
];

const columnDefinitions = [
  { field: "name", filter: true, floatingFilter: true },
  { field: "age", filter: true, floatingFilter: true },
  { field: "email", filter: true, floatingFilter: true },
  { field: "city", filter: true, floatingFilter: true }
];

bru.visualize('table', {
  name: 'table1',
  provider: 'ag-grid',
  props: { rowData, columnDefinitions }
});
```

This will render a table using the ag-grid provider with filters enabled on all columns.

#### Using **react-table**

*Example:*

<img src="https://mintcdn.com/bruno-a6972042-docs-timeline-scripts/qLeHtpKFpf3RFoq7/v2/images/screenshots/visualization/react-table.webp?fit=max&auto=format&n=qLeHtpKFpf3RFoq7&q=85&s=39dc8f3c2a4da325102a71dbfec57b9a" alt="react-table" width="1128" height="266" data-path="v2/images/screenshots/visualization/react-table.webp" />

```javascript theme={null}
const rowData1 = Array.from({ length: 2500 })
  .map((_) => [
    { firstName: 'Tanner', lastName: 'Linsley', age: 24, visits: 100 },
    { firstName: 'Tandy', lastName: 'Miller', age: 40, visits: 40 },
    { firstName: 'Joe', lastName: 'Dirte', age: 45, visits: 20 },
  ]).flat();


const columnDefinitions1 = [
  {
    id: "firstName",
    cell: (info) => info.getValue(),
    header: () => `<span className="flex flex-start">First Name</span>`,
    meta: { filterVariant: "text" },
  },
  {
    id: "lastName",
    cell: (info) => info.getValue(),
    header: () => `<span className="flex flex-start">Last Name</span>`,
    meta: { filterVariant: "text" },
  },
  // Additional column definitions here...
];

bru.visualize('table', {
  name: 'table2',
  provider: 'react-table',
  props: { rowData: rowData1, columnDefinitions: columnDefinitions1 }
});
```

This example renders a large table using the react-table provider, with custom headers and filter variants.

### HTML Visualization ('html')

You can also render custom HTML content using the html type. This allows for advanced templating and formatting, such as generating a data table or a report.

#### Using **HTML** String

*Example:*

<img src="https://mintcdn.com/bruno-a6972042-docs-timeline-scripts/qLeHtpKFpf3RFoq7/v2/images/screenshots/visualization/html.webp?fit=max&auto=format&n=qLeHtpKFpf3RFoq7&q=85&s=59a8a28646cccdaa212fcb7a3679b4d3" alt="html" width="1152" height="200" data-path="v2/images/screenshots/visualization/html.webp" />

```javascript theme={null}
const htmlString = `
<html>
  <head>
    <style>
      table { width: 100%; border-collapse: collapse; }
      th, td { border: 1px solid black; padding: 8px; }
      th { background-color: #f2f2f2; }
    </style>
  </head>
  <body>
    <table>
      <tr><th>Name</th><th>Age</th><th>Email</th><th>City</th></tr>
      <tr><td>John Doe</td><td>28</td><td>john@example.com</td><td>New York</td></tr>
      <tr><td>Jane Smith</td><td>32</td><td>jane@example.com</td><td>London</td></tr>
    </table>
  </body>
</html>
`;

bru.visualize('html', {
  name: 'htmlReport',
  content: htmlString
});
```

This example will render an HTML table with predefined data using the html type.

## Viewing Your Visualization

1. Add the visualization code to your request's script section
2. Execute the request
3. Click on the **Table** option (next to Raw)

<img src="https://mintcdn.com/bruno-a6972042-docs-timeline-scripts/qLeHtpKFpf3RFoq7/v2/images/screenshots/visualization/1-view-table.webp?fit=max&auto=format&n=qLeHtpKFpf3RFoq7&q=85&s=4c40606256d772bf4542f3671b26e38b" alt="View Table Option" width="1900" height="831" data-path="v2/images/screenshots/visualization/1-view-table.webp" />

4. Your visualization will be displayed in the panel

<img src="https://mintcdn.com/bruno-a6972042-docs-timeline-scripts/qLeHtpKFpf3RFoq7/v2/images/screenshots/visualization/2-use-table.webp?fit=max&auto=format&n=qLeHtpKFpf3RFoq7&q=85&s=04802c51183200fe71bd5d791a5f6ab6" alt="Visualization Output" width="1827" height="807" data-path="v2/images/screenshots/visualization/2-use-table.webp" />

### Parameters

| Name     | Type     | Description                                                                     |
| -------- | -------- | ------------------------------------------------------------------------------- |
| `type`   | `string` | The type of visualization to render. Supported values: `'table'`, `'html'`.     |
| `config` | `object` | Configuration object for the visualization. See below for available properties. |

### Config Properties

| Property   | Type     | Description                                                                                        |
| ---------- | -------- | -------------------------------------------------------------------------------------------------- |
| `name`     | `string` | Name of the visualization instance.                                                                |
| `provider` | `string` | The provider or rendering engine to use for the visualization. E.g., `'ag-grid'`, `'react-table'`. |
| `props`    | `object` | Additional properties required by the provider to configure the visualization.                     |
| `content`  | `string` | (For `html` type only) The HTML content to render.                                                 |
