Skip to main content

Time range and zone, replace variables, and JS updates in Business Text 3.1.0

Mikhail Volkov
Founder at Volkov Labs, Grafana Champion

We're excited to announce the release of the Business Text panel 3.1.0. This feature release includes the following updates:

  • Added Time Zone and Range parameters for JavaScript Code.
  • Added Replace variables and Location service parameters for Javascript Code.
  • Updated the replaceVariable function with a scoped function. Variables in repeated panels are supported.
  • Updated to the latest Grafana 9.4.3 toolkit.
Grafana Catalog

The plugin was updated in the Grafana Plugins catalog on March 13, 2023.

Time Range and Zone

Added the Time Zone and Time Range parameters enabling the display of the selected time zone and time ranges with custom handlers.

Here is an example of how to display the selected dashboard, user's time zone, and time range in Grafana.

Content

<h1>Dashboard {{tz}}</h1>
<h2>Browser {{browser}}</h2>

```json
{{{json (range)}}}
```

JavaScript Code

handlebars.registerHelper('tz', () => timeZone);
handlebars.registerHelper('range', () => timeRange);
handlebars.registerHelper('browser', () => Intl.DateTimeFormat().resolvedOptions().timeZone);
Dynamic Text allows displaying updated time zone and range in Grafana.
Dynamic Text allows displaying updated time zone and range in Grafana.

Replace Variables

Updated the replaceVariable function with a scoped function and added support for repeated panels.

Business Text panel provides the {{variable}} helper to work with dashboard and global variables. Alternatively, you can create a custom Handlebars helper to introduce additional logic and formats.

Content

- Native helper **{{variable "test"}}**
- Custom helper **{{myVariable "test"}}**

JavaScript Code

handlebars.registerHelper("myVariable", (name) => replaceVariables(`$${name}`));

Magic (JavaScript) Trio

One of the three plugins that complete Grafana is Business Text panel. With Dynamic Text, Data Manipulation, and Business Charts panel you can create fully functional web applications meeting your needs and expectations.

Dynamic Text, Data Manipulation, and Business Charts panel plugins.

Getting Started

You can install the Business Text panel from the Grafana Plugins catalog or using the Grafana command line tool.

Install Business Suite plugins in Cloud, OSS, Enterprise. Getting started with the Business Suite.

For the latter, please use the following command:

grafana cli plugins install marcusolsson-dynamictext-panel

Tutorial

The video reviews the major latest release including the data flow, predefined helpers and numerous examples of the external JavaScript libraries.

The Business Text panel for Grafana. Main features overview in 5.0.0

We have many other tutorials that you can find helpful. You can review all related to this plugin tutorials here.

Release Notes

Features / Enhancements

  • Added support for the Time Zone and Time Range parameters in JavaScript code (#155).
  • Added compatibility with Grafana 9.4.3 (#156).
  • Added the Magic (JavaScript) Trio tutorial in the README file (#157).
  • Updated the replaceVariables function with a scoped function (#160).
  • Added the Replace variables and Location service parameters for JavaScript code (#160).

Always happy to hear from you

  Enroll in Business Suite Enterprise