Grapher
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 classapp/Services/Grapher/Graph.php
. - Add an
example()
function toapp/Services/Grapher.php
which 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 theapp/Services/Grapher/Backend/Dummy
backend). -
To serve this graph over HTTP:
-
Create a GET route in
app/Providers/GrapherServiceProvider.php
- Create a function to handle the GET request in
app/Http/Controllers/Services/Grapher.php
- Add functionality to the middleware to process a graph request:
app/Http/Middleware/Services/Grapher.php
Here's a great example from a Github commit.
Adding a New MRTG Graph
Here is an example of adding broadcast graphs to MRTG.