ACE-IoT-Solutions / ace-svg-react

Grafana SVG Rendering Panel using the 7+ Plugin Framework
https://grafana.com/grafana/plugins/aceiot-svg-panel/
MIT License
41 stars 14 forks source link

ACE.SVG LOGO

React powered SVG Panel Plugin for Grafana

Latest version Downloads CI

Screenshot of plugin

This is an SVG panel plugin for Grafana 10.x+

Why yet another SVG panel plugin?

Yes, I definitely considered naming it YASPP... The existing SVG panel plugins all use the pre-7.0, Angular panel API. I wanted to be able to use all of the features included in the new data API, as well as potential performance improvements from migrating to React. I have also taken a slightly different direction/philosophy from some of the other SVG plugins.

How does it work?

What are the goals for this project?

  1. Be the most performant way to visualize arbitrary SVG graphics and animations within Grafana
  2. Stay out of the way - This plugin will focus on providing simple, obvious tools to reduce the friction of converting your static SVG graphics into data driven visualizations, without limiting your options.
  3. Stay focused - This plugin will not attempt to be an online graphics editor.

Getting started

  1. Create a new panel and select ACE.SVG as the visualization
  2. Paste your SVG source file into the SVG Document tab editor.
  3. Use the 'Click to Map' functionality in the SVG Mapping tab to map SVG Elements to variables.
  4. Write code that you want to run once on dashboard load in the User JS Init tab editor.
  5. Write code that you want to run on when data is received in the User JS Render tab editor.
  6. Make generous use of the browser JS console and console.log() to explore the features of the plugin and SVG.js

Execution Environment Interfaces

The plugin makes available several interfaces to the SVG document and Grafana in the execution context of the Init and Render functions. Below are details for each one, remember you can always use the browser JS console and console.log() for more detail.

The 'data' object contains both the query definition and the results of the query. In the case of the user initialization function there likely won't be any results (yet), but the query definition should be present. This may be useful for some initial rendering purposes, but caution is advised as the query may be updated (for example while the user is updating the query) so anything done here should likely be done in the update function as well.

Getting started (development)

  1. Install dependencies
    npm i
  2. Build plugin in development (watch) mode
    npm run dev
  3. Build plugin in production mode
    npm run build

Learn more