@ivantha/graphjs
v1.0.0
Published
A simple grammar to convert raw data into visual graphs
Downloads
7
Readme
GraphJS
A javascript library written in ES6 for parsing a simple grammar which is fully complient with C3.js.
Demo | API Documentation | Developer documentation | Contributing | Code of Conduct |
The GraphJS library is exported as a UMD module.
GraphJS is released under the MIT license & supports modern environments.
Gettings Started
Installation
In a browser:
<script src="graphjs.min.js"></script>
Using npm:
$ npm i --save @ivantha/graphjs
Usage
- Initialize a chart using the Graph class
let chart = new Graph("generate <CHART_TYPE> from <JSON_DATASOURCE>")
Chart type can be any one of,
- LINE_CHART
- SIMPLE_XY_LINE_CHART
- STEP_CHART
- BAR_CHART
- PIE_CHART
- COMBINATION_CHART
- MULTIPLE_XY_LINE_CHART
- AREA_CHART
- STACKED_BAR_CHART
- DONUT_CHART
- SPLINE_CHART
- LINE_CHART_WITH_REGIONS
- STACKED_AREA_CHART
- SCATTER_PLOT
- GUAGE_CHART
- Modify your chart using the suitable grammar
chart.do("hide tooltip")
chart.do('set gridline x at 20 as another-x')
- Export the JSON string of the chart using,
let jsonOut = chart.generateJson()
- Generated JSON output is fully complient with the C3.js library
let chart = c3.generate(jsonOut)
Development
NPM scripts
npm run esdoc
: Generate documentationnpm run webpack
: Generate minified graphjs.min.jsnpm run babel
: Generate the compiled ES6 source filesnpm run build
: Build everythingnpm run clean
: Clean the build filesnpm run test
: Run all tests
Built With
Authors
- Oshan Mudannayake - Initial work - OshanIvantha