Skip to content

Commit 61caba3

Browse files
jerairrestgor181
authored andcommitted
Release 2.0.0 (#88)
Make chart.js pearDependency Add chart.js to devDependencies Patch tests due bug in chart.js 2.4.0 (chartjs/Chart.js#3608)
1 parent bf9981c commit 61caba3

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55

66
# react-chartjs-2
77

8-
React wrapper for [Chart.js 2](http://www.chartjs.org/docs/#getting-started)
8+
React wrapper for [Chart.js 2](http://www.chartjs.org/docs/#getting-started)
99
Open for PR's and contributions!
1010

11-
# UPDATE
11+
# UPDATE to 2.x
12+
As of 2.x we have made chart.js a peer dependency for greater flexibility. Please add chart.js as a dependency on your project to use 2.x. Currently, 2.4.x is the recommended version of chart.js to use.
13+
14+
# Looking for Contributors!
1215
Actively looking for contributors as for the moment I do not have enough time to dedicate for maintaining this lib.
1316
All contributors can add themselves to Contributors section at the bottom of README.
1417

@@ -70,7 +73,7 @@ In order for Chart.js to obey the custom size you need to set `maintainAspectRat
7073
/>
7174
```
7275

73-
### Chart.js instance
76+
### Chart.js instance
7477
Chart.js instance can be accessed by placing a ref to the element as:
7578

7679
```js
@@ -170,13 +173,13 @@ Looks for the element under the event point, then returns all elements from that
170173

171174
To build, watch and serve the examples (which will also watch the component source), run `npm start`. If you just want to watch changes to `src` and rebuild `lib`, run `npm run watch` (this is useful if you are working with `npm link`).
172175

173-
## Thanks
176+
## Thanks
174177

175178
Jed Watson for making react-component yo builder!
176179

177180
## License
178181

179-
MIT Licensed
182+
MIT Licensed
180183
Copyright (c) 2016 Goran Udosic
181184

182185
## Contributors

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"url": "https://github.com/gor181/react-chartjs-2/issues"
1414
},
1515
"dependencies": {
16-
"chart.js": "~2.3.0",
1716
"lodash.isequal": "^4.4.0"
1817
},
1918
"devDependencies": {
@@ -27,6 +26,7 @@
2726
"brfs": "^1.4.3",
2827
"canvas": "^1.6.2",
2928
"chai": "^3.5.0",
29+
"chart.js": "^2.3.0",
3030
"debug": "^2.4.1",
3131
"enzyme": "^2.6.0",
3232
"eslint": "^1.6.0",
@@ -41,6 +41,7 @@
4141
"sinon": "^1.17.6"
4242
},
4343
"peerDependencies": {
44+
"chart.js": "^2.3",
4445
"react": "^0.14 || ^15.0.0-rc || ^15.0",
4546
"react-dom": "^0.14 || ^15.0.0-rc || ^15.0"
4647
},
@@ -62,6 +63,8 @@
6263
"keywords": [
6364
"chart",
6465
"chart-js",
65-
"chart.js"
66+
"chart.js",
67+
"react-chartjs-2",
68+
"react chart.js"
6669
]
6770
}

test/__tests__/Chart_spec.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { expect } from 'chai';
44
import { jsdom } from 'jsdom';
55
import sinon from 'sinon';
66

7-
import Chart from '../../src/index';
7+
import Chart, { Chart as ChartConstructor } from '../../src/index';
88

99
const noop = () => {};
1010
const createDOM = () => jsdom('<!doctype html><html><body><div></div></body></html>');
@@ -27,6 +27,14 @@ describe('<Chart />', () => {
2727
]
2828
};
2929

30+
ChartConstructor.plugins.register({
31+
afterInit: function (chartInstance) {
32+
chartInstance.getDatasetAtEvent = function (e) {
33+
return ChartConstructor.Interaction.modes.dataset(this, e, this.options);
34+
};
35+
}
36+
});
37+
3038
const mountComponent = props => mount(
3139
<Chart data={data} {...props} />,
3240
{ attachTo: DOM.body.firstChild }

0 commit comments

Comments
 (0)