Skip to content

Commit b0c55f5

Browse files
committed
Merge branch 'release/2.0.6'
2 parents f3914db + f480882 commit b0c55f5

File tree

7 files changed

+49
-31
lines changed

7 files changed

+49
-31
lines changed

dist/drill-down.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ function (_React$Component) {
13551355
}
13561356

13571357
modules.forEach(function (m) {
1358-
if (m.getName || m.name) {
1358+
if (m.getName && m.getType || m.name && m.type) {
13591359
core.addDep(m);
13601360
} else {
13611361
m(core);

dist/drill-down.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.

dist/react-fusioncharts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function (_React$Component) {
155155
}
156156

157157
modules.forEach(function (m) {
158-
if (m.getName || m.name) {
158+
if (m.getName && m.getType || m.name && m.type) {
159159
core.addDep(m);
160160
} else {
161161
m(core);

dist/react-fusioncharts.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.

lib/ReactFC.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function (_React$Component) {
5050
}
5151

5252
modules.forEach(function (m) {
53-
if (m.getName || m.name) {
53+
if (m.getName && m.getType || m.name && m.type) {
5454
core.addDep(m);
5555
} else {
5656
m(core);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-fusioncharts",
3-
"version": "2.0.5",
3+
"version": "2.0.6",
44
"description": "Simple and Lightweight React component for FusionCharts JavaScript Charting Library",
55
"main": "lib/ReactFC.js",
66
"author": {

src/ReactFC.js

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import fusionChartsOptions from './utils/options';
66

77
class ReactFC extends React.Component {
88
static fcRoot(core, ...modules) {
9-
modules.forEach((m) => {
10-
if (m.getName || m.name) {
9+
modules.forEach(m => {
10+
if ((m.getName && m.getType) || (m.name && m.type)) {
1111
core.addDep(m);
1212
} else {
1313
m(core);
@@ -21,15 +21,18 @@ class ReactFC extends React.Component {
2121

2222
this.containerId = uuid();
2323
this.oldOptions = null;
24-
this.FusionCharts = props.fcLibrary || ReactFC.fusionChartsCore || FusionCharts;
24+
this.FusionCharts =
25+
props.fcLibrary || ReactFC.fusionChartsCore || FusionCharts;
2526
}
2627

2728
componentDidMount() {
2829
this.renderChart();
2930
}
3031

3132
componentWillReceiveProps(nextProps) {
32-
if (!this.oldOptions) { return; }
33+
if (!this.oldOptions) {
34+
return;
35+
}
3336
this.detectChanges(nextProps);
3437
}
3538

@@ -46,17 +49,19 @@ class ReactFC extends React.Component {
4649
'type',
4750
'dataFormat',
4851
'dataSource',
49-
'events',
52+
'events'
5053
];
5154

5255
this.checkAndUpdateChartDimensions(currentOptions, oldOptions);
5356
this.checkAndUpdateChartType(currentOptions, oldOptions);
5457
this.checkAndUpdateChartData(currentOptions, oldOptions);
5558
this.checkAndUpdateEvents(currentOptions, oldOptions);
5659
this.checkAndUpdateRestOptions(
57-
fusionChartsOptions.filter(option => optionsUpdatedNatively.indexOf(option) === -1),
60+
fusionChartsOptions.filter(
61+
option => optionsUpdatedNatively.indexOf(option) === -1
62+
),
5863
currentOptions,
59-
oldOptions,
64+
oldOptions
6065
);
6166

6267
this.oldOptions = currentOptions;
@@ -68,18 +73,21 @@ class ReactFC extends React.Component {
6873
const oldWidth = oldOptions.width;
6974
const oldHeight = oldOptions.height;
7075

71-
if (String(currWidth) !== String(oldWidth) || String(currHeight) !== String(oldHeight)) {
76+
if (
77+
String(currWidth) !== String(oldWidth) ||
78+
String(currHeight) !== String(oldHeight)
79+
) {
7280
if (!utils.isUndefined(currWidth) && !utils.isUndefined(currHeight)) {
7381
this.chartObj.resizeTo(currWidth, currHeight);
7482
} else {
7583
if (!utils.isUndefined(currWidth)) {
7684
this.chartObj.resizeTo({
77-
w: currWidth,
85+
w: currWidth
7886
});
7987
}
8088
if (!utils.isUndefined(currHeight)) {
8189
this.chartObj.resizeTo({
82-
h: currHeight,
90+
h: currHeight
8391
});
8492
}
8593
}
@@ -103,9 +111,15 @@ class ReactFC extends React.Component {
103111
const oldDataFormat = oldOptions.dataFormat;
104112
const oldData = oldOptions.dataSource;
105113

106-
if (String(currDataFormat).toLowerCase() !== String(oldDataFormat).toLowerCase()) {
114+
if (
115+
String(currDataFormat).toLowerCase() !==
116+
String(oldDataFormat).toLowerCase()
117+
) {
107118
if (!utils.isUndefined(currDataFormat) && !utils.isUndefined(currData)) {
108-
this.chartObj.setChartData(currData, String(currDataFormat).toLowerCase());
119+
this.chartObj.setChartData(
120+
currData,
121+
String(currDataFormat).toLowerCase()
122+
);
109123
// If the chart dataFormat is changed then
110124
// animate the chart to show the changes
111125
this.chartObj.render();
@@ -116,7 +130,7 @@ class ReactFC extends React.Component {
116130
currData,
117131
// When dataFormat is not given, but data is changed,
118132
// then use 'json' as default dataFormat
119-
currDataFormat ? String(currDataFormat).toLowerCase() : 'json',
133+
currDataFormat ? String(currDataFormat).toLowerCase() : 'json'
120134
);
121135
}
122136
}
@@ -138,15 +152,17 @@ class ReactFC extends React.Component {
138152
if (this.detectChartEventsChange(currEvents, oldEvents)) {
139153
if (!utils.isUndefined(currEvents)) {
140154
temp1 = Object.assign({}, currEvents);
141-
temp2 = utils.isUndefined(oldEvents) ? {} : Object.assign({}, oldEvents);
142-
Object.keys(temp2).forEach((eventName) => {
155+
temp2 = utils.isUndefined(oldEvents)
156+
? {}
157+
: Object.assign({}, oldEvents);
158+
Object.keys(temp2).forEach(eventName => {
143159
if (temp2[eventName] === temp1[eventName]) {
144160
temp1[eventName] = undefined;
145161
} else {
146162
this.chartObj.removeEventListener(eventName, temp2[eventName]);
147163
}
148164
});
149-
Object.keys(temp1).forEach((eventName) => {
165+
Object.keys(temp1).forEach(eventName => {
150166
if (temp1[eventName]) {
151167
this.chartObj.addEventListener(eventName, temp1[eventName]);
152168
}
@@ -157,13 +173,15 @@ class ReactFC extends React.Component {
157173

158174
detectChartEventsChange(currEvents, oldEvents) {
159175
if (utils.isObject(currEvents) && utils.isObject(oldEvents)) {
160-
return !(this.isSameChartEvents(currEvents, oldEvents));
176+
return !this.isSameChartEvents(currEvents, oldEvents);
161177
}
162178
return !(currEvents === oldEvents);
163179
}
164180

165181
isSameChartEvents(currEvents, oldEvents) {
166-
if (Object.keys(currEvents).length !== Object.keys(oldEvents).length) { return false; }
182+
if (Object.keys(currEvents).length !== Object.keys(oldEvents).length) {
183+
return false;
184+
}
167185
const currEventNames = Object.keys(currEvents);
168186
for (let i = 0; i < currEventNames.length; ++i) {
169187
const evName = currEventNames[i];
@@ -177,13 +195,16 @@ class ReactFC extends React.Component {
177195
checkAndUpdateRestOptions(restOptions, currentOptions, oldOptions) {
178196
let optionsUpdated = false;
179197

180-
restOptions.forEach((optionName) => {
198+
restOptions.forEach(optionName => {
181199
const currValue = currentOptions[optionName];
182200
const oldValue = oldOptions[optionName];
183201

184202
if (!this.isSameOptionValue(currValue, oldValue)) {
185203
if (!utils.isUndefined(currValue)) {
186-
if (this.chartObj.options && this.chartObj.options.hasOwnProperty(optionName)) {
204+
if (
205+
this.chartObj.options &&
206+
this.chartObj.options.hasOwnProperty(optionName)
207+
) {
187208
this.chartObj.options[optionName] = currValue;
188209
optionsUpdated = true;
189210
}
@@ -203,14 +224,13 @@ class ReactFC extends React.Component {
203224
return String(currValue) === String(oldValue);
204225
}
205226

206-
207227
renderChart() {
208228
const currentOptions = this.resolveChartOptions(this.props);
209229
const events = {};
210230

211231
currentOptions.renderAt = this.containerId;
212232

213-
Object.keys(this.props).forEach((value) => {
233+
Object.keys(this.props).forEach(value => {
214234
const event = value.match(/^fcEvent-.*/i);
215235
if (event && typeof this.props[value] === 'function') {
216236
const eventName = value.replace(/^fcEvent-/i, '');
@@ -256,9 +276,7 @@ class ReactFC extends React.Component {
256276
}
257277

258278
render() {
259-
return (
260-
<div className={this.props.className} id={this.containerId} />
261-
);
279+
return <div className={this.props.className} id={this.containerId} />;
262280
}
263281
}
264282

0 commit comments

Comments
 (0)