Apache ECharts Panel plugin for Grafana

Overview

Apache ECharts Panel plugin for Grafana

Echarts

Grafana 9 CI codecov Language grade: JavaScript

Introduction

The ECharts Panel is a plugin for Grafana that allows to visualize Apache ECharts on your Grafana dashboard.

Apache ECharts is a free, powerful charting and visualization library offering an easy way of adding intuitive, interactive, and highly customizable charts to your commercial products. It is written in pure JavaScript and based on zrender, which is a whole new lightweight canvas library.

Requirements

  • Grafana 8.5+, Grafana 9.0+ is required.

Getting Started

Apache ECharts panel is not included in the Grafana Marketplace. It can be installed manually from our Private Repository or downloaded directly from the GitHub repository:

grafana-cli --repo https://volkovlabs.io/plugins plugins install volkovlabs-echarts-panel

Features

  • Allows to visualize Apache ECharts using Monaco Code Editor with Auto formatting.
  • Use setOption() function to set configuration and data.
  • Based on the ECharts 5.3.3.
  • Supports Light and Dark mode synchronized with Grafana Theme.
  • Supports SVG and Canvas renderer.
  • Includes USA and World maps. Allows to add custom Map files in the maps folder.
  • Supports variables and location service to make Charts interactive.
  • Includes Liquid Fill Chart.

setOption() Function

Configuration item, data, universal interface, all parameters and data can all be modified through setOption() function in the plugin's options. Available Parameters:

  • data - Grafana's data object.
  • theme - Grafana's theme object.
  • echartsInstance - Instance of the ECharts.
  • echarts - ECharts library.
  • replaceVariables - the replaceVariables() function to interpolate variables.
  • locationService - Grafana's locationService to work with browser location and history.

Panel

To learn more about parameters you can log them in the Browser Console:

console.log(data, theme, echartsInstance, echarts, replaceVariables, locationService);

Feedback

We love to hear from users, developers, and the whole community interested in this plugin. These are various ways to get in touch with us:

  • Ask a question, request a new feature, and file a bug with GitHub issues.
  • Star the repository to show your support.

Contributing

  • Fork the repository.
  • Find an issue to work on and submit a pull request.
  • Could not find an issue? Look for documentation, bugs, typos, and missing features.

License

  • Apache License Version 2.0, see LICENSE.
Comments
  • [Help] Stacked Bar Graph

    [Help] Stacked Bar Graph

    I have 3 queries returning aggregated monthly values, which I would like to display as stacked bar graph.

    The data looks like this image

    The display I would like to achieve is https://echarts.apache.org/v4/examples/en/editor.html?c=bar-brush with the column names derived from the query.

    Currently I'm completely lost on this approach. Turning it into a simple bar graph works but dividing the data too differently styled bars just ends up with errors.

    Currently my definition looks like:

    const series = data.series.map((s) => {
      const sData = s.fields.find((f) => f.type === 'number').values.buffer;
      const sTime = s.fields.find((f) => f.type === 'time').values.buffer;
    
      return {
        data: sData.map((d, i) => [sTime[i], d.toFixed(2)]),
      };
    });
    
    console.log(data.series);
    
    const axisOption = {
      axisTick: {
        show: false,
      },
      axisLine: {
        show: false,
      },
      axisLabel: {
        color: 'rgba(128, 128, 128, .9)',
      },
      splitLine: {
        lineStyle: {
          color: 'rgba(128, 128, 128, .2)',
        },
      },
    };
    
    return {
      backgroundColor: '#eee',
      legend: {
        data: ['bar', 'bar2', 'bar3'],
        left: 10
      },
      brush: {
        toolbox: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'],
        xAxisIndex: 0
      },
      toolbox: {
        feature: {
          magicType: {
            type: ['stack', 'tiled']
          },
          dataView: {}
        }
      },
      tooltip: {},
      xAxis: {
        data: xAxisData,
        name: 'X Axis',
        axisLine: { onZero: true },
        splitLine: { show: false },
        splitArea: { show: false }
      },
      yAxis: {
        inverse: true,
        splitArea: { show: false }
      },
      grid: {
        left: 100
      },
      visualMap: {
        type: 'continuous',
        dimension: 1,
        text: ['High', 'Low'],
        inverse: true,
        itemHeight: 200,
        calculable: true,
        min: -2,
        max: 6,
        top: 60,
        left: 10,
        inRange: {
          colorLightness: [0.4, 0.8]
        },
        outOfRange: {
          color: '#bbb'
        },
        controller: {
          inRange: {
            color: '#2f4554'
          }
        }
      },
      series: [
        {
          name: 'bar',
          type: 'bar',
          stack: 'one',
          emphasis: emphasisStyle,
          data: data.series[0]
        },
        {
          name: 'bar2',
          type: 'bar',
          stack: 'one',
          emphasis: emphasisStyle,
          data: data.series[1]
        },
        {
          name: 'bar3',
          type: 'bar',
          stack: 'two',
          emphasis: emphasisStyle,
          data: data.series[2]
        },
      ]
    };
    

    Any helping hand would be very much appreciated. Thanks in advance

    question 
    opened by Sineos 23
  • Cannot install plugin in Grafana 9.0.5 or 9.2.1

    Cannot install plugin in Grafana 9.0.5 or 9.2.1

    Hi! I am facing some issue to install the echart plugin. I donwoladed the ZIP file from grafana repository and extracted it into grafana path. Then I restarted grafana service and I can see the echart plugin in Grafana, but when I want to create a new panel and select the plugin, Grafana show me the following error message:

    Error loading: volkovlabs-echarts-panel

    The name of the ZIP from Grafana repository is: volkovlabs-echarts-panel-4.0.0.zip

    Some suggestion to solve this issue?

    BR Jorge

    question 
    opened by Jopinc 15
  • Dynamic treemap drill down

    Dynamic treemap drill down

    Hi, I found your amazing plug-in and a started to study and watch many YouTube video on your channel. I'm very interested to this graph https://echarts.apache.org/examples/en/editor.html?c=treemap-drill-down

    I didn't understand how to render dynamic my data source... Is there some video or web page to study?

    Naturally on my grafana test page I got... (it's clear to me 'cause into example there is a json file) ECharts Execution Error ROOT_PATH is not defined

    Thanks ALEN

    const uploadedDataURL = ROOT_PATH + '/data/asset/data/ec-option-doc-statistics-201604.json';
    myChart.showLoading();
    $.getJSON(uploadedDataURL, function (rawData) {
      myChart.hideLoading();
      function convert(source, target, basePath) {
        for (let key in source) {
          let path = basePath ? basePath + '.' + key : key;
          if (!key.match(/^\$/)) {
            target.children = target.children || [];
            const child = {
              name: path
            };
            target.children.push(child);
            convert(source[key], child, path);
          }
        }
        if (!target.children) {
          target.value = source.$count || 1;
        } else {
          target.children.push({
            name: basePath,
            value: source.$count
          });
        }
      }
      const data = {
        children: []
      };
      convert(rawData, data, '');
      myChart.setOption(
        (option = {
          title: {
            text: 'ECharts Options',
            subtext: '2016/04',
            left: 'leafDepth'
          },
          tooltip: {},
          series: [
            {
              name: 'option',
              type: 'treemap',
              visibleMin: 300,
              data: data.children,
              leafDepth: 2,
              levels: [
                {
                  itemStyle: {
                    borderColor: '#555',
                    borderWidth: 4,
                    gapWidth: 4
                  }
                },
                {
                  colorSaturation: [0.3, 0.6],
                  itemStyle: {
                    borderColorSaturation: 0.7,
                    gapWidth: 2,
                    borderWidth: 2
                  }
                },
                {
                  colorSaturation: [0.3, 0.5],
                  itemStyle: {
                    borderColorSaturation: 0.6,
                    gapWidth: 1
                  }
                },
                {
                  colorSaturation: [0.3, 0.5]
                }
              ]
            }
          ]
        })
      );
    });
    
    question 
    opened by acappelletti 14
  • Getting strange behaviour building my first panel

    Getting strange behaviour building my first panel

    query query2

    this query return 3 values about cpu usage but nothing work about the y axis, there is a way to work with multiple _value at the same time?

    i attach the Echart code for a better visualization

    `let Interrupt = []; let User = []; let DCP = []; data.series.map((s) => { Interrupt = s.fields.find((f) => f.name === 'Percent_Interrupt_Time').values.buffer; DCP = s.fields.find((f) => f.name === 'Percent_Interrupt_Time').values.buffer; User = s.fields.find((f) => f.name === 'Percent_Interrupt_Time').values.buffer; });

    const series = data.series.map((s) => { const sData = s.fields.find((f) => f.type === 'number').values.buffer; const sTime = s.fields.find((f) => f.type === 'time').values.buffer;

    return { name: s.name, type: 'line', showSymbol: false, areaStyle: { opacity: 0.1, }, lineStyle: { width: 1, }, data: sData.map((d, i) => [sTime[i], d.toFixed(2)]), }; });

    const axisOption = { axisTick: { show: false, }, axisLine: { show: false, }, axisLabel: { color: 'rgba(128, 128, 128, .9)', }, splitLine: { lineStyle: { color: 'rgba(128, 128, 128, .2)', }, }, };

    return { backgroundColor: 'transparent', tooltip: { trigger: 'axis', }, legend: { left: '0', bottom: '0', data: data.series.map((s) => s.name), textStyle: { color: 'rgba(128, 128, 128, .9)', }, }, xAxis: Object.assign( { type: 'time', }, axisOption ), yAxis: Object.assign( { data: Interrupt,DCP,User, type: 'value', }, axisOption ), grid: { left: 0, right: 16, top: 6, bottom: 24, containLabel: true, }, series, };`

    question 
    opened by AceSeanGG 13
  • Can not use Baidu Map on Grafana

    Can not use Baidu Map on Grafana

    Hi, I want to create a map on grafana use examples : https://echarts.apache.org/examples/en/editor.html?c=map-polygon I view https://echarts.apache.org/examples/en/editor.html?c=map-polygon and copy codes from it. But I got some error .

    TypeError: api.coord is not a function
        at renderItem (eval at <anonymous> (http://metrics.lunz.cn/public/plugins/volkovlabs-echarts-panel/module.js), <anonymous>:410:21)
        at eval (http://metrics.lunz.cn/public/plugins/volkovlabs-echarts-panel/module.js:2:2475521)
        at t.eval [as _add] (http://metrics.lunz.cn/public/plugins/volkovlabs-echarts-panel/module.js:2:2470868)
        at t._performRestAdd (http://metrics.lunz.cn/public/plugins/volkovlabs-echarts-panel/module.js:2:1418281)
        at t._executeOneToOne (http://metrics.lunz.cn/public/plugins/volkovlabs-echarts-panel/module.js:2:1417418)
        at t.execute (http://metrics.lunz.cn/public/plugins/volkovlabs-echarts-panel/module.js:2:1416984)
        at e.render (http://metrics.lunz.cn/public/plugins/volkovlabs-echarts-panel/module.js:2:2471036)
    

    Thanks for you help.

    question priority 
    opened by X-Mars 13
  • Apache ECharts Grafana and Websocket API

    Apache ECharts Grafana and Websocket API

    Hi, is it possible to render websocket data into an apache echart. Data are coming from grafana websocket plugin. For example i have 2 columns. category and count. category has fixed 5 values. I want to create a bar chart which updates with the latest counts of websocket incoming records

    enhancement question 
    opened by myrulezzz 12
  • Clock panel breaks inside the module

    Clock panel breaks inside the module

    @mikhail-vl Adding clock chart defaults in the module. Here is the example.

    This defaults in the console

    Uncaught ReferenceError: myChart is not defined at eval (eval at <anonymous> (module.js:1:1), <anonymous>:206:3) eval @ VM4093:206

    Which points to this line myChart.setOption<echarts.EChartsOption>({

    It is worth mentioning that the sample panel on eCharts site also has this code with <echarts.EChartsOption> which can be removed without any effect on the chart.

    clock-panel.txt

    enhancement 
    opened by supportdesk-si 12
  • Skipping loading plugin due to problem with signature

    Skipping loading plugin due to problem with signature

    Hi, When i was trying to install this plugin. i found out below error log from my /var/log/grafana/grafana.log, BTW: I already configureate this allow_loading_unsigned_plugins = volkovlabs-echarts-panel in my grafana.ini

    logger=plugin.manager t=2022-07-04T10:59:28.958393913+08:00 level=info msg="Plugin registered" pluginId=input
    
    logger=plugin.loader t=2022-07-04T10:59:29.082900685+08:00 level=warn msg="Could not find root URL that matches running application URL" plugin=volkovlabs-echarts-panel appUrl=http://xxxxxx:8080/ rootUrls="unsupported value type"
    
    logger=plugin.loader t=2022-07-04T10:59:29.082991956+08:00 level=warn msg="Skipping loading plugin due to problem with signature" pluginID=volkovlabs-echarts-panel status=invalid```
    question 
    opened by robinwangrubin 11
  • [Help] bar3D chart not rendering on Grafana

    [Help] bar3D chart not rendering on Grafana

    Hello,

    Really like your plugin for Grafana, but have problems rendering bar3D chart. The chart I am after is categorical chart over time. That is, I have time series for multiple sensor readings, something like this: | time1 | sensor1 | value1 | | time1 | sensor2 | value2 | | time2 | sensor1 | value3 |

    I would like to get the 3D bar chart with X axis being time, Y axis being sensor and Z axis the sensor reading value. However, I am not table to get it rendered on Grafana using your Echarts plugin.

    Things I've tried:

    1. Copy the code from Echarts example and update the code as in your Youtube videos. This resulted in the blue-ish screen on Grafana with no data visible.
    2. I've removed data object and instead used the code to extract data into arrays (as in your previous example), but that gave me the same result.
    3. Converting time column to text as a categorical value for X axis, but that got me the same result as before

    Other chart type (using Echarts) works as expected, for instance I can get time series plot on the same data.

    I've attached the screenshot and the code:

    const series = data.series.map((s) => {
      const y_axis_value = s.fields.find((f) => f.name === 'y_axis_value').values.buffer;
      const z_axis_value = s.fields.find((f) => f.name === 'z_axis_value').values.buffer;
      const date_values = s.fields.find((f) => f.name === 'time').values.buffer;
      return [date_values, y_axis_value, z_axis_value];
    });
    return {
      grid3D: {},
      tooltip: {},
      xAxis3D: {
        type: 'category',
        data: series[0]
      },
      yAxis3D: {
        type: 'category',
        data: series[1]
      },
      zAxis3D: {
        data: series[2]
      },
      visualMap: {
        max: 1000,
        dimension: series[2]
      },
      series: [
        {
          type: 'bar3D',
          shading: 'lambert',
          encode: {
            x: series[0],
            y: series[1],
            z: series[2]
          }
        }
      ]
    };
    

    question

    Any hints and help would be highly appreciated :)

    enhancement 
    opened by Sarunas-Girdenas 9
  • Size of maps

    Size of maps

    I am doing a map where I want to show the status of some gauges.

    My problem is that the map does not expand to the whole available space: image

    I would like for it to show as big as possible keeping the same aspect ratio of course. Any idea why there are those big margins and how to solve the issue?

    My code:

    var option;
    $.ajax({
      async: false,
      type: 'GET',
      url: 'https://control.ifae.es/scheme_bluefors.svg',
      success: function (svg) {
        console.log(echarts);
        echarts.registerMap('scheme_bluefors', { svg: svg });
        option = {
          tooltip: {},
          visualMap: {
            show: false,
            left: 'center',
            bottom: '10%',
            min: 0,
            max: 1,
            realtime: true,
            calculable: true,
            inRange: {
              color: ['#f33', '#23f']
            }
          },
          series: [
            {
              name: 'Bluefors Scheme',
              type: 'map',
              map: 'scheme_bluefors',
              roam: true,
              emphasis: {
                label: {
                  show: false
                }
              },
              selectedMode: false,
              data: [
                { name: 'V21', value: 0 },
                { name: 'V22', value: 1 },
              ]
            }
          ]
        };
      }
    });
    
    return option;
    

    Here I still have to do the connection with the data from influxdb.

    Thank you very much!

    question 
    opened by otger 8
  • Add Baidu map support

    Add Baidu map support

    We can use Baidu map now. The ak for test is wINcgFmL1HyM7gWoQ5uPu6Xt9szz3chV , I will delete it after merged. The options for test is

    option = {
            tooltip: {
              trigger: "item",
            },
            bmap: {
              // 地图展示的中心,即加载时首先出现在人眼前的点
              center: [104.114129, 37.550339], 
              // 当前地图缩放的大小,如果是一个省内的一些地方,那么zoom值应该设置得大点
              // 设置的初始值大小应根据要展示的数据而定
              zoom: 5, 
              roam: true, //允许缩放
              // 个性化地图
              mapStyleV2: {},
            },
          };
    return option;
    
    enhancement priority 
    opened by X-Mars 8
  • Filter arrays from datasource

    Filter arrays from datasource

    I can convert one-dimensional arrays into many-dimensional arrays (like the example at https://volkovlabs.io/plugins/volkovlabs-echarts-panel/datasources/ ) . The arrays are based on a table (as a result from a query), for example with 3 columns: year, valueX, valueY
    My query filters on country by using a variable in grafana. Now I have to rerun my query to filter the data to new table values if I change the variable to another country. This takes query calculationtime.

    If I add the country column to my table, I only have to run my query ones. But then I have to filter in grafana/echarts on the variable (column) 'countries', is this possible?

    question 
    opened by slindersAmsterdam 3
  • Grafana query annotations (Vertical dashed lines ) not showing

    Grafana query annotations (Vertical dashed lines ) not showing

    grafana query annotations (Vertical dashed lines ) that are displayed for standard grafana time series panels are not displayed for Echarts panels.

    is there a solution or is not currently supported?

    enhancement priority 
    opened by giomilan 26
  • Add Theming Options to allow Custom Themes

    Add Theming Options to allow Custom Themes

    I am thinking to add a Panel Option for Themes: 'Auto', 'Dark', 'Light', 'Custom'.

    With a 'Custom' Theme you can specify your own theme for all components. It will be a great feature!

    enhancement 
    opened by mikhail-vl 2
Releases(v4.0.0)
Owner
Volkov Labs
Custom plugin development for Grafana
Volkov Labs
A status monitor for Elite Dangerous, written in PHP. Designed for 1080p screens in the four-panel-view in panel.php, and for 7 inch screens with a resolution of 1024x600 connected to a Raspberry Pi.

EDStatusPanel A status monitor for Elite Dangerous, written in PHP. Designed for 1080p screens in the four-panel-view in panel.php, and for 7 inch scr

marcus-s 24 Oct 4, 2022
Gatsby-Formik-contact-form-with-backend-panel - Full working contact form with backend GUI panel.

Gatsby minimal starter ?? Quick start Create a Gatsby site. Use the Gatsby CLI to create a new site, specifying the minimal starter. # create a new Ga

Bart 1 Jan 2, 2022
A modern client panel for the Pterodactyl® panel, made by Wrible Development.

Dashboardsy A modern client panel for the Pterodactyl® panel, made by Wrible Development. Support Discord: https://discord.gg/zVcDkSZNu7 Screenshots S

Wrible Development 23 Jan 1, 2023
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
RSS/Atom data source plugin for @grafana.

RSS/Atom data source plugin for Grafana Introduction The RSS/Atom data source is a plugin for Grafana that retrieves RSS/Atom feeds and allows to visu

Volkov Labs 9 Jan 2, 2023
Balena Application plugin for @grafana.

Balena Application plugin for Grafana Introduction The Balena Application plugin for Grafana allows to display device information and manage services

Volkov Labs 15 Jan 2, 2023
Use real-time computing technology and web technology to build a big data Kanban l to solve the problem. Among them, practical technologies include MySQL, Kafka, Flink, Redis, Flask and Echarts

实时计算(English Version) 运用实时计算技术、Web 技术构建一个大数据看板来解决问题。其中实用技术包括Mysql、Kafka、Flink、Redis、Flask和Echarts 目录 1.问题需求 2.方案分析 3.安装环境 4.环境启动命令和运行代码的方法 5.代码目录结构说明

Serendipity 2 Jan 8, 2022
Displays environment variables on your Grafana dashboards

Displays environment variables on your Grafana dashboards Introduction The Environment data source is a plugin for Grafana that returns environment va

Volkov Labs 7 Dec 26, 2022
The Trino datasource allows to query and visualize Trino data from within Grafana.

Trino Grafana Data Source Plugin The Trino datasource allows to query and visualize Trino data from within Grafana. Getting started Drop this into Gra

Starburst 13 Nov 3, 2022
Add GeoIP && UA-Parser support for Grafana Loki

loki-enhance-middleware loki-enhance-middleware hijacks log push requests sent to loki and modifies it. Deploy docker-compose.yaml services: loki:

WangLei 5 Dec 10, 2022
An Apache Kafka prototyping and monitoring tool.

Design and scale a real-time streaming data pipeline at the click of a button. evaStudio (beta) is a web GUI and testing playground for quickly design

OSLabs Beta 58 Nov 2, 2022
A web panel to manage TP-Link/Kasa smart home devices.

TP-Link Web Panel A web panel to manage TP-Link/Kasa smart home devices. Prerequisites Node.js v16.13.1 or higher Yarn Installation Run git clone http

Milan M 3 Apr 1, 2022
A simple element template chooser for properties-panel >= 1

A simple element template chooser for properties-panel >= 1

bpmn.io 9 May 30, 2022
A frontend framework containing of tools for fast development of dashboard, panel, etc.

Khaos-Admin A frontend framework containing of tools for fast development of dashboard, panel, etc. Tools We Provide Fast Development: We handle data

Hamrah Mechanic 7 Nov 27, 2022
RWP stands for Roblox web panel, it's a code snippet that you can run via developer console or the provided Google Chrome extension to try out early

RWP stands for Roblox web panel, it's a code snippet that you can run via developer console or the provided Google Chrome extension to try out early Roblox site features before they're officially out without any programming experience.

null 10 Nov 28, 2022
NX workspace for running medusa backend, storefront and admin panel with marketplace functionalities

Medusa Marketplace Project status Assigned store_id to Order, Product to make them store specific Create and process payment for an order with multipl

Keith Hon 8 Nov 13, 2022
Your Ethereum control panel. Interact with smart contracts on Ethereum.

etherfunk Your Ethereum control panel. Interact with smart contracts on Ethereum. ?? https://etherfunk.io ?? Devleopment First, run the development se

Tom Quirk 23 Sep 24, 2022