-
What Grafana version and what operating system are you using?
Grafana 11, Windows, InfluxDB2.0, querying with Flux -
What are you trying to achieve?
Create a graph visualization of each column names as x-axis and the row values in y-axis -
How are you trying to achieve it?
Query a table with columns x1…xn and set it as x-axis.
Then set the data values where each row is one graph.
-
What happened?
Clueless how to bring that queried data to the javascript code. -
What did you expect to happen?
This is what happened with a static data (also see code below for reference!)
-
Can you copy/paste the configuration(s) that you are having problems with?
Here’s the code in JavaScript for static values:
const columns = ["X_1", "X_2", "X_3", "X_4", "X_5", "X_6", "X_7", "X_8", "X_9", "X_10", "X_11", "X_12", "X_13", "X_14", "X_15", "X_16"];
const data = [-0.63, 1.86, 0.36, 0.05, -2.48, 1.68, 1.34, 0.31, -0.94, 4.12, 0.55, 1.55, -0.55, 2.56, 1.85, 1.96]; // Example data from one row
const seriesData = columns.map((col, index) => ({ name: col, value: data[index] }));
const options = {
backgroundColor: 'transparent',
tooltip: {
trigger: 'axis',
},
legend: {
data: ['Values'],
textStyle: {
color: 'rgba(128, 128, 128, .9)',
},
},
xAxis: {
type: 'category',
data: columns,
axisLabel: {
interval: 0,
rotate: 45,
},
},
yAxis: {
type: 'value',
},
series: [
{
name: 'Values',
type: 'line',
data: seriesData,
},
],
};
return options;
- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
Not really. - Did you follow any online instructions? If so, what is the URL?
The official business graph tutorials don’t have examples of dynamic data fetches…