Currently I build a HTML chart using external Javascript library.
I would like to know is HTML panel able to use the data source plugin inside the Grafana to get the same data as other panel and visualize the charts ?
Don’t know if you’re still into this subject, but I came across this plugin:
I don’t find any examples of what you can do with it, but I think the main idea is indeed to query data from any data source and use it in your own designed html page.
@https://grafana.com/orgs/aidanmountford@aidanmountford Is this correct?
Step 2: Access data in HTML/JavaScript
Referring to ctrl.data[0].rows[0] gives me the result in JSON format {"name":"Rafael Nadal","age":34}, as you can see I printed it on the HTML panel.
And… Here’s some thoughts
Right above the JavaScript code section, it says
JavaScript Code: onHandleMetric(ctrl, htmlnode)
* This code is executed upon every refresh
* @param {MetricsPanelCtrl} ctrl Instance of current grafana panel object.
* @param {HTMLElement} htmlnode Html DOM node containi html data.
HTML
So the object ctrl actually has all the information about this panel, such as data you queried and panel attributes etc.
Perhaps data format returned from other datasources would be different from MySQL, but I guess the data can still be found in the ctrl object.
Open your browser’s web console and input this line console.log(ctrl) into JavaScript code block, you are able to discover what attributes the ctrl object has.