---
title: Use visualizations in notebooks
source: https://docs.newrelic.com/docs/query-your-data/explore-query-data/notebooks/visualizations-in-notebooks
---

Visualizations are a key component of effective notebooks, helping transform raw query results into clear, compelling charts that support your data narrative. Notebooks support all the same visualization options available in the New Relic query builder.

## Available chart types

Choose the right visualization for your data and story:

### Line charts

Perfect for showing trends over time and comparing multiple metrics.

**Best for**: Time series data, performance trends, comparing metrics over time

**Example query**:

```sql
SELECT average(duration) AS 'Response Time'
FROM Transaction
WHERE appName = 'MyApp'
TIMESERIES 5 minutes
SINCE 6 hours ago
```

### Area charts

Show volume and composition changes over time with filled areas under the line.

**Best for**: Cumulative data, showing total volume with breakdowns, resource usage over time

**Example query**:

```sql
SELECT count(*) FROM Transaction
WHERE appName = 'MyApp'
FACET host
TIMESERIES 10 minutes
SINCE 2 hours ago
```

### Bar charts

Compare values across different categories or dimensions.

**Best for**: Comparing values across categories, top N lists, error breakdowns

**Example query**:

```sql
SELECT count(*) AS 'Request Count'
FROM Transaction
WHERE appName = 'MyApp'
FACET name
SINCE 1 hour ago
ORDER BY count(*) DESC
LIMIT 10
```

### Pie charts

Display proportional data and percentage breakdowns.

**Best for**: Showing parts of a whole, percentage distributions, simple category breakdowns

**Example query**:

```sql
SELECT count(*) FROM Transaction
WHERE appName = 'MyApp'
FACET httpResponseCode
SINCE 1 hour ago
```

### Tables

Present detailed data in rows and columns for precise values.

**Best for**: Detailed data, exact values, lists with multiple attributes, debugging

**Example query**:

```sql
SELECT timestamp, name, duration, httpResponseCode
FROM Transaction
WHERE appName = 'MyApp' AND duration > 5
SINCE 1 hour ago
ORDER BY duration DESC
LIMIT 20
```

### Billboards

Highlight single important metrics prominently.

**Best for**: Key performance indicators, summary statistics, single important values

**Example query**:

```sql
SELECT average(duration) AS 'Avg Response Time (ms)'
FROM Transaction
WHERE appName = 'MyApp'
SINCE 1 hour ago
```

## Customize your visualizations

### Chart settings

Access chart customization options by clicking the **Chart settings** icon in your query block:

1.  **Colors**: Choose custom colors for your data series
2.  **Axes**: Customize axis labels, ranges, and formatting
3.  **Legend**: Show/hide legend, adjust positioning
4.  **Thresholds**: Add horizontal lines for targets or alerts
5.  **Units**: Format numbers, percentages, time values

### Color schemes

Choose colors that support your narrative:

-   **Default palette**: Standard New Relic colors for consistency
-   **Custom colors**: Match your organization's branding
-   **Accessible colors**: High contrast for better readability
-   **Status colors**: Green for healthy, red for errors, yellow for warnings

### Formatting options

Format your data for clarity:

-   **Numbers**: Add thousands separators, decimal places
-   **Percentages**: Show as percentages rather than decimals
-   **Time values**: Display in hours, minutes, or seconds
-   **Bytes**: Show in KB, MB, GB as appropriate

## Visualization best practices

### Choose the right chart type

> #### 💡 TIP
>
> The chart type should support your story, not distract from it. When in doubt, simpler is usually better.

-   **Time series data**: Use line or area charts
-   **Comparisons**: Use bar charts
-   **Proportions**: Use pie charts (but limit to 5-7 categories)
-   **Exact values**: Use tables
-   **Key metrics**: Use billboards

### Design for clarity

#### Chart titles and labels

Always add descriptive titles and labels:

```sql
SELECT average(duration) AS 'Average Response Time (ms)',
       percentile(duration, 95) AS '95th Percentile (ms)'
FROM Transaction
WHERE appName = 'E-commerce API'
SINCE 24 hours ago
TIMESERIES 1 hour
```

#### Use consistent formatting

-   Keep similar charts using the same time ranges
-   Use consistent color schemes across related charts
-   Apply the same formatting rules throughout your notebook

#### Highlight important information

-   Use thresholds to show targets or SLA boundaries
-   Choose colors that draw attention to problems (red for errors)
-   Size billboards appropriately for their importance

### Context and storytelling

#### Add explanatory text

Use Markdown blocks to provide context for your visualizations:

```markdown
## Response Time Analysis

The chart below shows a significant spike in response times at 2:30 PM,
corresponding with the deployment of version 2.1.4. The 95th percentile
reached 2.8 seconds, well above our 500ms SLA target.

### What this means:
- 5% of users experienced unacceptable delays
- The issue was resolved by rolling back the deployment
- We need better performance testing before releases
```

#### Tell a story with multiple charts

Arrange your visualizations to build a narrative:

1.  **Overview chart**: Start with high-level metrics
2.  **Drill-down charts**: Show specific aspects or segments
3.  **Root cause charts**: Display underlying causes
4.  **Resolution charts**: Show improvement or fixes

## Advanced visualization techniques

### Using variables for dynamic charts

Create reusable visualizations with variables:

```markdown
{{appName = "production-api"}}
{{timeRange = "6 hours ago"}}
```

```sql
SELECT count(*) AS 'Requests',
       average(duration) AS 'Avg Duration'
FROM Transaction
WHERE appName = '{{appName}}'
TIMESERIES 5 minutes
SINCE {{timeRange}}
```

### Comparative analysis

Show before and after or period comparisons:

```sql
SELECT average(duration) AS 'Response Time'
FROM Transaction
WHERE appName = 'MyApp'
TIMESERIES 1 hour
SINCE 7 days ago
COMPARE WITH 1 week ago
```

### Multi-faceted analysis

Break down metrics by multiple dimensions:

```sql
SELECT count(*) FROM Transaction
WHERE appName = 'MyApp'
FACET host, httpResponseCode
SINCE 2 hours ago
```

## Troubleshooting visualizations

### Common issues

**Chart shows no data**:

-   Check your time range includes data
-   Verify your WHERE clauses are correct
-   Ensure you have permission to access the data

**Chart is too cluttered**:

-   Use LIMIT to reduce the number of series
-   Consider breaking into multiple charts
-   Use aggregation to combine less important categories

**Data looks wrong**:

-   Check for timezone issues in time series
-   Verify your math in calculated fields
-   Look for filtering that might exclude expected data

### Performance optimization

-   Use appropriate time ranges for your analysis
-   Add specific WHERE clauses to limit data volume
-   Use sampling for very large datasets
-   Consider using approximation functions for better performance

## What's next?

-   Learn about [sharing notebooks](https://docs.newrelic.com/docs/query-your-data/explore-query-data/notebooks/share-notebooks) with your team
-   Explore [notebook examples](https://docs.newrelic.com/docs/query-your-data/explore-query-data/notebooks/notebooks-examples) for visualization inspiration
-   Check out the [chart types guide](https://docs.newrelic.com/docs/query-your-data/explore-query-data/use-charts/chart-types) for detailed information about all available visualizations
