Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Include HorizontalBar as an available type #122

Merged
merged 3 commits into from
Apr 6, 2017

Conversation

OddEssay
Copy link

This adds horizontalBar as an available type of chart.

There is a small refactor to the way the type passed into chart.js to account for more that can be covered by a simple ternary assignment.

@@ -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();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also write it dynamically in order to allow future types as well:

var type = chartType.charAt(0).toLowerCase() + chartType.slice(1);

@achanda
Copy link

achanda commented Apr 6, 2017

Can we merge this, please?

@austinpray austinpray merged commit 362e0e5 into reactjs:chartjs-v2 Apr 6, 2017
@achanda
Copy link

achanda commented Apr 6, 2017

Thanks for taking care of this @austinpray ! When can we expect a new release on npm with this fix?

@austinpray
Copy link
Member

published as 2.0.0-beta1

@achanda
Copy link

achanda commented Apr 6, 2017

Thanks for publishing it. npm still shows 0.8.0 though. This is the one, right?
https://www.npmjs.com/package/react-chartjs

@evanheisler
Copy link

evanheisler commented Apr 11, 2017

@achanda you can install the specific version with npm install [email protected] which does in fact have these changes, however I still couldn't render a horizontal bar chart.

To do so, I had to add the export to index.js:

module.exports = {
  Bar: require('./lib/bar'),
  HorizontalBar: require('./lib/horizontal-bar'),
...

Edit: Just opened a pull request #179

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants