How to Dynamically Change Line Width in Grafana Time Series Panel Based on a Boolean Variable?

Hello everyone,

I’m working on a Grafana dashboard and need to dynamically adjust the line width of a time series based on a user-controlled filter. Here’s what I’m aiming to achieve:

Filter: Add a dropdown or toggle that allows users to select true or false.
Dynamic Line Width:
When the filter is set to true, set the line width to 1.
When the filter is set to false, set the line width to 0

What I’ve Tried:

  1. Created a Variable:
    Name: lineWidthFilter
    Type: Custom
    Values: true, false
  2. Configured Field Overrides:
    Override 1:
    Fields with name: (removed for privacy)*
    *Line Width: 1
    Override 2:
    Fields with name: (removed for privacy)
    Line Width: 0

Issue: Both overrides are applied simultaneously, causing conflicting line widths. I want the line width to toggle between 1 and 0 based on the lineWidthFilter variable within the same panel.

Constraints:

Single Panel: Prefer to manage this within one panel without creating duplicates.
No Query Changes: Solution should utilize Grafana’s UI features like variables and overrides without modifying the data query.

Questions:

  1. Is it possible to conditionally apply field overrides based on a dashboard variable within a single Grafana panel?
  2. If so, how can I set up the overrides or use other Grafana features (like transformations or expressions) to achieve dynamic line width based on the lineWidthFilter variable?
  3. Are there any recommended workarounds or best practices for this scenario with Grafana’s current capabilities?