How to add custom transformation?

I would like to do fft on my timeseries. Is there an option to include custom user defined transformation. Maybe option to run Typescript?

I am using SQL server and it does not have FFT support.


What kind of visualization are you using?

Thanks. I am using the default timeseries panel.

Note: since fft x-axis is in hertz and not time, I can convert that to milliseconds and render. We are not showing time picker in our dashboard, so users will not know this is in time and notice any challenges.

If fft is doable in js/ts I would go with apache echart plugin for grafana

Or write a nodejs rest api that does fft using your sql data
Or flask api

Or crunch the numbers using oython and an fft librsry to write back the results to sql

1 Like

@selvavm As @yosiasz suggested, it should be possible to implement it in the Apache Echarts Panel:

Thank you for the suggestion. I have setup the plugin and learnt about Echart. Did a basic chart but not sure how to include FFT library in it.

I tried below,

var fft = require('fft-js').fft;
let values1 = [Math.random() * 15001];
let values2 = [Math.random() * 15001];
let data1 = [];
let data2 = [];
for (let i = 1; i < 20000; i++) {
  values1.push(Math.round((Math.random() - 0.5) * 20 + values1[i - 1]));
  values2.push(Math.round((Math.random() - 0.5) * 20 + values2[i - 1]));
  data1.push([i, fft(Math.round((Math.random() - 0.5) * 20 + values1[i - 1]))]);
  data2.push([i, Math.round((Math.random() - 0.5) * 20 + values2[i - 1])]);

and I am getting below error,

Synchronous require cannot resolve module 'fft-js'. This is the first mention of this module!

This is my first time in JS, so not sure how to install fft-js.Could you please support on this?

It would have to be compiled unto apache echart.

That is why I recommended the other options especially if first time in JS

Are you familiar with python or powershell or some other scripting language? @selvavm

@selvavm I will look and reply in the opened GitHub issue.