Skip to content

Commit 21bfc79

Browse files
committed
Update plugin according to 7.14.0. Update examples
1 parent ebb4dae commit 21bfc79

File tree

13 files changed

+622
-541
lines changed

13 files changed

+622
-541
lines changed

dist/anychart-react.js

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var _react = require('react');
1212

1313
var _react2 = _interopRequireDefault(_react);
1414

15+
require('anychart');
16+
1517
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1618

1719
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
@@ -22,23 +24,49 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
2224

2325
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2426

25-
require('anychart')(document.defaultView);
26-
27+
/**
28+
* AnyChart React plugin.
29+
*/
2730
var AnyChart = function (_React$Component) {
2831
_inherits(AnyChart, _React$Component);
2932

3033
function AnyChart(props) {
3134
_classCallCheck(this, AnyChart);
3235

36+
/**
37+
* Instance (stage or chart).
38+
* @type {Object}
39+
*/
3340
var _this = _possibleConstructorReturn(this, (AnyChart.__proto__ || Object.getPrototypeOf(AnyChart)).call(this, props));
3441

3542
_this.instance = null;
43+
44+
/**
45+
* Whether instance is stage.
46+
* @type {boolean}
47+
*/
3648
_this.isStage = false;
49+
50+
/**
51+
* Should we dispose instance or not.
52+
* @type {boolean}
53+
*/
3754
_this.disposeInstance = false;
38-
_this.multipleEntities = ['xAxis', 'yAxis', 'lineMarker', 'rangeMarker', 'textMarker'];
55+
56+
/**
57+
* Properties of AnyChart which expected as array of [entity_index, json].
58+
* E.g. <AnyChart yAxis={[1, {orientation: 'right'}]} />
59+
* @type {Array.<string>}
60+
*/
61+
_this.multipleEntities = ['xAxis', 'yAxis', 'lineMarker', 'rangeMarker', 'textMarker', 'grid', 'minorGrid'];
3962
return _this;
4063
}
4164

65+
/**
66+
* Remove instance (dispose it if necessary).
67+
*/
68+
69+
4270
_createClass(AnyChart, [{
4371
key: 'removeInstance',
4472
value: function removeInstance() {
@@ -48,11 +76,24 @@ var AnyChart = function (_React$Component) {
4876
}
4977
}
5078
}
79+
80+
/**
81+
* Checker for array.
82+
* @param {*} value Value to check.
83+
* @return {boolean}
84+
*/
85+
5186
}, {
5287
key: 'isArray',
5388
value: function isArray(value) {
5489
return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object' && value instanceof Array;
5590
}
91+
92+
/**
93+
* Applies props.
94+
* @param {Object} props Properties.
95+
*/
96+
5697
}, {
5798
key: 'applyProps',
5899
value: function applyProps(props) {
@@ -91,6 +132,12 @@ var AnyChart = function (_React$Component) {
91132
}
92133
}
93134
}
135+
136+
/**
137+
* Create instance to render chart or use instance property.
138+
* @param {Object} props Properties.
139+
*/
140+
94141
}, {
95142
key: 'createInstance',
96143
value: function createInstance(props) {
@@ -111,6 +158,12 @@ var AnyChart = function (_React$Component) {
111158
if (this.instance) this.instance.container(props.id || 'ac-chart-container');
112159
delete props.id;
113160
}
161+
162+
/**
163+
* Draws chart.
164+
* @param {Object} props Properties.
165+
*/
166+
114167
}, {
115168
key: 'drawInstance',
116169
value: function drawInstance(props) {
@@ -151,23 +204,46 @@ var AnyChart = function (_React$Component) {
151204
this.instance.draw();
152205
}
153206
}
207+
208+
/**
209+
* Method that
210+
* @param {Object} prevProps
211+
*/
212+
154213
}, {
155214
key: 'createAndDraw',
156215
value: function createAndDraw(prevProps) {
157216
var props = Object.assign(prevProps, this.props);
158217
this.createInstance(props);
159218
this.drawInstance(props);
160219
}
220+
221+
/**
222+
* Render container for future chart drawing.
223+
*/
224+
161225
}, {
162226
key: 'render',
163227
value: function render() {
164228
return _react2.default.createElement('div', { id: this.props.id || 'ac-chart-container' });
165229
}
230+
231+
/**
232+
* Component has rendered.
233+
*/
234+
166235
}, {
167236
key: 'componentDidMount',
168237
value: function componentDidMount() {
169238
this.createAndDraw({});
170239
}
240+
241+
/**
242+
* Component has re-rendered.
243+
* @param {Object} prevProps Previous properties.
244+
* @param {Object} prevState Previous state.
245+
*/
246+
171247
}, {
172248
key: 'componentDidUpdate',
173249
value: function componentDidUpdate(prevProps, prevState) {
@@ -176,6 +252,11 @@ var AnyChart = function (_React$Component) {
176252
delete props.instance;
177253
this.createAndDraw(props);
178254
}
255+
256+
/**
257+
* Unmount react component.
258+
*/
259+
179260
}, {
180261
key: 'componentWillUnmount',
181262
value: function componentWillUnmount() {
@@ -186,4 +267,9 @@ var AnyChart = function (_React$Component) {
186267
return AnyChart;
187268
}(_react2.default.Component);
188269

270+
/**
271+
* Default export.
272+
*/
273+
274+
189275
exports.default = AnyChart;

dist/anychart-react.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/chart_with_json/chart_with_json.min.js

Lines changed: 66 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/charts_with_controls/charts_with_controls.min.js

Lines changed: 66 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/choropleth_map/choropleth_map.min.js

Lines changed: 66 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/data_streaming/data_streaming.min.js

Lines changed: 66 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/multiseries_column_chart/multiseries_column_chart.min.js

Lines changed: 66 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/simple_dashboard/simple_dashboard.min.js

Lines changed: 66 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/src/chart_with_json.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const complexSettings = {
1212
orientation: 'right',
1313
enabled: true,
1414
labels: {
15-
textFormatter: '{%Value}{decimalPoint:\\,}',
15+
format: '{%Value}{decimalPoint:\\,}',
1616
fontColor: 'red'
1717
}
1818
}],

examples/stock/stock.min.js

Lines changed: 66 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)