bbc/news-vj-chart-renderer

Name: news-vj-chart-renderer

Owner: BBC

Description: Display a chart given a set data structure

Created: 2015-12-23 16:58:09.0

Updated: 2016-02-02 15:02:06.0

Pushed: 2016-11-15 15:00:03.0

Homepage: null

Size: 170

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

news-vj-chart-renderer

Display charts using different JavaScript libraries via a single API

Using the chart renderer

See the examples folder simple and advanced use cases.

Set up paths using RequireJs to newsVjChartRenderer.js, your selected library and the corresponding module under chartRenderingModules/ then call newsVjChartRenderer.initChart with some config.

config = {
data:             {
    labels : ['Vienna', 'Zurich', 'Auckland', 'Munich', 'Vancouver', 'Dusseldorf', 'Frankfurt'],
    datasets: [[65, 59, 90, 81, 56, 55, 40]]
},
domElementId:     'chart_3',
chartLibraryName: 'chartjs',
chartLibrary:     chartjs,
chartType:        'chartjs-vertical-bar',
chartOpts:  {},
customDatasetOpts: []


renderer = newsVjChartRenderer.initChart(config);
chart = renderer.displayChart();
Supported Libraries & Charts

Chart.js Vertical bar, Line and Pie charts are currently supported. More libraries and charts will follow.

Contributing

Add modules to the chartRenderingModules folder following the same structure / api as chartRenderingModules/chartjsRenderer.js. Write tests, make sure they pass and lint nicely then issue a PR.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.