@@ -6,5 +6,25 @@ page_keywords: grafana, plugins, documentation, development
...
@@ -6,5 +6,25 @@ page_keywords: grafana, plugins, documentation, development
# Plugin development
# Plugin development
TODO
From grafana 3.0 it's very easy to develop your own plugins and share them with other grafana users.
## What languages?
Since everything turns into javascript its up to you to choose which language you want. That said its proberbly a good idea to choose es6 or typescript since we use es6 classes in Grafana.
##Buildscript
You can use any buildsystem you like that support systemjs. All the built content should endup in a folder named dist and commited to the repository.
##Loading plugins
The easiset way to try your plugin with grafana is to [setup grafana for development](https://github.com/grafana/grafana/blob/master/DEVELOPMENT.md) and place your plugin in the /data/plugins folder in grafana. When grafana starts it will scan that folder for folders that contains a plugin.json file and mount them as plugins. If your plugin folder contains a folder named dist it will mount that folder instead of the plugin base folder.
## Examples / boilerplate
We currently have three different examples that you can fork to get started developing your grafana plugin.
-[generic-datasource](https://github.com/grafana/grafana/tree/master/examples/datasource-plugin-genericdatasource)(small datasource plugin for quering json data from backends)
@@ -25,4 +25,5 @@ MetricsPanelCtrl inherits from PanelCtrl and adds some common features for datas
...
@@ -25,4 +25,5 @@ MetricsPanelCtrl inherits from PanelCtrl and adds some common features for datas
## Implementing a MetricsPanelCtrl
## Implementing a MetricsPanelCtrl
If you choose to inherit from MetricsPanelCtrl you should implement a function called refreshData that will be called by grafana when its time for all panels to get new data.
If you choose to inherit from MetricsPanelCtrl you should implement a function called refreshData that will take an datasource as inparameter when its time to get new data. Its recommended that the refreshData function calls the issueQueries in the base class but its not mandatory. An examples of such implementation can be found in our [example panel](https://github.com/grafana/grafana/blob/master/examples/panel-boilerplate-es5/module.js#L27-L38)