Hello, I am a beginner on Grafana.
I have to make a pie chart.
My data source is a SimpleJson and when I click on Save & test, I get “Data source is working”.
Here is my php backend file:
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: accept, content-type');
header('Access-Control-Allow-Methods: POST');
header('Content-Type: application/json');
$uri = $_SERVER['REQUEST_URI'];
switch ($uri) {
case '/':
break;
case '/search':
echo json_encode(["Browser","Revenue"]);
break;
case '/query':
$responseQuery = [
"columns" => [
['text' => 'Browser', 'type' => 'string'],
['text' => 'Revenue', 'type' => 'number']
],
"rows" => [
['Chrome', 78952],
['Edge', 43256],
['Firefox', 20365]
],
"type" => "table"
];
echo json_encode($responseQuery);
break;
case '/annotations':
echo "requete annotations";
break;
default:
echo "requete non prise en charge";
}
In the grafana interface, I choose “Add a new panel” and visualization: pie chart.
I click on “+Query” and choose “table” and metric: “Revenue”.
My problem is that I always see “No data” displayed.
Can you please help me to achieve my goal?
Sorry for my English.
Thank you