diff --git a/README.md b/README.md index 228485c..71d55bf 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ rich interactive react charting components using [chart.js](http://www.chartjs.o * Line chart * Bar chart +* HorizontalBar chart * Radar chart * Polar area chart * Pie chart diff --git a/lib/core.js b/lib/core.js index 3da694b..5cfe610 100644 --- a/lib/core.js +++ b/lib/core.js @@ -73,7 +73,12 @@ module.exports = { classData.initializeChart = function(nextProps) { var el = ReactDOM.findDOMNode(this); var ctx = el.getContext("2d"); - var type = (chartType === 'PolarArea') ? 'polarArea':chartType.toLowerCase(); + var convertToType = function(string) { + if(string === 'PolarArea') { return 'polarArea'; } + if(string === 'HorizontalBar') { return 'horizontalBar'; } + return string.toLowerCase(); + }; + var type = convertToType(chartType); this.state.chart = new Chart(ctx, { type: type, diff --git a/lib/horizontal-bar.js b/lib/horizontal-bar.js new file mode 100644 index 0000000..1e51b3a --- /dev/null +++ b/lib/horizontal-bar.js @@ -0,0 +1,3 @@ +var vars = require('./core'); + +module.exports = vars.createClass('HorizontalBar', ['getHorizontalBarsAtEvent']);