---
schema_version: "1"
id: 7f06fa749524d6d5f74f6cab26a9d9997f9a80ba0fb2a761262287f0f45f2afe
title: Dynamically Set the Reference Line and Label on a Widget
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_bindings/guides/bi-dashboard-bindings-wave-designer-set-reference-line.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-bindings/guide/bi-dashboard-bindings-wave-designer-set-reference-line.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 571bc83f50bbcdb335476febc8450c670a2ec08610435df658b7c331066be2d8
products:
  - Analytics Interactions
  - analytics
---
# Dynamically Set the Reference Line and Label on a Widget

You can dynamically set a reference line and its label based on a measure from a query. For example, you can set the reference line to represent the sales target and then compare it against your won opportunities.

**note:** You can create dynamic reference lines without code. Learn more about creating [reference lines](https://help.salesforce.com/articleView?id=analytics.bi_chart_reference_lines_multiple.htm).

In this example, let’s say you have a timeline chart that shows the total opportunity amount over time. The dashboard also contains a list selector that allows you to show the total amount for a particular account. To compare the total for each account against the average for all accounts, you want to set a reference line based on the average opportunity amount for all accounts.

![The timeline chart shows a reference line with a label and value.](https://developer.salesforce.com/docs/media/bi_dev_guide_bindings/bi_dashboard_binding_reference_line_value.png)

To create the reference line label and its value based on the average for all accounts, add interactions in widget properties for the timeline chart (`chart_3`) as follows.

```nolang
"referenceLines": [
    {
        "color": "#9271E8",
        "value": "{{cell(all_1.result, 0, \"avg_Amount\").asString()}}",
        "label": "Avg: {{cell(all_1.result, 0, \"avg_Amount\").asString()}}"
    }
]
```

In this example, the interaction gets the average from the query (`all_1`), which calculates the average in the number widget based on the selected account name in the list widget.

For more interaction examples, create the [CRM Analytics Learning Adventure app](https://help.salesforce.com/s/articleView?id=analytics.bi_learning_adventure_app.htm) in your org.
