Skip to content

cjam/gitbook-plugin-graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitbook-plugin-graph

This plugin is a very thin wrapper around function-plot.

To use this plugin within gitbook you must simply add the plugin to your book.json:

"plugins": ["graph"]

And then you can add graphs within your pages like so:

{% graph %}
    {
        "title":"cos(2*PI*x/2)*(1+0.5cos(2*PI*x/100))",     
        "grid":true,
        "xAxis": {
            "label":"Sample",
            "domain": [0,300]
        },
        "yAxis": {
            "label":"Amplitude",
            "domain": [-1.5,1.5]
        },
        "data": [
            { "fn": "cos(2*PI*x/2)*(1+0.5cos(2*PI*x/100))"},         
            { "fn": "(1+0.5cos(2*PI*x/100))"}
        ]
    }
{% endgraph %}

Inside the {% graph %} tags you just need to place valid JSON that can be passed in as the function-plot options

Future Work

function-plot is a browser only library and is not compatible with being used within node. So ebook rendering at this point won't be possible. I'm sure there are ways around it using something like phantom, but for now I've taken the naiive approach and made it work within the browser.

About

Simple Graph Plugin for gitbook

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published