Outline of Adding a New Graph Type
This is a quick write up as I commit a new graph type. To be fleshed out.
Our new graphing backend, Grapher, supports different graph types from different backends. To add a new graph type - let's call it
Example - you need to do the following:
- Create a graph class for this new type called
app/Services/Grapher/Graph/Example.php. This must extend the abstract class
- Add an
app/Services/Grapher.phpwhich instantiates the above graph object.
- Update the appropriate backend file(s) (
app/Services/Grapher/Backend/xxx) to handle this new graph file. I.e. create the actual implementation for getting the data to process this graph.
- Add your graph to the
supports()function in the appropriate backends (and the
To serve this graph over HTTP:
Create a GET route in
- Create a function to handle the GET request in
- Add functionality to the middleware to process a graph request:
Here's a great example from a Github commit.
Adding a New MRTG Graph
Here is an example of adding broadcast graphs to MRTG.