1.0.0 • Published 6 years ago

@ivantha/graphjs v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

GraphJS logo

GraphJS

Codacy Badge Build Status Coverage Status

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

1) 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

2) Modify your chart using the suitable grammar

chart.do("hide tooltip")
chart.do('set gridline x at 20 as another-x')

3) Export the JSON string of the chart using,

let jsonOut = chart.generateJson()

4) Generated JSON output is fully complient with the C3.js library

let chart = c3.generate(jsonOut)

Development

NPM scripts

  • npm run esdoc: Generate documentation
  • npm run webpack: Generate minified graphjs.min.js
  • npm run babel: Generate the compiled ES6 source files
  • npm run build: Build everything
  • npm run clean: Clean the build files
  • npm run test: Run all tests

Built With

Authors

Acknowledgments