Time range and zone, replace variables, and JS updates in Business Text 3.1.0
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.
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);
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.
Getting Started
You can install the Business Text panel from the Grafana Plugins catalog or using the Grafana command line tool.
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.
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
- Ask a question, request a new feature, or report an issue at GitHub issues.
- Subscribe to our YouTube Channel and leave your comments.
- Become a Business Suite sponsor.