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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Display charts using different JavaScript libraries via a single API
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();
Chart.js Vertical bar, Line and Pie charts are currently supported. More libraries and charts will follow.
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.