When I modify the graph, how to build it as a plugin?


In my company , we use grafana to monitor some datas on TV.

For convenience ,we want graph instance can automatic change metrics one by one every few seconds .

I make a little change on the graph source code. and implement the function .

1). Add ‘auto play’ option for graph legend . If it is checked, the graph instance will has the automatic change metrics function . If it is unchecked, the graph will not has the function.
2). ‘play’ button is clicked will launch the function.
3). ‘pause’ button is clicked will pause the function.

The following two pictures show that ,a panel instance’s (in the red frame) ‘auto play’ option is checked in the dashboard.

I’ve implemented the function , could I build the modified graph to generate a plugin. If I can , other team could use it easily. Just put it locate under
‘/usr/local/var/lib/grafana/plugins’ directory.

if personal functions plugin can build out , put it locate under
‘/usr/local/var/lib/grafana/plugins’ directory. We can upgrade grafana often, after upgrade, we can both use the latest grafana, and personal functions plugin .

how to generate the modified graph plugin ? thank you .

Hi @aa125791202! Yes you should be able to build that as a panel plugin, and then install as you describe.

What have you tried so far in terms of building and packaging the code? Did you use a tutorial (like Build a panel plugin | Grafana Labs)?

at first, modify the source code to implement the function .

after that , try to build the plugin.

  1. npm run build

    generate some thing, but not a plugin.

  2. copy the source code to project grafana-starter-panel
    failed to build

now I think what should I do is not modify the source code, but do it as the tutorial(Build a panel plugin | Grafana Labs). extend or use the graph from ‘@grafana/ui/components’

@sevtb thank you for your remind.