Hi everyone !
I want to develop a plugin graph like, with annotation to display events associated to dates on it (with checkbox)
I’m relativly new at grafana. I started by learn javascript and html, some of the community suggested me the flotchart library for plot and I finally learned how to use Webpack for minification and transpiler.
Now I don’t really know how to order the code, I mean how grafana reads it.
I understand that grafana launch first the constructor and exectue all inside. Then the plugin is manage by event (listed on the documentation).
But I don’t really understand where I’m suppose to write the ‘$.plot’ command to create the graph…
I know that this should sounds like big big noob but I spent several days now on it and I think the work is almost done.
For the moment, my module.js looks like this :
import {MetricsPanelCtrl} from './sdk.ts';
import kbn from 'app/core/utils/kbn';
const panelDefaults = {
//clockType: '24 hour',
fontSize: '60px',
fontWeight: 'normal',
bgColor: null
};
export class graph extends MetricsPanelCtrl {
constructor($scope, $injector, $rootScope) {
super($scope, $injector);
_.defaults(this.panel, panelDefaults);
this.events.on('init-edit-mode', this.onInitEditMode.bind(this));
this.setLegendWidthForLegacyBrowser();
};
onInitEditMode() {
this.addEditorTab('Options', 'public/plugins/jojo-CoquilleVide-panel/editor.html', 2);
this.unitFormats = kbn.getUnitFormats();
this.plot("#placeholder", dataset, options);
}
setLegendWidthForLegacyBrowser() {
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
if (isIE11 && this.panel.legendType === 'Right side' && !this.panel.legend.sideWidth) {
this.panel.legend.sideWidth = 150;
}
}
};
graph.templateUrl = 'module.html';
export { graph as PanelCtrl };
Do someone explain me a few or post here some useful documentation for plugin devellpement (of course I already read all the documentation provide by grafana)
I really learn a lot of think this last two weeks !! I don’t what my grafana-adventur stop now.
For the moment, grafana put me the error :
app is not defined Evaluating http://localhost:8080/public/plugins/grafana-Coquille-panel/module.js Loading plugins/grafana-Coquille-panel/module
Thanks a lot for those who will respond and help me !